Skip to content
Browse files

Update Rails 2.3 instructions to work with plugins etc

  • Loading branch information...
1 parent 0fefbb7 commit 328611a84c0ae898902c1e59646e9348d0dd1eb6 @indirect indirect committed Apr 6, 2010
Showing with 27 additions and 42 deletions.
  1. +27 −42 src/pages/rails23.haml
View
69 src/pages/rails23.haml
@@ -13,18 +13,14 @@
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 Rails.env, :plugins
- old_load.bind(self).call
+ def load_gems
+ @bundler_loaded ||= Bundler.require :default, Rails.env
end
end
+
+ Rails::Initializer.run(:set_load_path)
end
end
@@ -34,58 +30,47 @@
and insert the following
:highlight_ruby
begin
- # Set up load paths for the locked set of pre-resolved gems.
- require File.expand_path('../../.bundle/environment', __FILE__)
- rescue LoadError
- # Fall back on trying to resolve out of already-installed gems at runtime.
require "rubygems"
require "bundler"
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.5")
- raise RuntimeError,
- "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."
+ raise RuntimeError, "Your bundler version is too old." +
+ "Run `gem install bundler` to upgrade."
end
- begin
- # Set up load paths for all bundled gems
- Bundler.setup
- # Require all gems not in a group
- Bundler.require :default
- rescue Bundler::GemNotFound
- raise Bundler::GemNotFound, "Bundler couldn't find some gems. " \
- "Did you run `bundle install`?"
- end
+ # Set up load paths for all bundled gems
+ Bundler.setup
+ rescue Bundler::GemNotFound
+ raise RuntimeError, "Bundler couldn't find some gems." +
+ "Did you run `bundle install`?"
end
.bullet
.description
Get all config.gem declarations from your application, and place
them into the Gemfile. If you have declarations in development.rb,
for instance, place them in a named group. Make sure to include
- Rails itself
+ Rails itself and at least one source
:highlight_ruby
- gem "rails", "2.3.5"
- gem "nokogiri", "1.4.2"
- gem "geokit"
+ source :gemcutter
+ gem "rails", "~> 2.3.5"
+ gem "sqlite3-ruby", :require => "sqlite3"
- group :test do
- gem "rspec"
- gem "faker"
+ # bundler requires these gems in all environments
+ # gem "nokogiri", "1.4.2"
+ # gem "geokit"
+
+ group :development do
+ # bundler requires these gems in development
+ # gem "rails-footnotes"
end
- = link("Learn More: Groups", "groups.html")
- .bullet
- .description
- If you have config.gem declarations that refer to gem plugins
- (gems that rely on Rails to be properly set up), place them in
- a group called :plugins
- :highlight_ruby
- group :plugins do
- gem "haml"
- gem "authlogic"
+ group :test do
+ # bundler requires these gems while running tests
+ # gem "rspec"
+ # gem "faker"
end
+ = link("Learn More: Groups", "groups.html")
.bullet
.description

0 comments on commit 328611a

Please sign in to comment.
Something went wrong with that request. Please try again.