Created
June 15, 2010 03:34
-
-
Save pedro/438661 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb | |
index 3314db0..16e6498 100644 | |
--- a/lib/bundler/cli.rb | |
+++ b/lib/bundler/cli.rb | |
@@ -91,6 +91,8 @@ module Bundler | |
"Don't update the existing gem cache." | |
method_option "quiet", :type => :boolean, :banner => | |
"Only output warnings and errors." | |
+ method_option "no-auto-update", :type => :boolean, :banner => | |
+ "Do not bundle itself" | |
def install(path = nil) | |
opts = options.dup | |
opts[:without] ||= [] | |
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb | |
index 4a18b2c..fa79a0e 100644 | |
--- a/lib/bundler/installer.rb | |
+++ b/lib/bundler/installer.rb | |
@@ -21,6 +21,14 @@ module Bundler | |
# Ensure that BUNDLE_PATH exists | |
FileUtils.mkdir_p(Bundler.bundle_path) | |
+ if !options['no-auto-update'] && bundler = specs.detect { |spec| spec.name == 'bundler' } | |
+ bundler.source.fetch(bundler) if bundler.source.respond_to?(:fetch) | |
+ bundler.source.install(bundler) | |
+ Bundler.ui.info "" | |
+ Bundler.ui.info "Auto-updated. Reloading..." | |
+ exec *[$0, ARGV, '--no-auto-update'].flatten | |
+ end | |
+ | |
# Must install gems in the order that the resolver provides | |
# as dependencies might actually affect the installation of | |
# the gem. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment