Using Bundler 0.9.4 with Rails 2.3.5
Posted by Christopher Rigor on February 11, 2010
Filed Under Ruby on Rails
Bundler works well with rails 3 beta but it doesn’t work with rails 2.3.5 yet. Here’s a simple way to use the gems installed by bundler.
Let’s create a rails app named labs.
$ rails labs $ cd labs $ ./script/console Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed
As you can see, the rails 2.3.5 gem is missing. We will use bundler to install the gems to vendor/bundler_gems.
$ vi Gemfile
source "http://gemcutter.org" gem "rails", "2.3.5" gem "sqlite3-ruby", :require => "sqlite3"
$ bundle install vendor/bundler_gems Fetching source index from http://gemcutter.org Resolving dependencies Installing actionmailer (2.3.5) from rubygems repository at http://gemcutter.org Installing actionpack (2.3.5) from rubygems repository at http://gemcutter.org Installing activerecord (2.3.5) from rubygems repository at http://gemcutter.org Installing activeresource (2.3.5) from rubygems repository at http://gemcutter.org Installing activesupport (2.3.5) from rubygems repository at http://gemcutter.org Installing rack (1.0.1) from rubygems repository at http://gemcutter.org Installing rails (2.3.5) from rubygems repository at http://gemcutter.org Installing rake (0.8.7) from rubygems repository at http://gemcutter.org Installing sqlite3-ruby (1.2.5) from rubygems repository at http://gemcutter.org with native extensions Your bundle is complete!
$ ./script/console Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed
The gem is still missing. Of course, the app doesn’t know where the gems are located.
We used bundler to install the gems, and in the future, we will use bundler to load the gems. Until then, we will use rubygems to load the gems. Create config/preinitializer.rb and set GEM_HOME.
$ vi config/preinitializer.rb
ENV["GEM_HOME"] = File.expand_path('../../vendor/bundler_gems', __FILE__)
$ ./script/console Loading development environment (Rails 2.3.5) >> Rails.version => "2.3.5" >> Rack.version => "1.0" >>
Comments
-
Phil
-
collintmiller
-
crigor
-
julian7
-
crigor
-
julian7
-
Etienne Vallette d'Osia