Project

General

Profile

Patch #8128 » bundler.diff

Alessio Caiazza, 2011-04-11 20:59

View differences:

Gemfile
1
source :rubygems
2
gem 'rails', '2.3.11'
3
gem 'i18n', '0.4.2'
4
gem 'rack', '~> 1.1.0'
5
gem 'rubytree', '0.5.2', :require => 'tree'
6
gem 'coderay', '~>0.9.7'
7

  
8
group :test do
9
  gem 'shoulda', '~> 2.10.3'
10
  gem 'edavis10-object_daddy', :require => 'object_daddy'
11
  gem 'mocha'
12
end
13

  
14

  
15
#put your customization in Gemfile.local
16
local_gemfile = File.dirname(__FILE__) + "/Gemfile.local.rb"
17
if File.exist?(local_gemfile)
18
  self.instance_eval(Bundler.read_file(local_gemfile))
19
end
Gemfile.local.rb.example
1
#Put here any special requirements
2
gem 'sqlite3-ruby'
3
gem 'rmagick'
config/boot.rb
106 106
  end
107 107
end
108 108

  
109
# TODO: Workaround for #7013 to be removed for 1.2.0
110
# Loads i18n 0.4.2 before Rails loads any more recent gem
111
# 0.5.0 is not compatible with the old interpolation syntax
112
# Plugins will have to migrate to the new syntax for 1.2.0
113
require 'rubygems'
114
begin
115
  gem 'i18n', '0.4.2'
116
rescue Gem::LoadError => load_error
117
  $stderr.puts %(Missing the i18n 0.4.2 gem. Please `gem install -v=0.4.2 i18n`)
118
  exit 1
109
class Rails::Boot
110
  def run
111
    load_initializer
112

  
113
    Rails::Initializer.class_eval do
114
      def load_gems
115
        @bundler_loaded ||= Bundler.require :default, Rails.env
116
      end
117
    end
118

  
119
    Rails::Initializer.run(:set_load_path)
120
  end
119 121
end
120

  
121 122
# All that for this:
122 123
Rails.boot!
config/environments/test.rb
23 23

  
24 24
# Skip protect_from_forgery in requests http://m.onkey.org/2007/9/28/csrf-protection-for-your-existing-rails-application
25 25
config.action_controller.allow_forgery_protection  = false
26

  
27
config.gem "shoulda", :version => "~> 2.10.3"
28
config.gem "edavis10-object_daddy", :lib => "object_daddy"
29
config.gem "mocha"
config/preinitializer.rb
1
begin
2
  require "rubygems"
3
  require "bundler"
4
rescue LoadError
5
  raise "Could not load the bundler gem. Install it with `gem install bundler`."
6
end
7

  
8
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
9
  raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
10
   "Run `gem install bundler` to upgrade."
11
end
12

  
13
begin
14
  # Set up load paths for all bundled gems
15
  ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
16
  Bundler.setup
17
rescue Bundler::GemNotFound
18
  raise RuntimeError, "Bundler couldn't find some gems." +
19
    "Did you run `bundle install`?"
20
end
(2-2/2)