diff options
author | Carlhuda <carlhuda@engineyard.com> | 2010-07-29 18:51:46 -0700 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2010-07-29 18:51:46 -0700 |
commit | 341648acab94389e97cfc13d57669c32474dfcb9 (patch) | |
tree | f8c7de786cb69e8924855ef26a82f196098f1d38 | |
parent | cb3ec8eb602f2af410e935cc2ad4a61e777de845 (diff) | |
download | bundler-341648acab94389e97cfc13d57669c32474dfcb9.tar.gz |
Add --path and add descriptions for some flags
-rw-r--r-- | lib/bundler/cli.rb | 21 | ||||
-rw-r--r-- | spec/install/gems/simple_case_spec.rb | 39 |
2 files changed, 37 insertions, 23 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index fe1b7a69eb..e092f30887 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -99,24 +99,34 @@ module Bundler "Do not attempt to fetch gems remotely and use the gem cache instead" method_option "binstubs", :type => :string, :lazy_default => "bin", :banner => "Generate bin stubs for bundled gems to ./bin" - method_option "system", :type => :boolean - method_option "production", :type => :boolean + method_option "path", :type => :string, :banner => + "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine" + method_option "system", :type => :boolean, :banner => + "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application" + method_option "production", :type => :boolean, :banner => + "Install using defaults tuned for deployment environments" def install(path = nil) opts = options.dup opts[:without] ||= [] opts[:without].map! { |g| g.to_sym } - if (path || opts[:production]) && options[:system] + if (path || options[:path] || options[:production]) && options[:system] Bundler.ui.error "You have specified both a path to install your gems to, \n" \ "as well as --system. Please choose." exit 1 end + if path && options[:path] + Bundler.ui.error "You have specified a path via `bundle install #{path}` as well as\n" \ + "by `bundle install --path #{options[:path]}`. These options are\n" \ + "equivalent, so please use one or the other." + exit 1 + end + if opts["disable-shared-gems"] - # TODO: Update this message to reference --path Bundler.ui.error "The disable-shared-gem option is no longer available.\n\n" \ "Instead, use `bundle install` to install to your system,\n" \ - "or `bundle install path/to/gems` to install to an isolated\n" \ + "or `bundle install --path path/to/gems` to install to an isolated\n" \ "location. Bundler will resolve relative paths relative to\n" \ "your `Gemfile`." exit 1 @@ -141,6 +151,7 @@ module Bundler Bundler.settings[:path] = nil if options[:system] Bundler.settings[:path] = "vendor/bundle" if options[:production] Bundler.settings[:path] = path if path + Bundler.settings[:path] = options[:path] if options[:path] Bundler.settings[:bin] = opts["binstubs"] if opts[:binstubs] Bundler.settings[:disable_shared_gems] = '1' if Bundler.settings[:path] Bundler.settings.without = opts[:without] diff --git a/spec/install/gems/simple_case_spec.rb b/spec/install/gems/simple_case_spec.rb index d1ea6563f8..08b4d5537b 100644 --- a/spec/install/gems/simple_case_spec.rb +++ b/spec/install/gems/simple_case_spec.rb @@ -438,6 +438,7 @@ describe "bundle install with gem sources" do end it "behaves like bundle install vendor/bundle with --production" do + bundle "install" bundle "install --production" out.should include("Your bundle was installed to `vendor/bundle`") should_be_installed "rack 1.0.0" @@ -449,28 +450,30 @@ describe "bundle install with gem sources" do out.should include "The disable-shared-gem option is no longer available" end - it "does not use available system gems" do - bundle "install vendor" - should_be_installed "rack 1.0.0" - end + ["install vendor", "install --path vendor"].each do |install| + it "does not use available system gems with bundle #{install}" do + bundle install + should_be_installed "rack 1.0.0" + end - it "prints a warning to let the user know what has happened" do - bundle "install vendor" - out.should include("Your bundle was installed to `vendor`") - end + it "prints a warning to let the user know what has happened with bundle #{install}" do + bundle install + out.should include("Your bundle was installed to `vendor`") + end - it "disallows install foo --system" do - bundle "install vendor --system" - out.should include("Please choose.") - end + it "disallows #{install} --system" do + bundle "#{install} --system" + out.should include("Please choose.") + end - it "remembers to disable system gems after the first time" do - bundle "install vendor" - FileUtils.rm_rf bundled_app('vendor') - bundle "install" + it "remembers to disable system gems after the first time with bundle #{install}" do + bundle install + FileUtils.rm_rf bundled_app('vendor') + bundle "install" - vendored_gems('gems/rack-1.0.0').should be_directory - should_be_installed "rack 1.0.0" + vendored_gems('gems/rack-1.0.0').should be_directory + should_be_installed "rack 1.0.0" + end end end |