summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-10-30 03:13:00 +0000
committerBundlerbot <bot@bundler.io>2019-10-30 03:13:00 +0000
commit5ba1360de631e2fabf2bfa998b104c4355c58b13 (patch)
tree151bd5ae018a5a0daf696d3d4d2384a364a62959 /lib
parent27a01a5480c97990123a05e8122f8c5b7910e427 (diff)
parentc9f6d2b4c5e540ba6a165c7a58432bf0081a7e32 (diff)
downloadbundler-5ba1360de631e2fabf2bfa998b104c4355c58b13.tar.gz
Merge #7389
7389: Wrap up `bundle cache` migration to current `bundle package` r=indirect a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that after https://github.com/bundler/bundler/pull/7249, we added the current `bundle package` functionality to the current `bundle cache` command, so that these commands are now aliases of each other. The initial plan was to do this in a more careful manner but we concluded that this was only _adding_ functionality to `bundle cache`, so not backwards incompatible. We still need to wrap up the original plan, where `bundle cache` is the preferred command. ### What is your fix for the problem, implemented in this PR? My fix is to migrate docs, tests and help text to use `bundle cache`, and to remove duplicated specs for `bundle cache` and `bundle package`, since they are testing the exact same code. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli.rb20
-rw-r--r--lib/bundler/cli/cache.rb (renamed from lib/bundler/cli/package.rb)4
2 files changed, 11 insertions, 13 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 0083f7e7de..39f42c9a70 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -68,9 +68,7 @@ module Bundler
version
Bundler.ui.info "\n"
- primary_commands = ["install", "update",
- Bundler.feature_flag.bundler_3_mode? ? "cache" : "package",
- "exec", "config", "help"]
+ primary_commands = ["install", "update", "cache", "exec", "config", "help"]
list = self.class.printable_commands(true)
by_name = list.group_by {|name, _message| name.match(/^bundle (\w+)/)[1] }
@@ -412,7 +410,7 @@ module Bundler
Outdated.new(options, gems).run
end
- desc "#{Bundler.feature_flag.bundler_3_mode? ? :cache : :package} [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
+ desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
unless Bundler.feature_flag.cache_all?
method_option "all", :type => :boolean,
:banner => "Include all sources (including path and git)."
@@ -421,24 +419,24 @@ module Bundler
method_option "cache-path", :type => :string, :banner =>
"Specify a different cache path than the default (vendor/cache)."
method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
- method_option "no-install", :type => :boolean, :banner => "Don't install the gems, only the package."
+ method_option "no-install", :type => :boolean, :banner => "Don't install the gems, only update the cache."
method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
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" unless Bundler.feature_flag.forget_cli_options?}"
method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
method_option "frozen", :type => :boolean, :banner =>
- "Do not allow the Gemfile.lock to be updated after this package operation's install"
+ "Do not allow the Gemfile.lock to be updated after this bundle cache operation's install"
long_desc <<-D
- The package command will copy the .gem files for every gem in the bundle into the
+ The cache command will copy the .gem files for every gem in the bundle into the
directory ./vendor/cache. If you then check that directory into your source
control repository, others who check out your source will be able to install the
bundle without having to download any additional gems.
D
- def package
- require_relative "cli/package"
- Package.new(options).run
+ def cache
+ require_relative "cli/cache"
+ Cache.new(options).run
end
- map %w[cache pack] => :package
+ map %w[package pack] => :cache
desc "exec [OPTIONS]", "Run the command in context of the bundle"
method_option :keep_file_descriptors, :type => :boolean, :default => false
diff --git a/lib/bundler/cli/package.rb b/lib/bundler/cli/cache.rb
index b31b67776d..5e8420990f 100644
--- a/lib/bundler/cli/package.rb
+++ b/lib/bundler/cli/cache.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module Bundler
- class CLI::Package
+ class CLI::Cache
attr_reader :options
def initialize(options)
@@ -40,7 +40,7 @@ module Bundler
if Bundler.definition.has_local_dependencies? && !Bundler.feature_flag.cache_all?
Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \
- "to package them as well, please pass the --all flag. This will be the default " \
+ "to cache them as well, please pass the --all flag. This will be the default " \
"on Bundler 3.0."
end
end