【问题标题】:How can I use a Ruby Gem file local to my project as opposed to a gem installed on the system?如何使用项目本地的 Ruby Gem 文件而不是系统上安装的 gem?
【发布时间】:2014-06-26 14:50:05
【问题描述】:

我的系统上安装了 SASS gem (v3.3.8),但我有一个需要 v3.2.19 的项目。我还有一种情况,即存在 v3.2.19 的系统存在冲突(如果安装了任何旧版本的 gem,Codekit 将不会编译 SASS)。

我使用 Bundler 在我的项目本地文件夹中安装了所需 gem 的副本:

my_project/src/vendor/bundle/ruby/...

如何强制我的项目将本地文件夹中的 ruby​​ gem 用于我的 grunt 任务,而不是全局安装在我的系统上的那些?

# A sample Gemfile
source "https://rubygems.org"    

gem 'autoprefixer-rails', ">=1.2.0.20140609"
gem 'breakpoint', ">=2.0.7"
gem 'compass', ">=0.12.6"
gem 'sass', ">=3.2.19"
gem 'singularitygs', ">=1.1.2"

【问题讨论】:

  • 在项目目录(Gemfile 所在的位置)中运行 bundle install 以安装 gem 并使用 bundle exec ... 启动可执行文件,例如bundle exec compass compile
  • 我已经跑过bundle install --path vendor/bundle。我正在尝试使用:path => 指向这些文件而不是系统文件,但是无论我在vendor/bundle 文件夹中的哪个位置查看,我都会收到一条错误消息:Could not find gem 'compass (>= 0.12.6) ruby' in source at vendor/bundle/ruby/2.0.0/cache. Source does not contain any versions of 'compass (>= 0.12.6) ruby'philsinatra.net/_ex/ss.png

标签: ruby gem rubygems bundle bundler


【解决方案1】:

bundle exec 是正确的命令。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-23
    • 1970-01-01
    相关资源
    最近更新 更多