ruby-changes:63355
From: Hiroshi <ko1@a...>
Date: Thu, 15 Oct 2020 17:19:23 +0900 (JST)
Subject: [ruby-changes:63355] d386a58f6f (master): Merge bundler-2.2.0.rc.2
https://git.ruby-lang.org/ruby.git/commit/?id=d386a58f6f From d386a58f6f1865aaa35eda5af55cff3ff3cca4ca Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Thu, 15 Oct 2020 13:20:25 +0900 Subject: Merge bundler-2.2.0.rc.2 diff --git a/lib/bundler.rb b/lib/bundler.rb index 610cc48..f6ad7cc 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -353,7 +353,10 @@ EOF https://github.com/ruby/ruby/blob/trunk/lib/bundler.rb#L353 env.delete_if {|k, _| k[0, 7] == "BUNDLE_" } if env.key?("RUBYOPT") - env["RUBYOPT"] = env["RUBYOPT"].sub "-rbundler/setup", "" + rubyopt = env["RUBYOPT"].split(" ") + rubyopt.delete("-r#{File.expand_path("bundler/setup", __dir__)}") + rubyopt.delete("-rbundler/setup") + env["RUBYOPT"] = rubyopt.join(" ") end if env.key?("RUBYLIB") @@ -453,7 +456,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/lib/bundler.rb#L456 # system binaries. If you put '-n foo' in your .gemrc, RubyGems will # install binstubs there instead. Unfortunately, RubyGems doesn't expose # that directory at all, so rather than parse .gemrc ourselves, we allow - # the directory to be set as well, via `bundle config set bindir foo`. + # the directory to be set as well, via `bundle config set --local bindir foo`. Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir end @@ -621,7 +624,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/lib/bundler.rb#L624 @rubygems = nil end - private + private def eval_yaml_gemspec(path, contents) require_relative "bundler/psyched_yaml" diff --git a/lib/bundler/build_metadata.rb b/lib/bundler/build_metadata.rb index 4dfad2f..0846e82 100644 --- a/lib/bundler/build_metadata.rb +++ b/lib/bundler/build_metadata.rb @@ -27,19 +27,11 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/build_metadata.rb#L27 # If Bundler has been installed without its .git directory and without a # commit instance variable then we can't determine its commits SHA. - git_dir = File.join(File.expand_path("../../..", __FILE__), ".git") + git_dir = File.join(File.expand_path("../../../..", __FILE__), ".git") if File.directory?(git_dir) return @git_commit_sha = Dir.chdir(git_dir) { `git rev-parse --short HEAD`.strip.freeze } end - # If Bundler is a submodule in RubyGems, get the submodule commit - git_sub_dir = File.join(File.expand_path("../../../..", __FILE__), ".git") - if File.directory?(git_sub_dir) - return @git_commit_sha = Dir.chdir(git_sub_dir) do - `git ls-tree --abbrev=8 HEAD bundler`.split(/\s/).fetch(2, "").strip.freeze - end - end - @git_commit_sha ||= "unknown" end diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index e8193ce..b419662 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -134,7 +134,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L134 if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+} Kernel.exec "man #{man_page}" else - puts File.read("#{File.dirname(man_page)}/#{File.basename(man_page)}.txt") + puts File.read("#{File.dirname(man_page)}/#{File.basename(man_page)}.ronn") end elsif command_path = Bundler.which("bundler-#{cli}") Kernel.exec(command_path, "--help") @@ -439,11 +439,18 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L439 Outdated.new(options, gems).run end - desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache" - unless Bundler.feature_flag.cache_all? - method_option "all", :type => :boolean, - :banner => "Include all sources (including path and git)." + desc "fund [OPTIONS]", "Lists information about gems seeking funding assistance" + method_option "group", :aliases => "-g", :type => :array, :banner => + "Fetch funding information for a specific group" + def fund + require_relative "cli/fund" + Fund.new(options).run end + + desc "cache [OPTIONS]", "Locks and then caches all of the gems into vendor/cache" + method_option "all", :type => :boolean, + :default => Bundler.feature_flag.cache_all?, + :banner => "Include all sources (including path and git)." method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms present in the lockfile, not only the current one" method_option "cache-path", :type => :string, :banner => "Specify a different cache path than the default (vendor/cache)." @@ -462,6 +469,12 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L469 bundle without having to download any additional gems. D def cache + SharedHelpers.major_deprecation 2, + "The `--all` flag is deprecated because it relies on being " \ + "remembered across bundler invocations, which bundler will no longer " \ + "do in future versions. Instead please use `bundle config set cache_all true`, " \ + "and stop using this flag" if ARGV.include?("--all") + require_relative "cli/cache" Cache.new(options).run end @@ -565,18 +578,18 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L578 desc "gem NAME [OPTIONS]", "Creates a skeleton for creating a rubygem" method_option :exe, :type => :boolean, :default => false, :aliases => ["--bin", "-b"], :desc => "Generate a binary executable for your library." - method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set gem.coc true`." + method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config set --global gem.coc true`." method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR", :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)" method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code" method_option :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library." - method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set gem.mit true`." - method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set gem.rubocop true`." + method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set --global gem.mit true`." + method_option :rubocop, :type => :boolean, :desc => "Add rubocop to the generated Rakefile and gemspec. Set a default with `bundle config set --global gem.rubocop true`." method_option :test, :type => :string, :lazy_default => Bundler.settings["gem.test"] || "", :aliases => "-t", :banner => "Use the specified test framework for your library", - :desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set gem.test (rspec|minitest|test-unit)`." + :desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`." method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "", - :desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set gem.ci (github|travis|gitlab|circle)`" + :desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|travis|gitlab|circle)`" def gem(name) end @@ -740,11 +753,11 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L753 end end - private + private # Automatically invoke `bundle install` and resume if # Bundler.settings[:auto_install] exists. This is set through config cmd - # `bundle config set auto_install 1`. + # `bundle config set --global auto_install 1`. # # Note that this method `nil`s out the global Definition object, so it # should be called first, before you instantiate anything like an @@ -839,10 +852,10 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli.rb#L852 value = options[name] value = value.join(" ").to_s if option.type == :array - Bundler::SharedHelpers.major_deprecation 2,\ + Bundler::SharedHelpers.major_deprecation 2, "The `#{flag_name}` flag is deprecated because it relies on being " \ "remembered across bundler invocations, which bundler will no longer " \ - "do in future versions. Instead please use `bundle config set #{name.tr("-", "_")} " \ + "do in future versions. Instead please use `bundle config set --local #{name.tr("-", "_")} " \ "'#{value}'`, and stop using this flag" end end diff --git a/lib/bundler/cli/add.rb b/lib/bundler/cli/add.rb index 07b951f..5bcf30d 100644 --- a/lib/bundler/cli/add.rb +++ b/lib/bundler/cli/add.rb @@ -17,7 +17,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/cli/add.rb#L17 perform_bundle_install unless options["skip-install"] end - private + private def perform_bundle_install Installer.install(Bundler.root, Bundler.definition) diff --git a/lib/bundler/cli/cache.rb b/li (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/