summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-03-15 12:04:23 +0000
committerBundlerbot <bot@bundler.io>2019-03-15 12:04:23 +0000
commit1591215e636d68117c04158dfe8da81c8ef2b357 (patch)
treec99d7e1b1075fc99ad92bbb77f20b7f90de2ddd9
parentfe48bf85a06527d5f098560587a76e84adfbee65 (diff)
parentf3f6d1013d5f37c38f60a108dd1f4bead8eef70a (diff)
downloadbundler-1591215e636d68117c04158dfe8da81c8ef2b357.tar.gz
Merge #7037
7037: Test `bundle viz` command deprecation r=colby-swandale a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that we were not printing any deprecation messages for `bundle viz`. ### What was your diagnosis of the problem? My diagnosis was that we are removing `bundle viz` at the same time as deprecating it. Thus, the deprecations never actually show up. ### What is your fix for the problem, implemented in this PR? My fix is to first deprecate the command on bundler 2, then remove it in bundler 3. ### Why did you choose this fix out of the possible options? I chose this fix because it's the most sensible approach to this removal. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
-rw-r--r--Rakefile4
-rw-r--r--lib/bundler/feature_flag.rb2
-rw-r--r--spec/commands/viz_spec.rb2
-rw-r--r--spec/other/major_deprecation_spec.rb21
4 files changed, 26 insertions, 3 deletions
diff --git a/Rakefile b/Rakefile
index 35f0eff074..bfaf1d964d 100644
--- a/Rakefile
+++ b/Rakefile
@@ -63,10 +63,12 @@ namespace :spec do
system "sudo sed -i 's/1000::/1000:Travis:/g' /etc/passwd"
# Strip secure_path so that RVM paths transmit through sudo -E
system "sudo sed -i '/secure_path/d' /etc/sudoers"
+ # Refresh packages index that the ones we need can be installed
+ sh "sudo apt-get update"
# Install groff so ronn can generate man/help pages
sh "sudo apt-get install groff-base -y"
# Install graphviz so that the viz specs can run
- sh "sudo apt-get install graphviz -y 2>&1 | tail -n 2"
+ sh "sudo apt-get install graphviz -y"
# Install the gems with a consistent version of RubyGems
sh "gem update --system 3.0.3"
diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb
index e01676f97d..5e5d97ec42 100644
--- a/lib/bundler/feature_flag.rb
+++ b/lib/bundler/feature_flag.rb
@@ -56,7 +56,7 @@ module Bundler
settings_flag(:unlock_source_unlocks_spec) { !bundler_2_mode? }
settings_flag(:update_requires_all_flag) { bundler_3_mode? }
settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_2_mode? }
- settings_flag(:viz_command) { !bundler_2_mode? }
+ settings_flag(:viz_command) { !bundler_3_mode? }
settings_option(:default_cli_command) { bundler_2_mode? ? :cli_help : :install }
diff --git a/spec/commands/viz_spec.rb b/spec/commands/viz_spec.rb
index c4e77b9179..96cc21b5f7 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", :bundler => "< 2", :if => Bundler.which("dot") do
+RSpec.describe "bundle viz", :bundler => "< 3", :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/other/major_deprecation_spec.rb b/spec/other/major_deprecation_spec.rb
index ab294ad444..3eeeb32b89 100644
--- a/spec/other/major_deprecation_spec.rb
+++ b/spec/other/major_deprecation_spec.rb
@@ -328,4 +328,25 @@ The :gist git source is deprecated, and will be removed in the future. Add this
"bundle console will be replaced by `bin/console` generated by `bundle gem <name>`"
end
end
+
+ context "bundle viz" do
+ let(:ruby_graphviz) do
+ graphviz_glob = base_system_gems.join("cache/ruby-graphviz*")
+ Pathname.glob(graphviz_glob).first
+ end
+
+ before do
+ system_gems ruby_graphviz
+ create_file "gems.rb"
+ bundle "viz"
+ end
+
+ it "does not print a deprecation warning", :bundler => "< 2" do
+ expect(deprecations).to be_empty
+ end
+
+ it "prints a deprecation warning", :bundler => "2" do
+ expect(deprecations).to include "The `viz` command has been moved to the `bundle-viz` gem, see https://github.com/bundler/bundler-viz"
+ end
+ end
end