diff options
author | Gareth Adams <gareth@bridge-u.com> | 2023-06-06 17:18:09 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-06-08 15:20:05 +0000 |
commit | eaf11d3dd45a5be3466d189d7283d7c502e7f17a (patch) | |
tree | ebf20a5f38b6906f87be434e29003778b4cce2c7 | |
parent | 441302be1add6f10a85ccbde551a0fb567c65a15 (diff) |
[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
-rw-r--r-- | lib/bundler/templates/newgem/newgem.gemspec.tt | 3 | ||||
-rw-r--r-- | spec/bundler/commands/newgem_spec.rb | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt index da81f046d4..bb76680379 100644 --- a/lib/bundler/templates/newgem/newgem.gemspec.tt +++ b/lib/bundler/templates/newgem/newgem.gemspec.tt @@ -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" diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index 970e51b8ef..ede1ff6b8e 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -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}" |