Forum: JRuby Jruby complete and bundle

C0cb3aadb9a66d00df16686f4a1fc312?d=identicon&s=25 Tim Uckun (Guest)
on 2013-12-02 05:03
(Received via mailing list)
Hi.

I have found a couple of web sites which describe how to use jruby
complete
but it doesn't seem to work for me.

/usr/bin/java -jar /vagrant/bin/jruby-complete-1.7.8.jar -S bundle exec
trinidad
jruby: No such file or directory -- bundle (LoadError)

Similarly I can't invoke rake either.

Could somebody point out what I am doing wrong.

Thanks.
2c0c4cf3ccc8da22f7c3b9586ce1cd70?d=identicon&s=25 Christian MICHON (Guest)
on 2013-12-02 06:48
(Received via mailing list)
Bundler is not in jruby complete. You need to add it into the jar file
manually, or install it in a physical folder and add this path to gem
path
variable.

The 1st option is what I usually do.
C0cb3aadb9a66d00df16686f4a1fc312?d=identicon&s=25 Tim Uckun (Guest)
on 2013-12-02 07:00
(Received via mailing list)
I tried using bundler to bundle bundler but that didn't work. I put the
bundler in my gemfile and then did a bundle packake which moved all the
gems to /vendor/cache but not bundler. Odd.


How do I put it into the jar file?
974b3d592f78510db0227e528841ccb9?d=identicon&s=25 Robin McKay (robin2)
on 2013-12-02 09:49
There seems to be two threads associated with this topic - perhaps
someone can merge them.

The easiest way to use JRuby complete - assuming the JVM is already
installed is to create a directory structure for your program project
like this

   projectDirectory
       lib
       GemHome

Put a copy of jruby-complete-xxx.jar into lib

Create a shell script (I call mine localTerminal.sh) in the project
directory with this content

   #!/bin/bash

   export PATH=$PWD:$PATH;
   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib;
   export GEM_HOME=$PWD/GemHome;
   x-terminal-emulator

As far as I know a similar .bat file will work on Windows

Just for convenience make another shell script called JRUBY with this in
it

   #!/bin/bash

   java -jar lib/jruby-complete-1.7.0.jar $*


When you double-click the shell script it opens a terminal at the
project directory and then you can run your program with JRUBY myprog.rb
and you can list gems and do all the other stuff with JRUBY -S gem list.

Once you have created this framework you can just copy it somewhere else
to start another project.

No need for RVM or Bundler or any of that stuff - JRuby makes Ruby
Really Simple.

...R
2c0c4cf3ccc8da22f7c3b9586ce1cd70?d=identicon&s=25 Christian MICHON (Guest)
on 2013-12-02 10:20
(Received via mailing list)
The headline of the thread was clear: the issue is on how to use bundler
with jruby-complete.

Your sentence 'No need for RVM or Bundler or any of that stuff' is out
of
context I guess.

I see only 1 thread here, not 2.
974b3d592f78510db0227e528841ccb9?d=identicon&s=25 Robin McKay (robin2)
on 2013-12-02 15:49
... if you insist on doing things the hard way.

...R
C0cb3aadb9a66d00df16686f4a1fc312?d=identicon&s=25 Tim Uckun (Guest)
on 2013-12-03 09:25
(Received via mailing list)
Just to follow up on this advice.

I have a rails app I am using for testing. It has no real functionality
but
I put a bunch of gems in the Gemfile to test them.  Because this is a
test
I am using the jruby complete gem with bundler in it. I used the
instructions in the gist somebody posted here to put bundler in the
jruby
complete gem.

I installed all the gems into vendor using this script

...

${jruby}  -S gem install -i ${VENDORED_GEM_HOME} --no-rdoc --no-ri
bundler
${jruby}  -S gem install -i ${VENDORED_GEM_HOME} --no-rdoc --no-ri rake
${jruby} -S bundle install --path=${VENDORED_GEM_HOME} --binstubs
--without
development test

Then I did a vagrant up  to fire up a VM with nothing but java installed
and attempted to list the gems

VENDORED_GEM_HOME="${RAILS_DIR}/vendor/bundle"
VENDORED_GEM_PATH=${VENDORED_GEM_HOME}
JRUBY_VERSION="1.7.8"

export GEM_HOME=${VENDORED_GEM_HOME}
export GEM_PATH=${VENDORED_GEM_PATH}

${jruby} -S gem list

gives the following output

*** LOCAL GEMS ***

bundler (1.3.5)
rake (10.1.0)

mmmm. Only two gems.  I get the feeling it's only looking into the jar
and
ignoring the GEM_HOME.  Let's try bundler

${jruby} -S bundle list

Gems included by the bundle:
Could not find rake-10.1.0 in any of the sources

So weird.






‚Äč
2c0c4cf3ccc8da22f7c3b9586ce1cd70?d=identicon&s=25 Christian MICHON (Guest)
on 2013-12-03 10:03
(Received via mailing list)
Then I would suggest the following:
- create a vendor folder at the top of your rails app, where the Gemfile
is
located
- inside this vendor folder, create a cache folder (you can do steps 1
and
2 by doing 'mkdir -p vendor/cache')
- then use bundle with 'bundle --path vendor/bundle'.

This will install the gems in vendor/bundle and not in the system. This
will ensure a non pollution of your system and easy deployment.

If you follow these steps, bundle list will work and list what is in
your
vendor/bundle accordingly.
C0cb3aadb9a66d00df16686f4a1fc312?d=identicon&s=25 Tim Uckun (Guest)
on 2013-12-03 10:22
(Received via mailing list)
Actually this is exactly what I am doing.

One thing I noticed is that bundler installs the gems into
vendor/bundle/jruby/1.9 so you have to set the GEM_PATH to that
directory
and not to vendor/bundle. If I do that then I can list all the gems but
I
still can't run trinidad because it says rake is missing.  I tried
installing rake into that directory but that doesn't seem to do
anything.

I feel like I am bit closer to making this work but still not there.


On Tue, Dec 3, 2013 at 10:01 PM, Christian MICHON <
2c0c4cf3ccc8da22f7c3b9586ce1cd70?d=identicon&s=25 Christian MICHON (Guest)
on 2013-12-03 10:31
(Received via mailing list)
No: vendor/bundle/jruby/1.9 is the correct path for bundler. Do not set
GEM_PATH.

Rake is not missing, it's installed in your jruby-complete. But nothing
stops you from adding it into your Gemfile.

Could you share your Gemfile and maybe how your simple rails app is
done?

I used this vendor/bundler approach with sinatra and trinidad (or
mizuno)
and it works out of the box with jruby...
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.