1

I typically use Red Hat Linux during development; There I need to use gems like therubyracer and libv8. However, there are times I would like to have the ability to develop on Windows and not have these gems.

Is it possible to limit gems in the Gemfile based on operating system?

ardavis
  • 9,842
  • 12
  • 58
  • 112
  • http://stackoverflow.com/questions/3642085/make-bundler-use-different-gems-for-different-platforms – gabrielhilal Feb 04 '13 at 16:48
  • This might provide you some info [Bundler platform dependent](https://github.com/carlhuda/bundler/wiki/Platform-as-a-parameter) – bullfrog Feb 04 '13 at 16:48

1 Answers1

4

You can use groups

group :unix do
  gem 'therubyracer'
  gem 'libv8'
end

# when bundling on windows:
bundle install --without unix
Kyle
  • 21,978
  • 2
  • 60
  • 61
  • @ardavis I just saw this in a project someone did at my job. I have no idea if it works as intended but I figured I'd share: `gem 'libv8' if RUBY_PLATFORM =~ /darwin/i` – Kyle Feb 04 '13 at 17:55
  • Thanks, that's interesting too! – ardavis Feb 04 '13 at 18:41