summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Endoh <[email protected]>2024-09-13 14:50:35 +0900
committerYusuke Endoh <[email protected]>2024-09-13 15:49:28 +0900
commitf090d1fa598ec13b30a40101d8de85c02a77cce3 (patch)
treef4c5681873e0cb62625eb17a140dba4d9d42d77a
parentcf5b965897141b84365fbf84231745e18d36c755 (diff)
Try to find bundled gem version from lib/*/version.rb
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11612
-rw-r--r--tool/lib/bundled_gem.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/tool/lib/bundled_gem.rb b/tool/lib/bundled_gem.rb
index 8730f0fb3a..d870925d05 100644
--- a/tool/lib/bundled_gem.rb
+++ b/tool/lib/bundled_gem.rb
@@ -91,7 +91,10 @@ module BundledGem
Dir.chdir(gemdir) do
spec = Gem::Specification.new do |s|
s.name = gemfile.chomp(".gemspec")
- s.version = File.read("lib/#{s.name}.rb")[/VERSION = "(.+?)"/, 1]
+ s.version =
+ File.read("lib/#{s.name}.rb")[/VERSION = "(.+?)"/, 1] ||
+ begin File.read("lib/#{s.name}/version.rb")[/VERSION = "(.+?)"/, 1]; rescue; nil; end ||
+ raise("cannot find the version of #{ s.name } gem")
s.authors = ["DUMMY"]
s.email = ["[email protected]"]
s.files = Dir.glob("{lib,ext}/**/*").select {|f| File.file?(f)}