Created
February 17, 2010 20:46
-
-
Save michel/306996 to your computer and use it in GitHub Desktop.
Rails 2.3.5 and bundler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove the config.gem lines from config/environment.rb , we don't need them anymore we are running bundler! | |
Adjust config/boot.rb, adjust/add config/preinitializer.rb , configure your Gemfile. | |
Type in console: | |
bundle install | |
bundle lock | |
And your done! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Make sure Rails.boot! is after this block of code! | |
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Example gemfile | |
source :gemcutter | |
# Rails 2.3.5 | |
gem 'rails', '~> 2.3.5', :require => nil | |
gem 'ruby-mysql', '>= 2.9.1', :require => 'mysql' | |
gem 'haml', '2.2.19', :require => nil | |
gem 'inherited_resources', '= 1.0.3' | |
gem 'formtastic', '>= 0.9.7' | |
gem 'searchlogic', '>= 2.4.11' | |
gem 'will_paginate', '>= 2.3.12' | |
gem 'block_helpers', '>= 0.3.2' | |
group :cucumber do | |
gem 'nokogiri', '>= 1.4.1', :require => nil | |
gem 'webrat', '>= 0.7.0', :require => nil | |
gem 'mongrel', '>= 1.1.5', :require => nil | |
gem 'cucumber-rails', '>=0.2.4', :require => nil | |
gem 'database_cleaner', '>=0.4.3', :require => nil | |
gem 'selenium-client', '1.2.18', :require => nil | |
gem 'Selenium', '1.1.14', :require => nil | |
gem 'rspec', '>=1.3.0', :require => nil | |
gem 'rspec-rails', '>=1.3.2', :require => nil | |
gem 'factory_girl', '>=1.2.3', :require => nil | |
gem 'pickle', '>=0.2.1', :require => nil | |
end | |
group :test do | |
gem 'rspec-rails', '>= 1.3.2', :require => nil | |
gem 'factory_girl', '>= 1.2.3', :require => nil | |
gem 'mocha', '>= 0.9.8', :require => nil | |
gem 'remarkable_activerecord', '>= 3.1.12', :require => nil | |
gem 'remarkable_rails', '>= 3.1.12', :require => nil | |
gem 'faker', '>= 0.3.1', :require => nil | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this code goes in config/preinitializer.rb, which you should create if it doesn't exist | |
begin | |
# Require the preresolved locked set of gems. | |
require File.expand_path('../../.bundle/environment', __FILE__) | |
rescue LoadError | |
# Fallback on doing the resolve at runtime. | |
require "rubygems" | |
require "bundler" | |
Bundler.setup | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment