summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-08-31 23:09:05 +1000
committerColby Swandale <colby@taplaboratories.com>2017-09-06 10:37:54 +1000
commit0b0456249c0ec2d0dbc3cb56f58dba6b34e44f13 (patch)
treebbdc5ae2c5570dccf35c661540d474dd8e32d74a /lib
parent34bc1352b791d7bd8fdef13db50e3ec153ec18c7 (diff)
downloadbundler-colby/deprecate-viz-command.tar.gz
deprecate the viz command in bundler 2colby/deprecate-viz-command
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli.rb31
-rw-r--r--lib/bundler/feature_flag.rb1
-rw-r--r--lib/bundler/settings.rb1
3 files changed, 19 insertions, 14 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index b8e570e380..ca53420e4d 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -482,20 +482,23 @@ module Bundler
end
end
- desc "viz [OPTIONS]", "Generates a visual dependency graph", :hide => true
- long_desc <<-D
- Viz generates a PNG file of the current Gemfile as a dependency graph.
- Viz requires the ruby-graphviz gem (and its dependencies).
- The associated gems must also be installed via 'bundle install'.
- D
- method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :desc => "The name to use for the generated file. see format option"
- method_option :format, :type => :string, :default => "png", :aliases => "-F", :desc => "This is output format option. Supported format is png, jpg, svg, dot ..."
- method_option :requirements, :type => :boolean, :default => false, :aliases => "-R", :desc => "Set to show the version of each required dependency."
- method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
- method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
- def viz
- require "bundler/cli/viz"
- Viz.new(options.dup).run
+ if Bundler.feature_flag.viz_command?
+ desc "viz [OPTIONS]", "Generates a visual dependency graph", :hide => true
+ long_desc <<-D
+ Viz generates a PNG file of the current Gemfile as a dependency graph.
+ Viz requires the ruby-graphviz gem (and its dependencies).
+ The associated gems must also be installed via 'bundle install'.
+ D
+ method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :desc => "The name to use for the generated file. see format option"
+ method_option :format, :type => :string, :default => "png", :aliases => "-F", :desc => "This is output format option. Supported format is png, jpg, svg, dot ..."
+ method_option :requirements, :type => :boolean, :default => false, :aliases => "-R", :desc => "Set to show the version of each required dependency."
+ method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
+ method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
+ def viz
+ SharedHelpers.major_deprecation 2, "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
+ require "bundler/cli/viz"
+ Viz.new(options.dup).run
+ end
end
old_gem = instance_method(:gem)
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb
index 921be055b1..574fad9900 100644
--- a/lib/bundler/feature_flag.rb
+++ b/lib/bundler/feature_flag.rb
@@ -53,6 +53,7 @@ module Bundler
settings_flag(:unlock_source_unlocks_spec) { !bundler_2_mode? }
settings_flag(:update_requires_all_flag) { bundler_2_mode? }
settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_2_mode? }
+ settings_flag(:viz_command) { !bundler_2_mode? }
settings_option(:default_cli_command) { bundler_2_mode? ? :cli_help : :install }
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 0c62e808cb..30bd6b39db 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -54,6 +54,7 @@ module Bundler
unlock_source_unlocks_spec
update_requires_all_flag
use_gem_version_promoter_for_major_updates
+ viz_command
].freeze
NUMBER_KEYS = %w[