Skip to content

Commit 7db548a

Browse files
Merge pull request #6723 from gareth/dont-publish-gemfile
Stop publishing Gemfile in default gem template (cherry picked from commit 596d4ab)
1 parent 11606cd commit 7db548a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

bundler/lib/bundler/templates/newgem/newgem.gemspec.tt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Gem::Specification.new do |spec|
2929
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
3030
spec.files = Dir.chdir(__dir__) do
3131
`git ls-files -z`.split("\x0").reject do |f|
32-
(File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
32+
(File.expand_path(f) == __FILE__) ||
33+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
3334
end
3435
end
3536
spec.bindir = "exe"

bundler/spec/commands/newgem_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,14 @@ def create_temporary_dir(dir)
638638
expect(bundler_gemspec.files).not_to include("#{gem_name}.gemspec")
639639
end
640640

641+
it "does not include the Gemfile file in files" do
642+
bundle "gem #{gem_name}"
643+
644+
bundler_gemspec = Bundler::GemHelper.new(bundled_app(gem_name), gem_name).gemspec
645+
646+
expect(bundler_gemspec.files).not_to include("Gemfile")
647+
end
648+
641649
it "runs rake without problems" do
642650
bundle "gem #{gem_name}"
643651

0 commit comments

Comments
 (0)