Permalink
Browse files

Upgrade for changes in Bundler 0.9.x series

* see also http://gist.github.com/302406.

Signed-off-by: Alex Coles <alex@alexcolesportfolio.com>
  • Loading branch information...
1 parent 330c9b8 commit 44531eaa4a19e33836787cd018d5d7be4d329258 @myabc myabc committed Feb 13, 2010
Showing with 73 additions and 24 deletions.
  1. +3 −7 Gemfile
  2. +42 −0 Gemfile.lock
  3. +18 −0 config/boot.rb
  4. +10 −17 config/preinitializer.rb
View
10 Gemfile
@@ -1,16 +1,12 @@
-clear_sources
-bundle_path 'vendor/bundler_gems'
+source :gemcutter
-source 'http://gemcutter.org'
-source 'http://gems.github.com'
-
-gem 'rails', '2.3.5'
+gem 'rails', '2.3.5', :require => nil
gem 'ferret', '0.11.6'
gem 'will_paginate', '2.3.11'
gem 'ruby-recaptcha', '1.0.0'
gem 'newrelic_rpm'
-only :test do
+group :test do
gem 'rspec', '1.2.9'
gem 'rspec-rails', '1.2.9'
end
View
42 Gemfile.lock
@@ -0,0 +1,42 @@
+---
+dependencies:
+- rails: = 2.3.5
+- ferret: = 0.11.6
+- will_paginate: = 2.3.11
+- ruby-recaptcha: = 1.0.0
+- newrelic_rpm: ">= 0"
+- rspec: = 1.2.9
+- rspec-rails: = 1.2.9
+specs:
+- activesupport:
+ version: 2.3.5
+- actionmailer:
+ version: 2.3.5
+- will_paginate:
+ version: 2.3.11
+- rack:
+ version: 1.0.1
+- actionpack:
+ version: 2.3.5
+- rspec:
+ version: 1.2.9
+- rspec-rails:
+ version: 1.2.9
+- newrelic_rpm:
+ version: 2.9.9
+- rake:
+ version: 0.8.7
+- ferret:
+ version: 0.11.6
+- activerecord:
+ version: 2.3.5
+- activeresource:
+ version: 2.3.5
+- rails:
+ version: 2.3.5
+- ruby-recaptcha:
+ version: 1.0.0
+hash: c2397dcbd396cedcf5ecd4d51527d76c691b4a1d
+sources:
+- Rubygems:
+ uri: http://gemcutter.org
View
18 config/boot.rb
@@ -106,5 +106,23 @@ def read_environment_rb
end
end
+class Rails::Boot
+ def run
+ load_initializer
+ extend_environment
+ Rails::Initializer.run(:set_load_path)
+ end
+
+ def extend_environment
+ Rails::Initializer.class_eval do
+ old_load = instance_method(:load_environment)
+ define_method(:load_environment) do
+ Bundler.require :default, Rails.env
+ old_load.bind(self).call
+ end
+ end
+ end
+end
+
# All that for this:
Rails.boot!
View
27 config/preinitializer.rb
@@ -1,19 +1,12 @@
-require "#{File.dirname(__FILE__)}/../vendor/bundler_gems/environment"
+begin
+ # Require the preresolved locked set of gems.
+ require File.expand_path('../../.bundle/environment', __FILE__)
+rescue LoadError
+ raise RuntimeError, "You have not locked your bundle. Run `bundle lock`."
-class Rails::Boot
- def run
- load_initializer
- extend_environment
- Rails::Initializer.run(:set_load_path)
- end
-
- def extend_environment
- Rails::Initializer.class_eval do
- old_load = instance_method(:load_environment)
- define_method(:load_environment) do
- Bundler.require_env RAILS_ENV
- old_load.bind(self).call
- end
- end
- end
+ # Fallback on doing the resolve at runtime.
+ # This does not work with rails 2.3.5 as of bundler 0.9.5.
+ require "rubygems"
+ require "bundler"
+ Bundler.setup
end

0 comments on commit 44531ea

Please sign in to comment.