Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can bundler constrain a gem installation to a certain operating system?

I'm developing a Rails 3.1, and am using the default uglifier asset gem. That gem depends on execjs, which requires a JavaScript runtime. I develop on Mac OSX, so I never had trouble with it. Another developer uses Linux, which doesn't have a JavaScript runtime by default. So using therubyracer, a JavaScript runtime embedded in Ruby, works quite fine, but I'd like Bundler to install it only if the system is Linux. Can I specify this in the Gemfile so it'll only install in Linux and not Mac?

like image 632
Jonathan C. Avatar asked Jan 18 '23 22:01

Jonathan C.


1 Answers

you can do;

gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i

replacing the gem and the platform with appropriate ones in your case.

like image 194
John Beynon Avatar answered Jan 31 '23 10:01

John Beynon