From 8f4aa4fd2a609a3eca2f415a12964e86cab94abc Mon Sep 17 00:00:00 2001 From: hsbt Date: Mon, 12 Nov 2018 00:53:15 +0000 Subject: Merge Bundler-2.0.0.pre1 from upstream. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/bundler/capistrano.rb | 2 +- lib/bundler/cli.rb | 10 +++++----- lib/bundler/cli/console.rb | 2 +- lib/bundler/cli/install.rb | 2 +- lib/bundler/cli/update.rb | 2 +- lib/bundler/definition.rb | 2 +- lib/bundler/deployment.rb | 2 +- lib/bundler/dsl.rb | 10 +++++----- lib/bundler/feature_flag.rb | 1 + lib/bundler/rubygems_integration.rb | 2 +- lib/bundler/settings.rb | 3 ++- lib/bundler/shared_helpers.rb | 4 ++-- lib/bundler/version.rb | 2 +- lib/bundler/vlad.rb | 2 +- 14 files changed, 24 insertions(+), 22 deletions(-) (limited to 'lib/bundler') 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 `" 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. -- cgit v1.2.3