diff options
author | Hiroshi SHIBATA <[email protected]> | 2022-12-20 09:43:53 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2022-12-20 13:15:02 +0900 |
commit | 18ba89093a0b214cd89f1567c037c239f094496d () | |
tree | bb4e07c66cca5fd2da04da297e8c66fbf883fdad /lib | |
parent | ad1f61fe80dea7a1b1e8d27a4232d7b10b820960 (diff) |
Merge RubyGems/Bundler master
Pick from https://.com/rubygems/rubygems/commit/ba3adad4d80038ffd7bea015da2f11d3e8a2ff82
Notes: Merged: https://.com/ruby/ruby/pull/6966
-rw-r--r-- | lib/bundler/cli.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/gem.rb | 22 | ||||
-rw-r--r-- | lib/bundler/man/bundle-gem.1 | 4 | ||||
-rw-r--r-- | lib/bundler/man/bundle-gem.1.ronn | 4 | ||||
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 65 | ||||
-rw-r--r-- | lib/bundler/source_list.rb | 8 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/newgem.gemspec.tt | 2 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/travis.yml.tt | 6 |
8 files changed, 66 insertions, 47 deletions
@@ -587,7 +587,7 @@ module Bundler 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 --global gem.test (rspec|minitest|test-unit)`." method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "", - :desc => "Generate CI configuration, either Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (|travis|gitlab|circle)`" method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "", :desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`" method_option :_username, :type => :string, :default => Bundler.settings["gem._username"], :banner => "Set your username on ", :desc => "Fill in username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem._username <your_username>`." @@ -31,6 +31,7 @@ module Bundler @extension = options[:ext] validate_ext_name if @extension end def run @@ -134,8 +135,6 @@ module Bundler case config[:ci] when "" templates.merge!("/workflows/main.yml.tt" => "./workflows/main.yml") - when "travis" - templates.merge!("travis.yml.tt" => ".travis.yml") when "gitlab" templates.merge!("gitlab-ci.yml.tt" => ".gitlab-ci.yml") when "circle" @@ -308,12 +307,11 @@ module Bundler "* CircleCI: https://circleci.com/\n" \ "* Actions: https://.com/features/actions\n" \ "* GitLab CI: https://docs.gitlab.com/ee/ci/\n" \ - "* Travis CI: https://travis-ci.org/\n" \ "\n" Bundler.ui.info hint_text("ci") - result = Bundler.ui.ask "Enter a CI service. /travis/gitlab/circle/(none):" - if /|travis|gitlab|circle/.match?(result) ci_template = result else ci_template = false @@ -428,5 +426,19 @@ module Bundler def standard_version "1.3" end end end @@ -77,8 +77,8 @@ When Bundler is configured to not generate tests, an interactive prompt will be When Bundler is unconfigured, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\. . .TP -\fB\-\-ci\fR, \fB\-\-ci=\fR, \fB\-\-ci=travis\fR, \fB\-\-ci=gitlab\fR, \fB\-\-ci=circle\fR -Specify the continuous integration service that Bundler should use when generating the project\. Acceptable values are \fB\fR, \fBtravis\fR, \fBgitlab\fR and \fBcircle\fR\. A configuration file will be generated in the project directory\. Given no option is specified: . .IP When Bundler is configured to generate CI files, this defaults to Bundler\'s global config setting \fBgem\.ci\fR\. @@ -76,9 +76,9 @@ configuration file using the following names: the answer will be saved in Bundler's global config for future `bundle gem` use. -* `--ci`, `--ci=`, `--ci=travis`, `--ci=gitlab`, `--ci=circle`: Specify the continuous integration service that Bundler should use when - generating the project. Acceptable values are ``, `travis`, `gitlab` and `circle`. A configuration file will be generated in the project directory. Given no option is specified: @@ -31,7 +31,6 @@ module Bundler msg = String.new msg << "Git error: command `#{command}` in directory #{path} has failed." msg << "\n#{extra_info}" if extra_info - msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path.exist? super msg end end @@ -47,7 +46,7 @@ module Bundler # All actions required by the Git source is encapsulated in this # object. class GitProxy - attr_accessor :path, :uri, :branch, :tag, :ref attr_writer :revision def initialize(path, uri, options = {}, revision = nil, git = nil) @@ -56,6 +55,7 @@ module Bundler @branch = options["branch"] @tag = options["tag"] @ref = options["ref"] @revision = revision @git = git end @@ -94,9 +94,7 @@ module Bundler unshallow_needed = clone_needs_unshallow? return unless extra_fetch_needed || unshallow_needed - fetch_args = unshallow_needed ? ["--unshallow"] : depth_args - - git_retry(*["fetch", "--force", "--quiet", "--no-tags", *fetch_args, "--", configured_uri, refspec].compact, :dir => path) end def copy_to(destination, submodules = false) @@ -132,6 +130,22 @@ module Bundler private def clone_needs_extra_fetch? return true if path.exist? @@ -216,11 +230,7 @@ module Bundler def git_null(*command, dir: nil) check_allowed(command) - out, status = SharedHelpers.with_clean_git_env do - capture_and_ignore_stderr(*capture3_args_for(command, dir)) - end - - [URICredentialsFilter.credential_filtered_string(out, uri), status] end def git_retry(*command, dir: nil) @@ -234,15 +244,13 @@ module Bundler def git(*command, dir: nil) command_with_no_credentials = check_allowed(command) - out, status = SharedHelpers.with_clean_git_env do - capture_and_filter_stderr(*capture3_args_for(command, dir)) - end - filtered_out = URICredentialsFilter.credential_filtered_string(out, uri) - raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, filtered_out) unless status.success? - filtered_out end def has_revision_cached? @@ -254,10 +262,9 @@ module Bundler end def find_local_revision - options_ref = branch || tag || ref - return head_revision if options_ref.nil? - find_revision_for(options_ref) end def head_revision @@ -318,17 +325,17 @@ module Bundler command_with_no_credentials end - def capture_and_filter_stderr(*cmd) - require "open3" - return_value, captured_err, status = Open3.capture3(*cmd) - Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) unless captured_err.empty? - [return_value, status] - end - def capture_and_ignore_stderr(*cmd) - require "open3" - return_value, _, status = Open3.capture3(*cmd) - [return_value, status] end def capture3_args_for(cmd, dir) @@ -161,11 +161,17 @@ module Bundler end def map_sources(replacement_sources) - [@rubygems_sources, @path_sources, @git_sources, @plugin_sources].map do |sources| sources.map do |source| replacement_sources.find {|s| s == source } || source end end end def global_replacement_source(replacement_sources) @@ -26,7 +26,7 @@ Gem::Specification.new do |spec| # The `git ls-files -z` loads the files in the RubyGem that have been added into git. spec.files = Dir.chdir(__dir__) do `git ls-files -z`.split("\x0").reject do |f| - (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)}) end end spec.bindir = "exe" @@ -1,6 +0,0 @@ ---- -language: ruby -cache: bundler -rvm: - - <%= RUBY_VERSION %> -before_install: gem install bundler -v <%= Bundler::VERSION %> |