Skip to content

Commit

Permalink
Upgrade for changes in Bundler 0.9.x series
Browse files Browse the repository at this point in the history
* see also http://gist.github.com/302406.

Signed-off-by: Alex Coles <alex@alexcolesportfolio.com>
  • Loading branch information
myabc committed Feb 13, 2010
1 parent 330c9b8 commit 44531ea
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 24 deletions.
10 changes: 3 additions & 7 deletions 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
42 changes: 42 additions & 0 deletions 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
18 changes: 18 additions & 0 deletions config/boot.rb
Expand Up @@ -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!
27 changes: 10 additions & 17 deletions 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.