[前][次][番号順一覧][スレッド一覧]

ruby-changes:67426

From: Nobuyoshi <ko1@a...>
Date: Tue, 31 Aug 2021 19:07:11 +0900 (JST)
Subject: [ruby-changes:67426] 9fc16a31d9 (master): [rubygems/rubygems] Exclude gemspec file itself from gem

https://git.ruby-lang.org/ruby.git/commit/?id=9fc16a31d9

From 9fc16a31d9a0800b46ae547acb7115a9c58f6c9f Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 20 Dec 2020 18:48:15 +0900
Subject: [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
---
 lib/bundler/templates/newgem/newgem.gemspec.tt | 2 +-
 spec/bundler/commands/newgem_spec.rb           | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt
index eddb8b4..c46e2c3 100644
--- a/lib/bundler/templates/newgem/newgem.gemspec.tt
+++ b/lib/bundler/templates/newgem/newgem.gemspec.tt
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec| https://github.com/ruby/ruby/blob/trunk/lib/bundler/templates/newgem/newgem.gemspec.tt#L26
   # 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"
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 56fea00..29d04e9 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -588,6 +588,14 @@ RSpec.describe "bundle gem" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/newgem_spec.rb#L588
       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}"
 
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]