Permalink
Browse files

Installed bundler to manage gems.

  • Loading branch information...
1 parent f589fb9 commit 71e5f710a5965bfc0fb7535a5d1455a5ebf06fa0 @ratnikov ratnikov committed Feb 21, 2010
Showing with 51 additions and 8 deletions.
  1. +8 −7 .gitignore
  2. +8 −0 Gemfile
  3. +19 −0 config/boot.rb
  4. +1 −1 config/environment.rb
  5. +15 −0 config/preinitializer.rb
View
@@ -1,8 +1,9 @@
-log/*
-tmp/*
+log/
+tmp/
.DS_Store
-doc/*
-tmp/restart.txt
-coverage/*
-db/test.sqlite3
-db/development.sqlite3
+doc/
+coverage/
+db/*.sqlite3
+*.swp
+*.lock
+.bundle/
View
@@ -0,0 +1,8 @@
+source :gemcutter
+
+gem 'rails', '2.3.5'
+gem 'authlogic'
+
+group :development do
+ gem 'sqlite3-ruby'
+end
View
@@ -105,5 +105,24 @@ def read_environment_rb
end
end
+# bundler
+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!
@@ -5,7 +5,7 @@
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
@@ -0,0 +1,15 @@
+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"
+ if Bundler::VERSION <= "0.9.5"
+ raise RuntimeError, "Bundler incompatible.\n" +
+ "Your bundler version is incompatible with Rails 2.3 and an unlocked bundle.\n" +
+ "Run `gem install bundler` to upgrade or `bundle lock` to lock."
+ else
+ Bundler.setup
+ end
+end

0 comments on commit 71e5f71

Please sign in to comment.