Skip to content

Commit

Permalink
Merge pull request #6723 from gareth/dont-publish-gemfile
Browse files Browse the repository at this point in the history
Stop publishing Gemfile in default gem template
  • Loading branch information
deivid-rodriguez committed Jun 8, 2023
2 parents 7408ccc + 59049c0 commit 596d4ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bundler/lib/bundler/templates/newgem/newgem.gemspec.tt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions bundler/spec/commands/newgem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,14 @@ def create_temporary_dir(dir)
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}"

Expand Down

0 comments on commit 596d4ab

Please sign in to comment.