1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Exclude gemspec file itself from gem

The processed YML data is included as metadata, the source gemspec
file is unused and just confusing.

https://github.com/rubygems/rubygems/commit/f444478eac
This commit is contained in:
Nobuyoshi Nakada 2020-12-20 18:48:15 +09:00 committed by Hiroshi SHIBATA
parent d7c734a27e
commit 9fc16a31d9
Notes: git 2021-08-31 19:07:18 +09:00
2 changed files with 9 additions and 1 deletions

View file

@ -26,7 +26,7 @@ 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(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject do |f|
f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
end
end
spec.bindir = "exe"

View file

@ -588,6 +588,14 @@ RSpec.describe "bundle gem" do
expect(bundled_app("#{gem_name}/lib/#{require_path}.rb").read).to match(/class Error < StandardError; end$/)
end
it "does not include the gemspec file in files" do
bundle "gem #{gem_name}"
bundler_gemspec = Bundler::GemHelper.new(gemspec_dir).gemspec
expect(bundler_gemspec.files).not_to include("#{gem_name}.gemspec")
end
it "runs rake without problems" do
bundle "gem #{gem_name}"