[rubygems/rubygems] Stop publishing Gemfile in default gem template

Similarly to how the other ignored files are intended for local
development and not for production, the Gemfile and Gemfile.lock files
for a gem only relate to local development and aren't useful to people
installing the gem.

https://github.com/rubygems/rubygems/commit/59049c04be
This commit is contained in:
Gareth Adams 2023-06-06 17:18:09 +01:00 committed by git
parent 441302be1a
commit eaf11d3dd4
2 changed files with 10 additions and 1 deletions

View File

@ -29,7 +29,8 @@ 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|
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
(File.expand_path(f) == __FILE__) ||
f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
end
end
spec.bindir = "exe"

View File

@ -638,6 +638,14 @@ RSpec.describe "bundle gem" do
expect(bundler_gemspec.files).not_to include("#{gem_name}.gemspec")
end
it "does not include the Gemfile file in files" do
bundle "gem #{gem_name}"
bundler_gemspec = Bundler::GemHelper.new(bundled_app(gem_name), gem_name).gemspec
expect(bundler_gemspec.files).not_to include("Gemfile")
end
it "runs rake without problems" do
bundle "gem #{gem_name}"