My goal is this: I have two computers and a jruby script which has a
couple
of “require” statements in it. The script runs fine on computer one. My
goal is to get it to run on computer two such that I actually ship the
script and the gems that are required in the script (imagine computer
two
is a fresh install of jruby with no gems).
What is the easiest way to do this?
What I am thinking is to run the script in the first environment, see
what
gems are in the first environment, ship them over, and voila. First off,
is
this reasonable?
Second: is there a way to see what gems are loaded in the current ruby
environment?
Third: given those gems, I believe I can do the following to get the
spec:
Gem::Specification.find_by_name(gem), but what files do I need to ship
over? If I tar and zip everything in .gem_dir, how can I make that
available on the second computer?
I think I can reach my goal without using bundler, and ideally I don’t
want
users to have to setup a separate file unless they really have to.
I’ve figured out how to get the loaded gems and where they are
installed,
so now it’s just a matter of getting them on the right path in the other
environment.
When I start a new JRuby project I create a directory for it and extract
JRuby into it. I create a short shell script that I can double-click to
open a terminal at that directory and which also adds the JRuby /bin
directory to the Path. Then when I do gem install xxx the gem is
automatically put into the JRuby in that directory. After I have
completed my program I can then copy the whole directory to any other
computer and it works the same (assuming the other computer has the
JVM). This works with JRuby using java stuff like Swing and Miglayout
also, provided the jars are also in the project directory.
My goal is this: I have two computers and a jruby script which has a
couple of “require” statements in it. The script runs fine on
computer
one. My goal is to get it to run on computer two such that I actually
ship the script and the gems that are required in the script (imagine
computer two is a fresh install of jruby with no gems).
What is the easiest way to do this?
Not sure what the easiest way is (I’d look at Bundler; it has some
means
to package up all dependency gems into a folder).
Second: is there a way to see what gems are loaded in the current
ruby
environment?
This might get you started:
Gem.loaded_specs.map{|name, spec| puts "#{name} at