summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2010-08-03 12:06:41 -0700
committerAndre Arko <andre@arko.net>2010-08-03 12:06:41 -0700
commit56e10034e64fd0b388a59c7d30b9088e0bc5fac4 (patch)
treebf742f0e75135f86f71ef04e4faf9d8d238f5fd1
parenta9e8b091324f90aa768f3a39e56e701e6a42bd28 (diff)
downloadbundler-56e10034e64fd0b388a59c7d30b9088e0bc5fac4.tar.gz
Deprecate --production for --deploy
-rw-r--r--lib/bundler.rb9
-rw-r--r--lib/bundler/cli.rb32
-rw-r--r--lib/bundler/definition.rb4
-rw-r--r--spec/install/deploy_spec.rb (renamed from spec/install/production_spec.rb)18
-rw-r--r--spec/install/deprecated_spec.rb6
-rw-r--r--spec/install/gems/packed_spec.rb2
-rw-r--r--spec/install/gems/simple_case_spec.rb4
7 files changed, 40 insertions, 35 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 38cb27245f..f54deefdeb 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -60,6 +60,7 @@ module Bundler
class << self
attr_writer :ui, :bundle_path
+ attr_accessor :deploy
def configure
@configured ||= begin
@@ -68,14 +69,6 @@ module Bundler
end
end
- def production?
- @production
- end
-
- def production=(value)
- @production = value
- end
-
def ui
@ui ||= UI.new
end
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index f094986f68..b2a2abbd19 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -109,20 +109,28 @@ module Bundler
"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 =>
+ method_option "deploy", :type => :boolean, :banner =>
"Install using defaults tuned for deployment environments"
+ method_option "production", :type => :boolean, :banner =>
+ "Deprecated, please use --deploy instead"
def install(path = nil)
opts = options.dup
opts[:without] ||= []
opts[:without].map! { |g| g.to_sym }
- if (path || options[:path] || options[:production]) && options[:system]
+ if opts[:production]
+ opts[:deploy] = true
+ Bundler.ui.warn "The --production option is deprecated, and will be removed in " \
+ "the final release of Bundler 1.0. Please use --deploy instead."
+ end
+
+ if (path || opts[:path] || opts[:deploy]) && opts[: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]
+ if path && opts[: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."
@@ -138,26 +146,26 @@ module Bundler
exit 1
end
- if opts[:production]
- Bundler.production = true
+ if opts[:deploy]
+ Bundler.deploy = true
unless Bundler.default_lockfile.exist?
- raise ProductionError, "The --production flag requires a Gemfile.lock. Please\n" \
- "make sure you have checked your Gemfile.lock into version\n" \
- "control before deploying."
+ raise ProductionError, "The --deploy flag requires a Gemfile.lock. Please make sure " \
+ "you have checked your Gemfile.lock into version control " \
+ "before deploying."
end
if Bundler.root.join("vendor/cache").exist?
- opts["local"] = true
+ opts[:local] = true
end
end
# Can't use Bundler.settings for this because settings needs gemfile.dirname
ENV['BUNDLE_GEMFILE'] = File.expand_path(opts[:gemfile]) if opts[:gemfile]
- Bundler.settings[:path] = nil if options[:system]
- Bundler.settings[:path] = "vendor/bundle" if options[:production]
+ Bundler.settings[:path] = nil if opts[:system]
+ Bundler.settings[:path] = "vendor/bundle" if opts[:deploy]
Bundler.settings[:path] = path if path
- Bundler.settings[:path] = options[:path] if options[:path]
+ Bundler.settings[:path] = opts[:path] if opts[: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/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 6f5caf4db3..d7c9beab81 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -68,9 +68,7 @@ module Bundler
@new_platform = !@platforms.include?(current_platform)
@platforms |= [current_platform]
- if Bundler.production?
- ensure_equivalent_gemfile_and_lockfile
- end
+ ensure_equivalent_gemfile_and_lockfile if Bundler.deploy
converge_sources
converge_dependencies
diff --git a/spec/install/production_spec.rb b/spec/install/deploy_spec.rb
index 7d74bdb999..1c4896fc5e 100644
--- a/spec/install/production_spec.rb
+++ b/spec/install/deploy_spec.rb
@@ -1,6 +1,6 @@
require "spec_helper"
-describe "install with --production" do
+describe "install with --deploy" do
before do
gemfile <<-G
source "file://#{gem_repo1}"
@@ -9,8 +9,8 @@ describe "install with --production" do
end
it "fails without a lockfile" do
- bundle "install --production"
- out.should include("The --production flag requires a Gemfile.lock")
+ bundle "install --deploy"
+ out.should include("The --deploy flag requires a Gemfile.lock")
end
describe "with an existing lockfile" do
@@ -19,7 +19,7 @@ describe "install with --production" do
end
it "works if you didn't change anything" do
- bundle "install --production", :exit_status => true
+ bundle "install --deploy", :exit_status => true
exitstatus.should == 0
end
@@ -30,7 +30,7 @@ describe "install with --production" do
gem "rack-obama"
G
- bundle "install --production"
+ bundle "install --deploy"
out.should include("You have modified your Gemfile")
out.should include("You have added to the Gemfile")
out.should include("* rack-obama")
@@ -44,7 +44,7 @@ describe "install with --production" do
gem "activesupport"
G
- bundle "install --production"
+ bundle "install --deploy"
out.should include("You have modified your Gemfile")
out.should include("You have added to the Gemfile:\n* activesupport\n\n")
out.should include("You have deleted from the Gemfile:\n* rack")
@@ -57,7 +57,7 @@ describe "install with --production" do
gem "rack", :git => "git://hubz.com"
G
- bundle "install --production"
+ bundle "install --deploy"
out.should include("You have modified your Gemfile")
out.should include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
out.should_not include("You have changed in the Gemfile")
@@ -76,7 +76,7 @@ describe "install with --production" do
gem "rack"
G
- bundle "install --production"
+ bundle "install --deploy"
out.should include("You have modified your Gemfile")
out.should include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master)")
out.should_not include("You have added to the Gemfile")
@@ -99,7 +99,7 @@ describe "install with --production" do
gem "foo", :git => "#{lib_path("rack")}"
G
- bundle "install --production"
+ bundle "install --deploy"
out.should include("You have modified your Gemfile")
out.should include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master)`")
out.should_not include("You have added to the Gemfile")
diff --git a/spec/install/deprecated_spec.rb b/spec/install/deprecated_spec.rb
index d1656cde7c..76b2853a5c 100644
--- a/spec/install/deprecated_spec.rb
+++ b/spec/install/deprecated_spec.rb
@@ -34,4 +34,10 @@ describe "bundle install with deprecated features" do
end
+ it "reports that --production is deprecated" do
+ gemfile %{gem "rack"}
+ bundle "install --production"
+ out.should =~ /--production option is deprecated/
+ end
+
end
diff --git a/spec/install/gems/packed_spec.rb b/spec/install/gems/packed_spec.rb
index 89f59d2c67..9ba330c6bd 100644
--- a/spec/install/gems/packed_spec.rb
+++ b/spec/install/gems/packed_spec.rb
@@ -28,7 +28,7 @@ describe "bundle install with gem sources" do
simulate_new_machine
FileUtils.rm_rf gem_repo2
- bundle "install --production"
+ bundle "install --deploy"
should_be_installed "rack 1.0.0"
end
diff --git a/spec/install/gems/simple_case_spec.rb b/spec/install/gems/simple_case_spec.rb
index abe2f2f99b..ac208aee34 100644
--- a/spec/install/gems/simple_case_spec.rb
+++ b/spec/install/gems/simple_case_spec.rb
@@ -457,9 +457,9 @@ describe "bundle install with gem sources" do
G
end
- it "behaves like bundle install vendor/bundle with --production" do
+ it "behaves like bundle install vendor/bundle with --deploy" do
bundle "install"
- bundle "install --production"
+ bundle "install --deploy"
out.should include("Your bundle was installed to `vendor/bundle`")
should_be_installed "rack 1.0.0"
bundled_app("vendor/bundle").should exist