新手问题 如何指定 Gemfile

jasonz · 2014年09月03日 · 最后由 HungYuHei 回复于 2014年09月03日 · 2839 次阅读

譬如想在 cron 里面执行 rake,因为 rake 版本原因,都是先cd进 rails 项目,然后bundle exec rake ... RAILS_ENV=production rake可以-f指定 Rakefile,不知能不能指定 Gemfile? 这样就不用进 rails 项目再执行了。。 whenever 虽然是在 rails 项目中设置的,不过生成的 cron 还没什么区别。 有没有bundle自带的参数或是环境变量什么的? 谢谢~

ENV['BUNDLE_GEMFILE']

bundler v1.7.2 有以下的参数

--binstubs    -- generate bin stubs for bundled gems to ./bin
--deployment  -- install using defaults tuned for deployment environments
--frozen      -- do not allow the Gemfile.lock to be updated after this install
--gemfile     -- use the specified gemfile instead of Gemfile
--local       -- do not attempt to connect to rubygems.org
--no-color    -- disable colorization in output
--path        -- specify a different path than the system default
--quiet       -- only output warnings and errors
--system      -- install to the system location
--without     -- exclude gems that are part of the specified named group

@HungYuHei http://bundler.io/v1.7/man/bundle-exec.1.html 没有看到gemfile参数,bundle-install好像有这个参数。不过可以用BUNDLE_GEMFILE来指定 gemfile。rvmsudo BUNDLE_GEMFILE= bundle exec rake -f ...

不过譬如 redmine,config/boot.rb 好像里面已经写了ENV['BUNDLE_FILE'] ||= File.expand_path('../../Gemfile', __FILE__)

#3 楼 @jasonz 我误解了你的问题了,我上面说的参数确实是 bundle-install 的

需要 登录 后方可回复, 如果你还没有账号请 注册新账号