diff options
author | The Bundler Bot <bot@bundler.io> | 2017-09-06 16:18:37 +0000 |
---|---|---|
committer | Colby Swandale <me@colby.fyi> | 2018-10-05 16:16:06 +1000 |
commit | a61bc27974e31a4eccb5a9a3339b9a7aedf0572f (patch) | |
tree | f30d65c18cdfe20277f3dad301e5931a899ed0ee | |
parent | 2f935a52df75a05ff41bad86fa90647853ed59a3 (diff) | |
download | bundler-a61bc27974e31a4eccb5a9a3339b9a7aedf0572f.tar.gz |
Auto merge of #5964 - bundler:colby/deprecate-viz-command, r=segiddins
deprecate the bundle viz command
The `bundle viz` command is to been removed from bundler 2 and extracted into a plugin
Closes #5180
Deprecate the `bundle viz` command with an error explaining that a new gem will replace it's functionality.
(cherry picked from commit dbb0aede6f16e1a252f9a49b48673bfc30bd1242)
-rw-r--r-- | lib/bundler/cli.rb | 31 | ||||
-rw-r--r-- | lib/bundler/feature_flag.rb | 1 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 1 | ||||
-rw-r--r-- | spec/commands/viz_spec.rb | 2 | ||||
-rw-r--r-- | spec/quality_spec.rb | 1 |
5 files changed, 21 insertions, 15 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 706c0b90dc..2aa1b227ab 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -496,20 +496,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 3aae4f3a13..83e7ff0389 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -56,6 +56,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 8ba9249a56..611c5a4ef9 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -58,6 +58,7 @@ module Bundler unlock_source_unlocks_spec update_requires_all_flag use_gem_version_promoter_for_major_updates + viz_command ].freeze NUMBER_KEYS = %w[ diff --git a/spec/commands/viz_spec.rb b/spec/commands/viz_spec.rb index 0e8667eaa7..3804d3561c 100644 --- a/spec/commands/viz_spec.rb +++ b/spec/commands/viz_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "bundle viz", :ruby => "1.9.3", :if => Bundler.which("dot") do +RSpec.describe "bundle viz", :ruby => "1.9.3", :bundler => "< 2", :if => Bundler.which("dot") do let(:ruby_graphviz) do graphviz_glob = base_system_gems.join("cache/ruby-graphviz*") Pathname.glob(graphviz_glob).first diff --git a/spec/quality_spec.rb b/spec/quality_spec.rb index 8e59089b03..5ebe0baff4 100644 --- a/spec/quality_spec.rb +++ b/spec/quality_spec.rb @@ -179,6 +179,7 @@ RSpec.describe "The library itself" do inline lockfile_uses_separate_rubygems_sources use_gem_version_promoter_for_major_updates + viz_command ] all_settings = Hash.new {|h, k| h[k] = [] } |