Hi All, I am pretty new to Ruby, and googled quite a bit about the gem utility, but am kind of stuck. I need some advice about maintaining good separation between ruby installs and gem directories.
In this project we have Ruby installs for dev, test and prod. The idea is we can test different versions of ruby, rails, and different gems. Then when it's getting promoted from test to prod, just cp -R the ruby directory and all it's gems from test to prod. Nice idea except the gems paths are all fouled up now.
Question: How does the gem script actually figure out it's environment and where it's gems are? Is there a config file somewhere? I can't find it if there is.
Question: What is the best practice for this kind of situation (test/dev/prod environments for ruby) ?
I am aware of the GEM_PATH and GEM_HOME environment variables. They are not currently set. I have lots of shell scripts pointing at this ruby install, and don't want to have to add GEM_PATH and GEM_HOME to all of those shells scripts. However if that's the only way, then I guess I can live with that.
I am also aware of the sandbox gem but do not want to make this overly complicated. It should be possible to do this without additional gem dependencies.
$ which ruby
/home/grindstone/prod/ruby/current/bin/ruby # prod is good
$ which gem
/home/grindstone/prod/ruby/current/bin/gem # prod is good
$ echo $GEM_PATH # not set
$ echo $GEM_HOME # not set
# gem env bad! gem seems looking at test, not prod...
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.1
- RUBY VERSION: 1.9.1 (2009-05-12 patchlevel 129) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/grindstone/test/ruby/1.9.1-p129/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /home/grindstone/test/ruby/1.9.1-p129/bin/ruby
- EXECUTABLE DIRECTORY: /home/grindstone/test/ruby/1.9.1-p129/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/grindstone/test/ruby/1.9.1-p129/lib/ruby/gems/1.9.1
- /home/agr/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://gems.rubyforge.org/
Thanks in advance!
···
--
Alex Rice <agr@ncgr.org>
Software Engineer
National Center for Genome Resources (NCGR)
http://www.ncgr.org
(505)995-4457