Ruby on Rails Wednesday, April 30, 2014


Is there an automated way of loading initializers depending on whether you are currently using ruby or jruby? I have an internal gem that loads some jRuby tasks, but I fail to run them because other non-jruby initializers keep erroring out, understandably since they are not currently installed as jruby gems. 

Assuming the following gemfile: 

gem rails 

platform :ruby do
  ruby '2.1.0' if RUBY_ENGINE == 'ruby'
  gem A  # Not needed when running jruby

platform :jruby do
  ruby '1.9.3' if RUBY_ENGINE == 'jruby'
  gem 'internal_gem'

I won't be able to run anything provided by 'internal_gem' unless I move gem A to the jruby platform, which is not very nice because it would mean I will be doing it for every gem I add. 

Any ideas? 

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment