mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Override Rails' default gem handling and replace it with Bundler
Bundler does a better job of manage dependencies and is used by default in Rails 3 so this will move Tracks a bit closer towards a Rails 3 conversion.
This commit is contained in:
parent
e93a6970bd
commit
69cb08378d
2 changed files with 35 additions and 0 deletions
|
@ -110,5 +110,19 @@ module Rails
|
|||
end
|
||||
end
|
||||
|
||||
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!
|
||||
|
|
21
config/preinitializer.rb
Normal file
21
config/preinitializer.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue