diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-10-24 21:07:13 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-10-25 00:46:09 +0000 |
commit | c5861903ac5f89cafb131400835b2e3b207ba928 (patch) | |
tree | 3e3b1f2c44e4577e364c3e7cb99e1e94382a68de | |
parent | 820957b1ee43f296098197441680ce01f7ee1924 (diff) |
[rubygems/rubygems] Handle CI configuration on ignore list for Gem::Specification#files
https://github.com/rubygems/rubygems/commit/4bb0ef3e55
-rw-r--r-- | lib/bundler/cli/gem.rb | 3 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/newgem.gemspec.tt | 2 | ||||
-rw-r--r-- | spec/bundler/commands/newgem_spec.rb | 18 |
3 files changed, 22 insertions, 1 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 4ec61cec5d..fb064ed702 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -137,10 +137,13 @@ module Bundler case config[:ci] when "github" templates.merge!("github/workflows/main.yml.tt" => ".github/workflows/main.yml") + config[:ci_config_path] = ".github " when "gitlab" templates.merge!("gitlab-ci.yml.tt" => ".gitlab-ci.yml") + config[:ci_config_path] = ".gitlab-ci.yml " when "circle" templates.merge!("circleci/config.yml.tt" => ".circleci/config.yml") + config[:ci_config_path] = ".circleci " end if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?", diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt index bb76680379..51f19a5be9 100644 --- a/lib/bundler/templates/newgem/newgem.gemspec.tt +++ b/lib/bundler/templates/newgem/newgem.gemspec.tt @@ -30,7 +30,7 @@ Gem::Specification.new do |spec| spec.files = Dir.chdir(__dir__) do `git ls-files -z`.split("\x0").reject do |f| (File.expand_path(f) == __FILE__) || - f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile]) + f.start_with?(*%w[bin/ test/ spec/ features/ .git <%= config[:ci_config_path] %>appveyor Gemfile]) end end spec.bindir = "exe" diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index b34ffbc35b..310306b21a 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -960,6 +960,12 @@ RSpec.describe "bundle gem" do expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to exist end + + it "contained .gitlab-ci.yml into ignore list" do + bundle "gem #{gem_name} --ci=github" + + expect(bundled_app("#{gem_name}/#{gem_name}.gemspec").read).to include(".git .github appveyor") + end end context "--ci set to gitlab" do @@ -968,6 +974,12 @@ RSpec.describe "bundle gem" do expect(bundled_app("#{gem_name}/.gitlab-ci.yml")).to exist end + + it "contained .gitlab-ci.yml into ignore list" do + bundle "gem #{gem_name} --ci=gitlab" + + expect(bundled_app("#{gem_name}/#{gem_name}.gemspec").read).to include(".git .gitlab-ci.yml appveyor") + end end context "--ci set to circle" do @@ -976,6 +988,12 @@ RSpec.describe "bundle gem" do expect(bundled_app("#{gem_name}/.circleci/config.yml")).to exist end + + it "contained .circleci into ignore list" do + bundle "gem #{gem_name} --ci=circle" + + expect(bundled_app("#{gem_name}/#{gem_name}.gemspec").read).to include(".git .circleci appveyor") + end end context "gem.ci setting set to none" do |