# HG changeset patch # User Alessio Caiazza # Parent 4669e86bd9563361a0320adf9213850f40c849e9 Bundler support diff --git a/Gemfile b/Gemfile new file mode 100644 --- /dev/null +++ b/Gemfile @@ -0,0 +1,19 @@ +source :rubygems +gem 'rails', '2.3.11' +gem 'i18n', '0.4.2' +gem 'rack', '~> 1.1.0' +gem 'rubytree', '0.5.2', :require => 'tree' +gem 'coderay', '~>0.9.7' + +group :test do + gem 'shoulda', '~> 2.10.3' + gem 'edavis10-object_daddy', :require => 'object_daddy' + gem 'mocha' +end + + +#put your customization in Gemfile.local +local_gemfile = File.dirname(__FILE__) + "/Gemfile.local.rb" +if File.exist?(local_gemfile) + self.instance_eval(Bundler.read_file(local_gemfile)) +end \ No newline at end of file diff --git a/Gemfile.local.rb.example b/Gemfile.local.rb.example new file mode 100644 --- /dev/null +++ b/Gemfile.local.rb.example @@ -0,0 +1,3 @@ +#Put here any special requirements +gem 'sqlite3-ruby' +gem 'rmagick' \ No newline at end of file diff --git a/config/boot.rb b/config/boot.rb --- a/config/boot.rb +++ b/config/boot.rb @@ -106,17 +106,18 @@ end end -# TODO: Workaround for #7013 to be removed for 1.2.0 -# Loads i18n 0.4.2 before Rails loads any more recent gem -# 0.5.0 is not compatible with the old interpolation syntax -# Plugins will have to migrate to the new syntax for 1.2.0 -require 'rubygems' -begin - gem 'i18n', '0.4.2' -rescue Gem::LoadError => load_error - $stderr.puts %(Missing the i18n 0.4.2 gem. Please `gem install -v=0.4.2 i18n`) - exit 1 +class Rails::Boot + def run + load_initializer + + Rails::Initializer.class_eval do + def load_gems + @bundler_loaded ||= Bundler.require :default, Rails.env + end + end + + Rails::Initializer.run(:set_load_path) + end end - # All that for this: Rails.boot! diff --git a/config/environments/test.rb b/config/environments/test.rb --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -23,7 +23,3 @@ # Skip protect_from_forgery in requests http://m.onkey.org/2007/9/28/csrf-protection-for-your-existing-rails-application config.action_controller.allow_forgery_protection = false - -config.gem "shoulda", :version => "~> 2.10.3" -config.gem "edavis10-object_daddy", :lib => "object_daddy" -config.gem "mocha" diff --git a/config/preinitializer.rb b/config/preinitializer.rb new file mode 100644 --- /dev/null +++ b/config/preinitializer.rb @@ -0,0 +1,20 @@ +begin + require "rubygems" + require "bundler" +rescue LoadError + raise "Could not load the bundler gem. Install it with `gem install bundler`." +end + +if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24") + raise RuntimeError, "Your bundler version is too old for Rails 2.3." + + "Run `gem install bundler` to upgrade." +end + +begin + # Set up load paths for all bundled gems + ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__) + Bundler.setup +rescue Bundler::GemNotFound + raise RuntimeError, "Bundler couldn't find some gems." + + "Did you run `bundle install`?" +end \ No newline at end of file