Note that there are some explanatory texts on larger screens.

plurals
  1. POPlatform specific gems for autotest with bundler
    primarykey
    data
    text
    <p>In the rails project I'm working on I inserted support for rspec, cucumber and autotest with this Gemfile (partial)</p> <pre><code>gem 'rspec-rails' gem 'cucumber-rails' gem 'autotest-standalone' gem 'autotest-rails-pure' gem 'zentest-without-autotest' </code></pre> <p>however in order to run tests with autotest i need to execute <code>bundle exec autotest</code> otherwise it fails with this message</p> <pre><code>$ 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. </code></pre> <p>Now I'm developing on a Mac and I'd like to enable autotest-growl and autotest-fsevents gem, but if I insert those lines in my <code>~/.autotest</code></p> <pre><code>require 'autotest/growl' require 'autotest/fsevent' </code></pre> <p>then I need to insert the corresponding gems in the Gemfile and everything works, but it breaks builds on my CI server (which is on Linux)</p> <p>How to solve this without maintaining a different Gemfile for local and CI environments?</p> <p>EDIT:</p> <p>For the moment I solved with these lines in Gemfile</p> <pre><code>if RUBY_PLATFORM.downcase.include?("darwin") # I'm on Mac gem 'autotest-fsevent' gem 'autotest-growl' end </code></pre> <p>It works both locally and on the CI server, I don't know if it mess something, for the moment it seems to work flawlessly.</p> <p>Any cleaner way to do that is still welcome.</p> <p>EDIT2:</p> <p>I switched to groups solutions. While the previous monkeypatch works pretty well both in development and for continuous integration, it will gives you an error in production if you use capistrano bundler tasks for deployments or if you use <code>bundle install --deployment</code> option (which is advised in production)</p> <p>When using the <code>if RUBY_PLATFORM.downcase.include?("darwin")</code> line you'll get this error on deploy.</p> <pre><code># 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 </code></pre> <p>So my final solution to this problem is to include platform specific gems in a given group, say osx, and then in production and on CI server exclude it using bundle.</p> <p>If you use capistrano to deploy put this in your <code>config.rb</code></p> <pre><code>set :bundle_without, [:development, :test, :osx] # capistrano bundler task require "bundler/capistrano" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload