在Rails项目我工作我插入RSpec的,黄瓜和自动测试与此Gemfile中(部分)自动测试平台特定的宝石,捆绑
gem 'rspec-rails'
gem 'cucumber-rails'
gem 'autotest-standalone'
gem 'autotest-rails-pure'
gem 'zentest-without-autotest'
支持但为了运行与自动测试的测试我需要执行bundle exec autotest
否则失败,此消息
$ autotest
loading autotest/cucumber_rails_rspec_rspec2
Error loading Autotest style autotest/cucumber_rails_rspec_rspec2 (no such file to load -- autotest/cucumber_rails_rspec_rspec2). Aborting.
现在我正在开发一个Mac上,我想启用自动测试,咆哮和自动测试,fsevents宝石,但如果我插入我的~/.autotest
那些行
require 'autotest/growl'
require 'autotest/fsevent'
然后我需要插入在Gemfile中相应的宝石和一切工作,但它打破建立我的CI服务器(这是在Linux上)上
如何解决这个不维护本地不同的Gemfile和CI环境?
编辑:
对于我的Gemfile
if RUBY_PLATFORM.downcase.include?("darwin") # I'm on Mac
gem 'autotest-fsevent'
gem 'autotest-growl'
end
它可以在本地和CI服务器上用这些行解决的那一刻,我不知道这是否摆乌龙,时刻它似乎工作完美无瑕。
任何干净的方法,仍然是受欢迎的。
编辑2:
我切换到组解决方案。虽然以前的monkeypatch在开发和持续集成方面都能很好地工作,但如果您使用capistrano bundler任务进行部署,或者使用bundle install --deployment
选件(在制作时建议),它会给您生产中的错误
使用if RUBY_PLATFORM.downcase.include?("darwin")
行会在部署时出现此错误。
# bundle install --deployment --without development test
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have deleted from the Gemfile:
* autotest-fsevent
* autotest-growl
所以我对这个问题的最终解决方案是包括在一个给定组平台特定的宝石,说OSX,然后在生产和CI服务器上使用排除捆绑它。
如果使用Capistrano的部署来把这个在您的config.rb
set :bundle_without, [:development, :test, :osx]
# capistrano bundler task
require "bundler/capistrano"
我在我的ci上使用了[这个配置](https://github.com/fabn/rails-jenkins-template),我想保持简单,所以我想继续在ci上运行简单的作为'捆绑安装;耙规格;犁耙黄瓜'。 – Fabio 2011-04-12 13:00:49
我对这个问题进行了大量搜索,目前没有解决方案。所以我会接受你的回答是正确的。 – Fabio 2011-05-28 00:42:59