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

ruby-changes:63998

From: Nobuyoshi <ko1@a...>
Date: Mon, 7 Dec 2020 22:38:33 +0900 (JST)
Subject: [ruby-changes:63998] 5894ea5954 (master): rbinstall.rb: fix the position to expand files

https://git.ruby-lang.org/ruby.git/commit/?id=5894ea5954

From 5894ea5954db119fc818bb7030ed56cf46830c6d Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 7 Dec 2020 22:27:29 +0900
Subject: rbinstall.rb: fix the position to expand files

As `spec.files` is used for `executables` and so on, the expanded
list needs to be located at the same place.

diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 97cde08..fcc41f2 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -874,25 +874,25 @@ end https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L874
 def load_gemspec(file, expanded = false)
   file = File.realpath(file)
   code = File.read(file, encoding: "utf-8:-")
-  code.gsub!(/`git.*?`/m, '""')
-  code.gsub!(/%x\[git.*?\]/m, '""')
+  code.gsub!(/(?:`git[^\`]*`|%x\[git[^\]]*\])\.split\(\"(?:\\.|[^\"])*\"\)/m) do
+    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))
+        files << n.dump
+      end
+    end
+    "[" + files.join(", ") + "]"
+  end
   spec = eval(code, binding, file)
   unless Gem::Specification === spec
     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
 
-- 
cgit v0.10.2


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

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