Skip to content

Commit

Permalink
Add Bundler stuff. [#53]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Sep 1, 2011
1 parent 685f4c7 commit cb0e3d9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
17 changes: 17 additions & 0 deletions config/boot.rb
Expand Up @@ -110,5 +110,22 @@ def read_environment_rb
end
end

# BEGIN Bundler code.
# TODO: remove when we upgrade to Rails 3.
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
# END Bundler code.

# All that for this:
Rails.boot!
23 changes: 23 additions & 0 deletions config/preinitializer.rb
@@ -0,0 +1,23 @@
# This is for Bundler.
# TODO: Remove when we upgrade to Rails 3!

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

0 comments on commit cb0e3d9

Please sign in to comment.