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

ruby-changes:63996

From: Nobuyoshi <ko1@a...>
Date: Mon, 7 Dec 2020 19:20:22 +0900 (JST)
Subject: [ruby-changes:63996] 29dee10af2 (master): rbinstall.rb: install files expanded from bundled gems

https://git.ruby-lang.org/ruby.git/commit/?id=29dee10af2

From 29dee10af28e5766916ad3aa93401508508d53e2 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 7 Dec 2020 19:09:23 +0900
Subject: rbinstall.rb: install files expanded from bundled gems

Although gemspec file (e.g., power_assert and rake) often uses
`git ls-files`, as it does not make sense in other than its own
repository, it has been ignored now.  Gather all files expanded
from the bundled gem to install, instead.

diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 7d22a83..97cde08 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -871,7 +871,7 @@ install?(:ext, :arch, :gem, :'default-gems', :'default-gems-arch') do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L871
   install_default_gem('ext', srcdir)
 end
 
-def load_gemspec(file)
+def load_gemspec(file, expanded = false)
   file = File.realpath(file)
   code = File.read(file, encoding: "utf-8:-")
   code.gsub!(/`git.*?`/m, '""')
@@ -881,6 +881,18 @@ def load_gemspec(file) https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L881
     raise TypeError, "[#{file}] isn't a Gem::Specification (#{spec.class} instead)."
   end
   spec.loaded_from = file
+
+  # gather expanded bundled gem files
+  if expanded
+    base = File.dirname(file)
+    Dir.glob("**/*", File::FNM_DOTMATCH, base: base) do |n|
+      next if n.start_with?(".git") # git related files are useless
+      case File.basename(n); when ".", ".."; next; end
+      next if File.directory?(File.join(base, n))
+      spec.files << n
+    end
+  end
+
   spec
 end
 
@@ -955,7 +967,7 @@ install?(:ext, :comm, :gem, :'bundled-gems') do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L967
     gem_name = "#$1-#$2"
     path = "#{srcdir}/.bundle/gems/#{gem_name}/#$1.gemspec"
     next unless File.exist?(path)
-    spec = load_gemspec(path)
+    spec = load_gemspec(path, true)
     next unless spec.platform == Gem::Platform::RUBY
     next unless spec.full_name == gem_name
     spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
-- 
cgit v0.10.2


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

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