:platform specification for jruby - shouldn't it be "java" ?

94 views
Skip to first unread message

TJG

unread,
Jul 5, 2014, 11:02:56 PM7/5/14
to ruby-b...@googlegroups.com
Hi all;

Just curious about something that doesn't align with Bundler documentation using Bundler 1.6.3 under JRuby 1.7.13 under RVM on Ubuntu 12.04.

The bundler docs indicate that the platform specification for JRuby is "jruby", and yet under my environment, the bundle platform command reports "java". 

So, shouldn't the bundler docs indicate "java" as the appropriate platform identifier for JRuby? 

Tim

TJG

unread,
Sep 17, 2014, 10:33:24 PM9/17/14
to ruby-b...@googlegroups.com
I'm bumping this, because it's still a confusing issue:

If my JRuby environment reports RUBY_PLATFORM as "java", how is this Gemfile directive supposed to work? Does Bundler understand RUBY_PLATFORM "java" to be "jruby"? 

platforms :jruby do 
 ...
end

Why would RUBY_PLATFORM not report "jruby"? 

[tjg@mbp ~/Sites/test] $ jruby -e 'puts RUBY_PLATFORM'
java
[tjg@mbp ~/Sites/test] $ bundle platform
Your platform is: java

Your app has gems that work on these platforms:
* java

T

André Arko

unread,
Sep 18, 2014, 1:34:45 AM9/18/14
to ruby-b...@googlegroups.com
Hi Tim,

Ruby platform and Bundler platform are completely disconnected things. As you can see in the Gemfile documentation[1], Bundler’s platform includes the major Ruby version (1.8, 1.9, 2.0, 2.1, etc), whether the interpreter is MRI, Rubinius, or JRuby, and other things. The RUBY_PLATFORM variable simply returns “java” on JRuby, and “ruby” on MRI and Rubinius.


--
You received this message because you are subscribed to the Google Groups "ruby-bundler" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-bundler...@googlegroups.com.
To post to this group, send email to ruby-b...@googlegroups.com.
Visit this group at http://groups.google.com/group/ruby-bundler.
For more options, visit https://groups.google.com/d/optout.

TJG

unread,
Sep 18, 2014, 6:54:56 AM9/18/14
to ruby-b...@googlegroups.com

Ah, thanks for the clarification, André. I had assumed Bundler was consulting RUBY_PLATFORM. 

So, what is the preferred method, then, to detect "ruby 1.9" versus "JRuby 1.7.13" (for example)?

Tim


On Saturday, July 5, 2014 11:02:56 PM UTC-4, TJG wrote:

TJG

unread,
Sep 18, 2014, 7:00:59 AM9/18/14
to ruby-b...@googlegroups.com
Whoops, sorry, I realize that Bundler has "jruby" as a platform. I was trying to figure out why bundler was insisting to trying to build native extensions for a gem, but just realized my specification probably isn't specific enough:

gem 'binding_of_caller', :platforms => :ruby_19

This means it would still be included under jruby, right? 

How do I best specify that this gem is for non-jruby only?

Tim



On Saturday, July 5, 2014 11:02:56 PM UTC-4, TJG wrote:

TJG

unread,
Sep 18, 2014, 7:58:34 AM9/18/14
to ruby-b...@googlegroups.com
Arrgh! Apologies...

I just discovered that another gem reference (dependency) was causing bundler to install binding_of_caller... (which I didn't want under jruby) and my problem was not related to the detection of the platform. 

Thanks again, though, André for the clarification.

Tim


On Saturday, July 5, 2014 11:02:56 PM UTC-4, TJG wrote:
Reply all
Reply to author
Forward
0 new messages