[rubygems/rubygems] Handle CI configuration on ignore list for Gem::Specification#files

https://github.com/rubygems/rubygems/commit/4bb0ef3e55
This commit is contained in:
Hiroshi SHIBATA 2023-10-24 21:07:13 +09:00 committed by git
parent 820957b1ee
commit c5861903ac
3 changed files with 22 additions and 1 deletions

View File

@ -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?",

View File

@ -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"

View File

@ -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