Mohamed Wael Khobalatte
2014-May-14 14:24 UTC
Optional Rails initializer loading depending on Ruby plaform
Hey, I found myself having to use jRuby in my app for a very very small but essential piece of code. The code in question is bundled in a gem which I require in Bundler under the jRuby platform, with all the rest of my gems put under MRI. This was unfortunately necessary otherwise if I don't put the rest under MRI Bundler will try to download jRuby versions of every gem, which eventually breaks if a gem uses any C extensions. This has worked for me fine, but it required that I patch all my initializers to make them load conditionally, i.e. depending on which platform they are part of in Bundler. Because Rails treats them as regular files with no mapping to their gems (Most of the files are gem initializers in my case, but I concede that it might not the case for everyone), they will load, and since some are not installed for one platform or the other, this errors out. Has anyone been subject to problems like this? There are many solutions for my case, but I would like to know what people think about this or if someone has solved this before in other way. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.