Permalink
Browse files

Lots of little tweaks and more content

  • Loading branch information...
1 parent 0c4a417 commit 96d7ddf2c3c96d4cef9b07073b0218a73a898f1c @wycats wycats committed Apr 1, 2010
@@ -1,6 +1,6 @@
pre.sunburst {
padding: 10px;
- font-size: 16px;
+ font-size: 13px;
font-family: Monaco, monospace;
}
@@ -8,7 +8,7 @@
#contents
#header
%a{:href => "index.html"}
- %img{:src => "images/bundler.png", :width => "850"}/
+ %img{:src => "images/bundler.png", :width => "725"}/
%h1 The best way to manage your application's dependencies
= yield
@@ -18,7 +18,7 @@
%p
= link("home", "index.html")
\/
- = link("install", "install.html")
+ = link("install", "bundle_install.html")
\/
= link("lock", "bundle_lock.html")
\/
@@ -18,23 +18,23 @@
.description
Install your dependencies to a different location
than BUNDLE_PATH.
- = link("Learn More: Bundler.setup", "bundler_setup.html")
- = link("Learn More: Bundler.require", "groups.html")
.how
:highlight_plain
$ bundle install vendor/bundle
.notes
Further bundle commands or
calls to Bundler.setup or Bundler.require will
remember this location
+ = link("Learn More: Bundler.setup", "bundler_setup.html")
+ = link("Learn More: Bundler.require", "groups.html")
.bullet
.description
Install all dependencies, except those in groups
you explicitly excluded
- = link("Learn More: Groups", "groups.html")
:highlight_plain
$ bundle install --without development test
+ = link("Learn More: Groups", "groups.html")
.bullet
.description
@@ -45,7 +45,7 @@
unpacked.
.how
:highlight_plain
- $bundle install vendor/bundle --without-shared-gems
+ $bundle install vendor/bundle --disable-shared-gems
.notes
By default, bundler will not try to reinstall
gems that are already installed in your system.
@@ -16,9 +16,9 @@
Only add gems from specified groups to the
load path. If you want the gems in the
default group, make sure to include it
- = link("Learn More: Groups", "groups.html")
:highlight_ruby
require "rubygems"
require "bundler"
Bundler.setup(:default, :ci)
require "nokogiri"
+ = link("Learn More: Groups", "groups.html")
View
@@ -48,9 +48,9 @@
Restrict the groups of gems that you
want to add to the load path. Only gems
in these groups will be require'able
- = link("Learn More: Bundler.setup", "bundler_setup.html")
:highlight_ruby
require "rubygems"
require "bundler"
Bundler.setup(:default, :ci)
- require "nokogiri"
+ require "nokogiri"
+ = link("Learn More: Bundler.setup", "bundler_setup.html")
View
@@ -1,3 +1,7 @@
+#intro
+ Bundler manages an <strong>application's dependencies</strong> through its
+ entire life across many machines systematically and repeatably.
+
%h2 Getting Started
.contents
@@ -18,48 +22,77 @@
.description
Specify your dependencies in a Gemfile in your project's root
:highlight_ruby
- source :rubygems
+ source "http://rubygems.org"
gem "nokogiri"
+ gem "rack"
.bullet
.description
Install all of the required gems from your specified sources
- = link("Learn More: bundle install", "bundle_install.html")
:highlight_plain
$ bundle install
$ git add Gemfile
+ = link("Learn More: bundle install", "bundle_install.html")
.bullet
.description
Inside your app, load up the bundled environment
- = link("Learn More: Bundler.setup", "bundler_setup.html")
:highlight_ruby
require "rubygems"
require "bundler"
Bundler.setup
require "nokogiri"
# any other requires you might need
+ = link("Learn More: Bundler.setup", "bundler_setup.html")
+
+ .bullet
+ .description
+ Run a script provided by a bundled gem
+ :highlight_plain
+ $ bundle exec rackup
.bullet
.description
When you're ready to share your application
or deploy it, lock down all the versions of the gems
you're using
- = link("Learn more: bundle lock", "bundle_lock.html")
:highlight_plain
$ bundle lock
$ git add Gemfile.lock
+ = link("Learn more: bundle lock", "bundle_lock.html")
+
+%h2 Using Bundler with Frameworks
+
+.contents
+ .bullet
+ .description
+ Bundler works out of the box with Rails 3. Once you
+ understand the basics of using bundler, you know
+ everything you need to know.
+ = link("Using Bundler with Rails 3", "rails3.html")
+
+ .bullet
+ .description
+ Bundler works with Rails 2.3 with a small change
+ to boot.rb and adding a preinitializer.rb.
+ = link("Using Bundler with Rails 2.3", "rails23.html")
+
+ / .bullet
+ / .description
+ / Setting up Sinatra to use Bundler is as simple as
+ / using Bundler itself.
+ / = link("Using Bundler with Sinatra", "sinatra.html")
%h2 Checking Out an Application With a Gemfile
.contents
.bullet
.description
Install the required gems
- = link("Learn More: bundle install", "bundle_install.html")
:highlight_plain
$ bundle install
+ = link("Learn More: bundle install", "bundle_install.html")
%h2 Digging Further
@@ -69,30 +102,30 @@
Store all of the required gems in your
application. All future installs will get gems
from this cache, bypassing rubygems.org
- = link("Learn More: bundle package", "bundle_package.html")
:highlight_plain
$ bundle package
+ = link("Learn More: bundle package", "bundle_package.html")
.bullet
.description
Put dependencies in a group, so they can
be ignored at install time or required
together in your application
- = link("Learn more: Groups", "groups.html")
:highlight_ruby
group :development do
gem "wirble"
end
+ = link("Learn more: Groups", "groups.html")
.bullet
.description
Use a gem that is stored in git
and has a .gemspec at its root. Gemspecs with
bins or C extensions are supported
- = link("Learn more: Git", "git.html")
:highlight_ruby
gem "nokogiri", :git =>
"git://github.com/tenderlove/nokogiri.git"
+ = link("Learn more: Git", "git.html")
.bullet
.description
@@ -105,11 +138,11 @@
.description
Install gems to a different location
(the default is ~/.bundle)
- = link("Learn More: bundle install", "bundle_install.html")
.how
:highlight_plain
$ bundle install vendor --disable-shared-gems
.notes
By specifying --disable-shared-gems, you are telling
bundler to install the gems into vendor, even if
- they are already installed in the system
+ they are already installed in the system
+ = link("Learn More: bundle install", "bundle_install.html")
View
@@ -0,0 +1,104 @@
+#intro
+ Rails 2.3 comes with its own gem handling. We're going to
+ override that and replace it with support for Bundler
+
+%h2 Using Bundler with Rails 2.3
+
+.contents
+ .bullet
+ .description
+ Insert the following code in config/boot.rb, right above
+ the line `Rails.boot!`
+ :highlight_ruby
+ 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
+ end
+ end
+ end
+ end
+
+ .bullet
+ .description
+ Create a new file, <code>config/preinitializer.rb</code>,
+ 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."
+ 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
+ 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
+ :highlight_ruby
+ gem "rails", "2.3.5"
+ gem "nokogiri", "1.4.2"
+ gem "geokit"
+
+ group :test do
+ gem "rspec"
+ gem "faker"
+ 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"
+ end
+
+ .bullet
+ .description
+ Once you have everything set up, you can use script/console,
+ script/server, and other Rake tasks as usual. From this point
+ on, you can follow the instructions in the Rails 3 guide
+ :highlight_plain
+ $ rake db:migrate
+ = link("Learn More: Rails 3", "rails3.html#shared_with_23")
+
+ .bullet
+ .description
+ Don't forget that non-Rails commands must
+ be executed with bundle exec
+ :highlight_plain
+ $ bundle exec cucumber
Oops, something went wrong.

0 comments on commit 96d7ddf

Please sign in to comment.