Overview of rails_gem_install
Installs the gem dependencies of your Rails 2 project where rake gems:install fails.
Using rake gems:install has a number of problems:
It depends on Rails. You have to manually install Rails before you can use rake gems:install
It depends on your Rails environment. This can create a circular dependency where some file (particularly vendored plugins/gems) can require a gem to be loaded before the task to install it runs.
Most of the time it just doesn't work. Adding a new config.gem requirement, then running rake gems:install will fail with a complaint that it is missing the gem you are expecting it to install for you.
This tool aims to solve these problems by providing a tool that is NOT dependent on Rails or the Rail apps's environment in order to determine and install the dependencies.
For more background and a brief description of how it works, check out the blog post at sleeplesscoding.blogspot.com/2010/07/install-rails-apps-dependencies-where.html
gem install rails_gem_install
IMPORTANT: You must run this command from the RAILS_ROOT of your Rails 2 app.
cd my_rails_app RAILS_ENV=production rails_gem_install
This will install all the gem dependencies for running your Rails app under the specified environment, so you may want to do this multiple times for multiple environments. For example, you may want to do this using your test environment too, if you have additional config.gem configurations in config/environments/test.rb.
Note that this will run gem install commands, so run as root/sudo if you want them to be installed that way.
This has only been tested for a Rails 2.3.5 project where there was no pre-existing Rails installation or other gems, and incrementally after that as the config.gem configuration changes. There may be some corner-case dependencies I may have missed.
Note on Patches/Pull Requests
Fork the project.
Make your feature addition or bug fix.
Add tests for it. This is important so I don't break it in a future version unintentionally.
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
Send me a pull request. Bonus points for topic branches.
Copyright © 2010 Scott W. Bradley. See LICENSE for details.