我目前正在使用guard即guard-coffeescript gem来编译我的javascript(以及将来我可能会在我的OSX开发系统上添加一些更多的保护任务)。我在我的Gemspec中添加了rb-fsevent
gem,现在我在很多Gemspecs中看到它添加了if语句:
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
尝试部署到在Linux下运行的登台/生产环境,在服务器上执行的脚本使用以下异常中的bundle install --deployment
结果:
# bundle install --deployment
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
You have deleted from the Gemfile:
* rb-fsevent
有没有解决这个问题的方法,或者我只需要删除if,以便我可以部署到我的系统,然后安装在非OSX平台上无用的gem?
-
编辑:我在部署到我的暂存环境之前运行bundle install
并在第一次失败后运行bundle check
。我删除了if语句后运行了它。
答案 0 :(得分:23)
我有类似的问题。如果您使用的是capistrano,则可以设置以下选项:
set :bundle_without, [:darwin, :development, :test]
然后将您的gem'rb-fsevent'行包装在名为darwin的组中。像这样的东西应该很好用:
group :test, :darwin do
gem 'rb-fsevent'
end
这使得bundler在服务器上执行此操作:
bundle --without darwin development test
这意味着它忽略了Gemfile.lock中的那些组。你在做什么会让你的OS X机器和你的服务器得到不同的结果锁文件。这就是抱怨的原因。
答案 1 :(得分:6)
我有完全相同的问题,但是,只有在我删除了常用的:require => false if RUBY_PLATFORM =~ /darwin/i
字符串后,Luke的解决方案才能解决它。
答案 2 :(得分:2)
如
所述https://github.com/guard/guard
解决方案就是
group :development do
gem 'rb-inotify', :require => false
gem 'rb-fsevent', :require => false
gem 'rb-fchange', :require => false
end