Shared Gems

Is there a way to get JRuby use an existing CRuby Gem repository, or
is this a bad idea?

I think I have read of this, but could not find anything on it.

Thanks,
Michael

On 7/27/08, Charles Oliver N. [email protected] wrote:

----- Original Message ----
----- Original Message ----

An unexpected error has been detected by Java Runtime Environment:

http://xircles.codehaus.org/manage_email

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

You need to set an environment variable, I think it’s GEM_PATH or
GEM_HOME.

Be careful though, I’ve seen this cause havoc on a machine where the
owner forgot that they’d done this (and it was set in an obscure place
that eluded detection).

Tom

On 28/07/2008, at 7:37 AM, Michael G. wrote:

method in rexml that’s blowing up. Two things you should do:
Thanks for the report!

Problematic frame:

1_dot_8
Thanks!


http://xircles.codehaus.org/manage_email


tom adams | e:tomjadamsgmail.com


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Mon, Jul 28, 2008 at 6:37 AM, Michael G. [email protected]
wrote:

Is there a way to get JRuby use an existing CRuby Gem repository, or
is this a bad idea?

Sharing the same repository is not recommended since rubygems installs
native extensions. So if you install using CRuby and then try and run
it using JRuby it will blow up because we cannot load C extensions
(vice-versa if you install with JRuby and then try to use with CRuby).
If you only use gems with no extensions then it is ok to do this.

-Tom


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: [email protected] , [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Le 28 juil. 08 à 03:36, Thomas E Enebo a écrit :

-Tom

i knew that, however, when i do :
$ sudo jruby -S gem install monkeybars

monkeybars is installed under CRuby

also doing :

$ jruby -S gem list --local

the list i get is the CRuby one.

in my shell config, obviously i have :
export RUBYOPT=rubygems
export GEM_HOME=/opt/local/lib/ruby/gems/1.8
export RUBYLIB=/opt/local/lib/ruby/:/opt/local/lib/ruby/site_ruby/
1.8:/opt/local/lib/ruby/site_ruby/1.9.0
export RUBYGEMS=/opt/local/lib/ruby/site_ruby/1.8

this is for CRuby

Also i’ve added /opt/jruby/bin to my PATH

$ jruby -v
ruby 1.8.6 (2008-03-18 rev 6255) [ppc-jruby1.1RC3]

I’ve read the file /opt/jruby/bin/gem
and i see nothing especial for jruby.

I suppose we have to put some specific environment variables for jRuby ?

in such a case, what are the keys name ?

best,

Yvon

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Yvon,

I’m not sure of the question, but it looks as though you have GEM_HOME
set to the MRI ruby install location, so JRuby will install gems and
list gems from this location also.

From reading your description below, the behaviour you describe is
the expected behaviour; you’ve told JRuby to use GEM_HOME, so it
dutifully puts gems there.

If you don’t want JRuby to use the MRI ruby directory, just unset
the GEM_HOME variable. JRuby will then use the default location.

Not sure if this helps or hinders…

Cheers,
Tom

On 28/07/2008, at 5:06 PM, yvon.thoraval wrote:

native extensions. So if you install using CRuby and then try and

export GEM_HOME=/opt/local/lib/ruby/gems/1.8

Yvon

tom adams | e:tomjadamsgmail.com


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hey,

quiet frankly i put those env vars years ago and i don’t know if if
still usefull for CRuby…

anyway, thanks !

This is the same problem a good friend of mine ran into last week, the
variables for his shell were not in .profile or .bashrc, (~/.MacOSX/
Info.plist or such) so he had a hard time finding them. Like you, he
did this a while ago, before he started using JRuby.

I’m glad you’ve got it resolved!

Cheers,
Tom

tom adams | e:tomjadamsgmail.com


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

2008/7/28 Tom A. [email protected]:

Yvon,

If you don’t want JRuby to use the MRI ruby directory, just unset the
GEM_HOME variable. JRuby will then use the default location.

clear enough, after unsetting GEM_HOME, i got monkeybars under jruby
then, I’ll add :
ENV[‘GEM_HOME’]=‘’
in the /opt/jruby/bin/gem
and see if it’s sufficiant avoiding to do that by hand (unset
GEM_HOME) each time i need to use :
$ sudo jruby -S gem install some_gem

quiet frankly i put those env vars years ago and i don’t know if if
still usefull for CRuby…

anyway, thanks !


yvon


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Michael G. wrote:

Is there a way to get JRuby use an existing CRuby Gem repository,
or is this a bad idea?

I’m sharing repositories between different kind of interpreters. I’m
using following bunch of script (self-describing). It easy to get used
to and works relatively well.

/space/ruby/gem-repo # shared one
/space/ruby/gem-repo-c # MRI native extensions
/space/ruby/gem-repo-c # JRuby native extensions

But YMMV, as you’ve read from majority of others (shebang lines omitted,
having ~/bin/ruby on $PATH):

~/bin/ruby$ cat cgem
. ~/bin/ruby/set_gems_cruby
gem $@

~/bin/ruby$ cat jgem
. ~/bin/ruby/set_gems_jruby
jruby -S gem $@

~/bin/ruby$ cat cgem_install
repo="/space/ruby/gem-repo-c"
cgem install -i $repo $@

~/bin/ruby$ cat jgem_install
repo="/space/ruby/gem-repo-j"
jgem install -i $repo $@

~/bin/ruby$ cat set_gems_jruby
export GEM_HOME="/space/ruby/gem-repo"
export GEM_PATH="/space/ruby/gem-repo-j"
export PATH="$GEM_PATH/bin:$PATH"

~/bin/ruby$ cat set_gems_cruby
export GEM_HOME="/space/ruby/gem-repo"
export GEM_PATH="/space/ruby/gem-repo-c"
export PATH="$GEM_PATH/bin:$PATH"

m.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

The Rails wiki has a useful page on this stuff (although it doesn’t
talk about JRuby):

http://wiki.rubyonrails.org/rails/pages/HowToUseMultipleGemRepositories


James M. | [email protected]
Ruby and Ruby on Rails consulting
blog.restphone.com


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On a somewhat related topic, what is the preferred way to upgrade to a
new
version of JRuby without having to reinstall all your gems? I have a
few
dozen gems in JRuby 1.1.4, and I’d like to move to JRuby 1.1.6 without
having to reinstall all of them. Would I use GEM_HOME and GEM_PATH to
point
to my 1.1.4 gem repository, or is there a better way to do this?

Thanks,
Lee

James M.-7 wrote:


View this message in context:
http://www.nabble.com/Shared-Gems-tp18680889p21178358.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Martin K. wrote:

/space/ruby/gem-repo-c # JRuby native extensions
Sorry, last one should be ‘/space/ruby/gem-repo-j’.

m.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

nabblee wrote:

On a somewhat related topic, what is the preferred way to upgrade to a new
version of JRuby without having to reinstall all your gems? I have a few
dozen gems in JRuby 1.1.4, and I’d like to move to JRuby 1.1.6 without
having to reinstall all of them. Would I use GEM_HOME and GEM_PATH to point
to my 1.1.4 gem repository, or is there a better way to do this?

I think a lot of people have just been moving everything under
lib/ruby/gems/1.8 from the old install to the new install, and things
continue working ok. I’d like a better solution, but this one is pretty
painless.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email