diff options
36 files changed, 90 insertions, 95 deletions
diff --git a/bin/bundle_ruby b/bin/bundle_ruby index df6f8cc8a1..2209c6195f 100755 --- a/bin/bundle_ruby +++ b/bin/bundle_ruby @@ -3,7 +3,7 @@ require "bundler/shared_helpers" -Bundler::SharedHelpers.major_deprecation(2, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`") +Bundler::SharedHelpers.major_deprecation(3, "the bundle_ruby executable has been removed in favor of `bundle platform --ruby`") Signal.trap("INT") { exit 1 } diff --git a/lib/bundler.rb b/lib/bundler.rb index 1cb3b4fb21..cf3a289df2 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -119,7 +119,7 @@ module Bundler end def environment - SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load" + SharedHelpers.major_deprecation 3, "Bundler.environment has been removed in favor of Bundler.load" load end @@ -283,7 +283,7 @@ EOF # @deprecated Use `original_env` instead # @return [Hash] Environment with all bundler-related variables removed def clean_env - Bundler::SharedHelpers.major_deprecation(2, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead") + Bundler::SharedHelpers.major_deprecation(3, "`Bundler.clean_env` has weird edge cases, use `.original_env` instead") env = original_env if env.key?("BUNDLER_ORIG_MANPATH") diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb index 1b7145b72b..40e2e5dbe8 100644 --- a/lib/bundler/capistrano.rb +++ b/lib/bundler/capistrano.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "bundler/shared_helpers" -Bundler::SharedHelpers.major_deprecation 2, +Bundler::SharedHelpers.major_deprecation 3, "The Bundler task for Capistrano. Please use http://github.com/capistrano/bundler" # Capistrano task for Bundler. diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index e658ffce72..3efe193613 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -229,7 +229,7 @@ module Bundler "Include gems that are part of the specified named group." map "i" => "install" def install - SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") + SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") require "bundler/cli/install" Bundler.settings.temporary(:no_install => false) do Install.new(options.dup).run @@ -275,7 +275,7 @@ module Bundler method_option "all", :type => :boolean, :banner => "Update everything." def update(*gems) - SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") + SharedHelpers.major_deprecation(3, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force") require "bundler/cli/update" Update.new(options, gems).run end @@ -303,7 +303,7 @@ module Bundler old_argv = ARGV.join(" ") new_argv = [new_command, *new_arguments.compact].join(" ") - Bundler::SharedHelpers.major_deprecation(2, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`") + Bundler::SharedHelpers.major_deprecation(3, "use `bundle #{new_argv}` instead of `bundle #{old_argv}`") end require "bundler/cli/show" Show.new(options, gem_name).run @@ -537,7 +537,7 @@ module Bundler 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" + SharedHelpers.major_deprecation 3, "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 @@ -608,7 +608,7 @@ module Bundler method_option "group", :type => :string, :banner => "Install gem into a bundler group" def inject(name, version) - SharedHelpers.major_deprecation 2, "The `inject` command has been replaced by the `add` command" + SharedHelpers.major_deprecation 3, "The `inject` command has been replaced by the `add` command" require "bundler/cli/inject" Inject.new(options.dup, name, version).run end diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb index 853eca8358..d45f30cdcf 100644 --- a/lib/bundler/cli/console.rb +++ b/lib/bundler/cli/console.rb @@ -9,7 +9,7 @@ module Bundler end def run - Bundler::SharedHelpers.major_deprecation 2, "bundle console will be replaced " \ + Bundler::SharedHelpers.major_deprecation 3, "bundle console will be replaced " \ "by `bin/console` generated by `bundle gem <name>`" group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index b40e5f0e9e..55e90ead0e 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -53,7 +53,7 @@ module Bundler Bundler::Fetcher.disable_endpoint = options["full-index"] if options["binstubs"] - Bundler::SharedHelpers.major_deprecation 2, + Bundler::SharedHelpers.major_deprecation 3, "The --binstubs option will be removed in favor of `bundle binstubs`" end diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index b088853768..bf300a8437 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -22,7 +22,7 @@ module Bundler if Bundler.feature_flag.update_requires_all_flag? raise InvalidOption, "To update everything, pass the `--all` flag." end - SharedHelpers.major_deprecation 2, "Pass --all to `bundle update` to update everything" + SharedHelpers.major_deprecation 3, "Pass --all to `bundle update` to update everything" elsif !full_update && options[:all] raise InvalidOption, "Cannot specify --all along with specific options." end diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 8e56d4a9bc..c5e94c7123 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -331,7 +331,7 @@ module Bundler # i.e., Windows with `git config core.autocrlf=true` contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n") - if @locked_bundler_version + if @locked_bundler_version && Bundler.feature_flag.lockfile_upgrade_warning? locked_major = @locked_bundler_version.segments.first current_major = Gem::Version.create(Bundler::VERSION).segments.first diff --git a/lib/bundler/deployment.rb b/lib/bundler/deployment.rb index 291e158ca0..4c8f48d405 100644 --- a/lib/bundler/deployment.rb +++ b/lib/bundler/deployment.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "bundler/shared_helpers" -Bundler::SharedHelpers.major_deprecation 2, "Bundler no longer integrates with " \ +Bundler::SharedHelpers.major_deprecation 3, "Bundler no longer integrates with " \ "Capistrano, but Capistrano provides its own integration with " \ "Bundler via the capistrano-bundler gem. Use it instead." diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index ab59477145..2cdfe338ea 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -194,7 +194,7 @@ module Bundler " end\n\n" raise DeprecatedError, msg if Bundler.feature_flag.disable_multisource? - SharedHelpers.major_deprecation(2, msg.strip) + SharedHelpers.major_deprecation(3, msg.strip) end source_options = normalize_hash(options).merge( @@ -306,7 +306,7 @@ module Bundler repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") # TODO: 2.0 upgrade this setting to the default if Bundler.settings["github.https"] - Bundler::SharedHelpers.major_deprecation 2, "The `github.https` setting will be removed" + Bundler::SharedHelpers.major_deprecation 3, "The `github.https` setting will be removed" "https://github.com/#{repo_name}.git" else "git://github.com/#{repo_name}.git" @@ -456,7 +456,7 @@ repo_name ||= user_name def normalize_source(source) case source when :gemcutter, :rubygems, :rubyforge - Bundler::SharedHelpers.major_deprecation 2, "The source :#{source} is deprecated because HTTP " \ + Bundler::SharedHelpers.major_deprecation 3, "The source :#{source} is deprecated because HTTP " \ "requests are insecure.\nPlease change your source to 'https://" \ "rubygems.org' if possible, or 'http://rubygems.org' if not." "http://rubygems.org" @@ -480,7 +480,7 @@ repo_name ||= user_name end raise GemfileEvalError, msg else - Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \ + Bundler::SharedHelpers.major_deprecation 3, "Your Gemfile contains multiple primary sources. " \ "Using `source` more than once without a block is a security risk, and " \ "may result in installing unexpected gems. To resolve this warning, use " \ "a block to indicate which gems should come from the secondary source. " \ @@ -498,7 +498,7 @@ repo_name ||= user_name "do |repo_name|\n#{replacement.to_s.gsub(/^/, " ")}\n end" end - Bundler::SharedHelpers.major_deprecation 2, <<-EOS + Bundler::SharedHelpers.major_deprecation 3, <<-EOS The :#{name} git source is deprecated, and will be removed in Bundler 2.0.#{additional_message} Add this code to the top of your Gemfile to ensure it continues to work: git_source(:#{name}) #{replacement} diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index 15ba825c51..e3266da8ab 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -44,6 +44,7 @@ module Bundler settings_flag(:init_gems_rb) { bundler_3_mode? } settings_flag(:list_command) { bundler_3_mode? } settings_flag(:lockfile_uses_separate_rubygems_sources) { bundler_3_mode? } + settings_flag(:lockfile_upgrade_warning) { bundler_3_mode? } settings_flag(:only_update_to_newer_versions) { bundler_3_mode? } settings_flag(:path_relative_to_cwd) { bundler_3_mode? } settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") } diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 783d106e7b..f088c2fdfb 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -465,7 +465,7 @@ module Bundler raise Gem::Exception, "no default executable for #{spec.full_name}" unless exec_name ||= spec.default_executable unless spec.name == gem_name - Bundler::SharedHelpers.major_deprecation 2, + Bundler::SharedHelpers.major_deprecation 3, "Bundler is using a binstub that was created for a different gem (#{spec.name}).\n" \ "You should run `bundle binstub #{gem_name}` " \ "to work around a system/bundle conflict." diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index fe68d510ff..66af31dab2 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -40,6 +40,7 @@ module Bundler ignore_messages init_gems_rb list_command + lockfile_upgrade_warning lockfile_uses_separate_rubygems_sources major_deprecations no_install @@ -112,7 +113,7 @@ module Bundler "bundle config #{key} #{Array(value).join(":")}" end - Bundler::SharedHelpers.major_deprecation 2,\ + Bundler::SharedHelpers.major_deprecation 3,\ "flags passed to commands " \ "will no longer be automatically remembered. Instead please set flags " \ "you want remembered between commands using `bundle config " \ diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 3e2fe24b7a..50214901c5 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -157,8 +157,8 @@ module Bundler next if gemfiles.empty? break false if gemfiles.size == 1 end - if multiple_gemfiles && Bundler.bundler_major_version == 1 - Bundler::SharedHelpers.major_deprecation 2, \ + if multiple_gemfiles && Bundler.bundler_major_version == 2 + Bundler::SharedHelpers.major_deprecation 3, \ "gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock." end diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 02ec96adc9..25a72b272e 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -7,7 +7,7 @@ module Bundler # We're doing this because we might write tests that deal # with other versions of bundler and we are unsure how to # handle this better. - VERSION = "1.17.1" unless defined?(::Bundler::VERSION) + VERSION = "2.0.0.pre.1" unless defined?(::Bundler::VERSION) def self.overwrite_loaded_gem_version begin diff --git a/lib/bundler/vlad.rb b/lib/bundler/vlad.rb index 68181e7db8..a6b13435c9 100644 --- a/lib/bundler/vlad.rb +++ b/lib/bundler/vlad.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "bundler/shared_helpers" -Bundler::SharedHelpers.major_deprecation 2, +Bundler::SharedHelpers.major_deprecation 3, "The Bundler task for Vlad" # Vlad task for Bundler. diff --git a/spec/bundler/bundler/ui/shell_spec.rb b/spec/bundler/bundler/ui/shell_spec.rb index 6de2330687..951a446aff 100644 --- a/spec/bundler/bundler/ui/shell_spec.rb +++ b/spec/bundler/bundler/ui/shell_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Bundler::UI::Shell do describe "#warn" do before { subject.level = "warn" } - it "prints to stdout", :bundler => "< 3" do + it "prints to stdout", :bundler => "< 2" do expect { subject.warn("warning") }.to output("warning\n").to_stdout end @@ -46,7 +46,7 @@ RSpec.describe Bundler::UI::Shell do describe "#error" do before { subject.level = "error" } - it "prints to stdout", :bundler => "< 3" do + it "prints to stdout", :bundler => "< 2" do expect { subject.error("error!!!") }.to output("error!!!\n").to_stdout end diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb index 849c5a4f75..7f2e81c099 100644 --- a/spec/bundler/commands/binstubs_spec.rb +++ b/spec/bundler/commands/binstubs_spec.rb @@ -134,6 +134,33 @@ RSpec.describe "bundle binstubs <gem>" do if ENV["BUNDLER_SPEC_SUB_VERSION"] let(:system_bundler_version) { Bundler::VERSION } end + + before do + gemfile <<-G + source "file:///Users/colby/Projects/bundler/tmp/gems/remote2" + gem "rack" + gem "prints_loaded_gems" + G + + lockfile <<-G + GEM + remote: file:///Users/colby/Projects/bundler/tmp/gems/remote2/ + specs: + prints_loaded_gems (1.0) + rack (1.2) + + PLATFORMS + ruby + + DEPENDENCIES + prints_loaded_gems + rack + + BUNDLED WITH + #{system_bundler_version} + G + end + it "runs bundler" do sys_exec! "#{bundled_app("bin/bundle")} install" expect(out).to eq %(system bundler #{system_bundler_version}\n["install"]) diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index da860e62f8..158d58d67c 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -142,7 +142,7 @@ RSpec.describe "bundle clean" do bundle :clean digest = Digest(:SHA1).hexdigest(git_path.to_s) - cache_path = Bundler::VERSION.start_with?("1.") ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}") + cache_path = Bundler.bundler_major_version < 3 ? vendored_gems("cache/bundler/git/foo-1.0-#{digest}") : home(".bundle/cache/git/foo-1.0-#{digest}") expect(cache_path).to exist end diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index a08f2b6fe8..76841dcff6 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -570,22 +570,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable is empty", :bundler => "< 3" do - let(:executable) { "" } - - let(:exit_code) { 0 } - let(:expected) { "#{path} is empty" } - let(:expected_err) { "" } - if LessThanProc.with(RUBY_VERSION).call("1.9") - # Kernel#exec in ruby < 1.9 will raise Errno::ENOEXEC if the command content is empty, - # even if the command is set as an executable. - pending "Kernel#exec is different" - else - it_behaves_like "it runs" - end - end - - context "the executable is empty", :bundler => "3" do + context "the executable is empty" do let(:executable) { "" } let(:exit_code) { 0 } @@ -594,18 +579,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable raises", :bundler => "< 3" do - let(:executable) { super() << "\nraise 'ERROR'" } - let(:exit_code) { 1 } - let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" } - let(:expected_err) do - "RuntimeError: ERROR\n #{path}:10" + - (Bundler.current_ruby.ruby_18? ? "" : ":in `<top (required)>'") - end - it_behaves_like "it runs" - end - - context "the executable raises", :bundler => "3" do + context "the executable raises" do let(:executable) { super() << "\nraise 'ERROR'" } let(:exit_code) { 1 } let(:expected_err) do @@ -615,16 +589,7 @@ RSpec.describe "bundle exec" do it_behaves_like "it runs" end - context "the executable raises an error without a backtrace", :bundler => "< 3" do - let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } - let(:exit_code) { 1 } - let(:expected) { super() << "\nbundler: failed to load command: #{path} (#{path})" } - let(:expected_err) { "Err: Err" } - - it_behaves_like "it runs" - end - - context "the executable raises an error without a backtrace", :bundler => "3" do + context "the executable raises an error without a backtrace" do let(:executable) { super() << "\nclass Err < Exception\ndef backtrace; end;\nend\nraise Err" } let(:exit_code) { 1 } let(:expected_err) { "bundler: failed to load command: #{path} (#{path})\nErr: Err" } diff --git a/spec/bundler/commands/init_spec.rb b/spec/bundler/commands/init_spec.rb index e0782f28f7..8a8f0effa0 100644 --- a/spec/bundler/commands/init_spec.rb +++ b/spec/bundler/commands/init_spec.rb @@ -115,7 +115,7 @@ RSpec.describe "bundle init" do bundle :init, :gemspec => spec_file - gemfile = if Bundler::VERSION[0, 2] == "1." + gemfile = if Bundler::VERSION[0, 2].to_i < 3 bundled_app("Gemfile").read else bundled_app("gems.rb").read diff --git a/spec/bundler/commands/pristine_spec.rb b/spec/bundler/commands/pristine_spec.rb index 0bfc37560a..d8761bba26 100644 --- a/spec/bundler/commands/pristine_spec.rb +++ b/spec/bundler/commands/pristine_spec.rb @@ -49,7 +49,7 @@ RSpec.describe "bundle pristine", :ruby_repo do bundle! "pristine", :system_bundler => true bundle! "-v", :system_bundler => true - expected = if Bundler::VERSION < "2.0" + expected = if Bundler::VERSION < "3.0" "Bundler version" else Bundler::VERSION diff --git a/spec/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb index bf96ec489a..a5c6beec1a 100644 --- a/spec/bundler/commands/show_spec.rb +++ b/spec/bundler/commands/show_spec.rb @@ -36,7 +36,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do it "prints path if gem exists in bundle" do bundle "show rails" expect(out).to eq( - "[DEPRECATED FOR 2.0] use `bundle info rails` instead of `bundle show rails`\n" + + "[DEPRECATED FOR 3.0] use `bundle info rails` instead of `bundle show rails`\n" + default_bundle_path("gems", "rails-2.3.2").to_s ) end @@ -44,7 +44,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do it "prints the path to the running bundler" do bundle "show bundler" expect(out).to eq( - "[DEPRECATED FOR 2.0] use `bundle info bundler` instead of `bundle show bundler`\n" + + "[DEPRECATED FOR 3.0] use `bundle info bundler` instead of `bundle show bundler`\n" + root.to_s ) end @@ -52,7 +52,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do it "prints path if gem exists in bundle (with --paths option)" do bundle "show rails --paths" expect(out).to eq( - "[DEPRECATED FOR 2.0] use `bundle info rails --path` instead of `bundle show rails --paths`\n" + + "[DEPRECATED FOR 3.0] use `bundle info rails --path` instead of `bundle show rails --paths`\n" + default_bundle_path("gems", "rails-2.3.2").to_s ) end @@ -64,7 +64,7 @@ RSpec.describe "bundle show", :bundler => "< 3", :ruby => ">= 2.0" do expect(out).to include(default_bundle_path("gems", "rails-2.3.2").to_s) out_lines = out.split("\n") - expect(out_lines[0]).to eq("[DEPRECATED FOR 2.0] use `bundle list` instead of `bundle show --paths`") + expect(out_lines[0]).to eq("[DEPRECATED FOR 3.0] use `bundle list` instead of `bundle show --paths`") # Gem names are the last component of their path. gem_list = out_lines[1..-1].map {|p| p.split("/").last } diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb index 21b93e57c0..ec72ff69fc 100644 --- a/spec/bundler/install/deploy_spec.rb +++ b/spec/bundler/install/deploy_spec.rb @@ -297,7 +297,7 @@ RSpec.describe "install with --deployment or --frozen" do context "when replacing a host with the same host with credentials" do let(:success_message) do - if Bundler::VERSION.split(".", 2).first == "1" + if Bundler.bundler_major_version < 3 "Could not reach host localgemserver.test" else "Bundle complete!" diff --git a/spec/bundler/install/post_bundle_message_spec.rb b/spec/bundler/install/post_bundle_message_spec.rb index c41dc67458..394134f523 100644 --- a/spec/bundler/install/post_bundle_message_spec.rb +++ b/spec/bundler/install/post_bundle_message_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "post bundle message" do let(:bundle_complete_message) { "Bundle complete!" } let(:bundle_updated_message) { "Bundle updated!" } let(:installed_gems_stats) { "4 Gemfile dependencies, 5 gems now installed." } - let(:bundle_show_message) { Bundler::VERSION.split(".").first.to_i < 2 ? bundle_show_system_message : bundle_show_path_message } + let(:bundle_show_message) { Bundler::VERSION.split(".").first.to_i < 3 ? bundle_show_system_message : bundle_show_path_message } describe "for fresh bundle install" do it "without any options" do diff --git a/spec/bundler/install/redownload_spec.rb b/spec/bundler/install/redownload_spec.rb index 25d49999fc..f9caeed58a 100644 --- a/spec/bundler/install/redownload_spec.rb +++ b/spec/bundler/install/redownload_spec.rb @@ -65,12 +65,12 @@ RSpec.describe "bundle install", :bundler => "< 3", :ruby => ">= 2.0" do it "shows a deprecation when single flag passed" do bundle! "install --force" - expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" end it "shows a deprecation when multiple flags passed" do bundle! "install --no-color --force" - expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" end end diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index a147d053e1..32827dbd54 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -205,7 +205,7 @@ The :github git source is deprecated, and will be removed in Bundler 2.0. Change git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" } EOS - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg) + expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) subject.gem("sparks", :github => "indirect/sparks") end @@ -217,8 +217,8 @@ The :github git source is deprecated, and will be removed in Bundler 2.0. Change git_source(:github) {|repo_name| "https://github.com/\#{repo_name}.git" } EOS - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg) - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, "The `github.https` setting will be removed") + expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) + expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, "The `github.https` setting will be removed") subject.gem("sparks", :github => "indirect/sparks") github_uri = "https://github.com/indirect/sparks.git" expect(subject.dependencies.first.source.uri).to eq(github_uri) @@ -238,7 +238,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add end EOS - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg) + expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) subject.gem("not-really-a-gem", :bitbucket => "mcorp/flatlab-rails") end end @@ -250,7 +250,7 @@ The :bitbucket git source is deprecated, and will be removed in Bundler 2.0. Add "in Bundler 2.0. Add this code to the top of your Gemfile to ensure it " \ "continues to work:\n\n git_source(:gist) {|repo_name| " \ "\"https://gist.github.com/\#{repo_name}.git\" }\n\n" - expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, msg) + expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(3, msg) subject.gem("not-really-a-gem", :gist => "1234") end end diff --git a/spec/bundler/other/platform_spec.rb b/spec/bundler/other/platform_spec.rb index 96527e1641..6c59fd893c 100644 --- a/spec/bundler/other/platform_spec.rb +++ b/spec/bundler/other/platform_spec.rb @@ -4,7 +4,7 @@ RSpec.describe "bundle platform" do context "without flags" do let(:bundle_platform_platforms_string) do platforms = [rb] - platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_2_mode? + platforms.unshift(specific_local_platform) if Bundler.feature_flag.bundler_3_mode? platforms.map {|pl| "* #{pl}" }.join("\n") end diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb index 14d6bb99b9..812acc344f 100644 --- a/spec/bundler/quality_spec.rb +++ b/spec/bundler/quality_spec.rb @@ -181,6 +181,7 @@ RSpec.describe "The library itself" do gem.coc gem.mit inline + lockfile_upgrade_warning lockfile_uses_separate_rubygems_sources use_gem_version_promoter_for_major_updates viz_command diff --git a/spec/bundler/realworld/edgecases_spec.rb b/spec/bundler/realworld/edgecases_spec.rb index aa60e20b8a..bbfd0f68fd 100644 --- a/spec/bundler/realworld/edgecases_spec.rb +++ b/spec/bundler/realworld/edgecases_spec.rb @@ -57,7 +57,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do expect(lockfile).to include("activemodel (3.0.5)") end - it "resolves dependencies correctly", :ruby => "1.9.3" do + it "resolves dependencies correctly", :ruby => "<= 1.9.3" do gemfile <<-G source "https://rubygems.org" @@ -70,7 +70,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do expect(lockfile).to include("capybara (2.2.1)") end - it "installs the latest version of gxapi_rails", :ruby => "1.9.3" do + it "installs the latest version of gxapi_rails", :ruby => "<= 1.9.3" do gemfile <<-G source "https://rubygems.org" diff --git a/spec/bundler/runtime/gem_tasks_spec.rb b/spec/bundler/runtime/gem_tasks_spec.rb index 0510c80632..de72869dc3 100644 --- a/spec/bundler/runtime/gem_tasks_spec.rb +++ b/spec/bundler/runtime/gem_tasks_spec.rb @@ -19,7 +19,7 @@ RSpec.describe "require 'bundler/gem_tasks'", :ruby_repo do it "includes the relevant tasks" do with_gem_path_as(Spec::Path.base_system_gems.to_s) do - sys_exec "ruby -S rake -T" + sys_exec "#{rake} -T" end expect(err).to eq("") @@ -37,7 +37,7 @@ RSpec.describe "require 'bundler/gem_tasks'", :ruby_repo do it "adds 'pkg' to rake/clean's CLOBBER" do with_gem_path_as(Spec::Path.base_system_gems.to_s) do - sys_exec! %('#{Gem.ruby}' -S rake -e 'load "Rakefile"; puts CLOBBER.inspect') + sys_exec! %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect') end expect(last_command.stdout).to eq '["pkg"]' end diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index b027e7a922..181dac3220 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -53,7 +53,7 @@ module Spec end def bundle_update_requires_all? - Bundler::VERSION.start_with?("1.") ? nil : true + Bundler::VERSION.start_with?("2.") ? nil : true end def in_app_root(&blk) @@ -152,7 +152,7 @@ module Spec bang :bundle def forgotten_command_line_options(options) - remembered = Bundler::VERSION.split(".", 2).first == "1" + remembered = Bundler.bundler_major_version < 3 options = options.map do |k, v| k = Array(k)[remembered ? 0 : -1] v = '""' if v && v.to_s.empty? diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index 2eea088eea..97153226bd 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -29,7 +29,7 @@ module Spec end def default_bundle_path(*path) - if Bundler::VERSION.split(".").first.to_i < 2 + if Bundler::VERSION.split(".").first.to_i < 3 system_gem_path(*path) else bundled_app(*[".bundle", ENV.fetch("BUNDLER_SPEC_RUBY_ENGINE", Gem.ruby_engine), Gem::ConfigMap[:ruby_version], *path].compact) diff --git a/spec/bundler/support/platforms.rb b/spec/bundler/support/platforms.rb index 39040a61bd..950311d20e 100644 --- a/spec/bundler/support/platforms.rb +++ b/spec/bundler/support/platforms.rb @@ -106,7 +106,7 @@ module Spec end def local_platforms - if Bundler::VERSION.split(".").first.to_i > 1 + if Bundler::VERSION.split(".").first.to_i > 2 [local, specific_local_platform] else [local] diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb index 806933fe2f..c18f7650fc 100644 --- a/spec/bundler/support/rubygems_ext.rb +++ b/spec/bundler/support/rubygems_ext.rb @@ -33,7 +33,7 @@ module Spec ENV["BUNDLE_PATH"] = nil ENV["GEM_HOME"] = ENV["GEM_PATH"] = Path.base_system_gems.to_s - ENV["PATH"] = ["#{Path.root}/exe", "#{Path.system_gem_path}/bin", ENV["PATH"]].join(File::PATH_SEPARATOR) + ENV["PATH"] = [Path.bindir, "#{Path.system_gem_path}/bin", ENV["PATH"]].join(File::PATH_SEPARATOR) manifest = DEPS.to_a.sort_by(&:first).map {|k, v| "#{k} => #{v}\n" } manifest_path = "#{Path.base_system_gems}/manifest.txt" diff --git a/spec/bundler/update/redownload_spec.rb b/spec/bundler/update/redownload_spec.rb index 2138af510c..1bbc3a66fc 100644 --- a/spec/bundler/update/redownload_spec.rb +++ b/spec/bundler/update/redownload_spec.rb @@ -13,24 +13,24 @@ RSpec.describe "bundle update", :bundler => "< 3", :ruby => ">= 2.0" do describe "with --force" do it "shows a deprecation when single flag passed" do bundle! "update rack --force" - expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" end it "shows a deprecation when multiple flags passed" do bundle! "update rack --no-color --force" - expect(out).to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" end end describe "with --redownload" do it "does not show a deprecation when single flag passed" do bundle! "update rack --redownload" - expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).not_to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" end it "does not show a deprecation when single multiple flags passed" do bundle! "update rack --no-color --redownload" - expect(out).not_to include "[DEPRECATED FOR 2.0] The `--force` option has been renamed to `--redownload`" + expect(out).not_to include "[DEPRECATED FOR 3.0] The `--force` option has been renamed to `--redownload`" end end end |