summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2026-04-17 18:36:28 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2026-05-13 11:55:57 +0900
commitd9242cab17bc3c9076921a6888273cc40339923d (patch)
tree86e88be6baa8ac708ca14849e719b568df3df115
parentf3d86878f7d000b900f0b2a2653dfe0f99226fca (diff)
Skip generating gemspec if the newer target exists
Because of difference of rubygems versions, between baseruby and the bundled source, the generated gemspec may differ even equivalent actually.
-rw-r--r--tool/lib/bundled_gem.rb2
-rw-r--r--tool/lib/output.rb5
2 files changed, 4 insertions, 3 deletions
diff --git a/tool/lib/bundled_gem.rb b/tool/lib/bundled_gem.rb
index 6cfdb8d425..ca9b40875c 100644
--- a/tool/lib/bundled_gem.rb
+++ b/tool/lib/bundled_gem.rb
@@ -152,7 +152,7 @@ module BundledGem
puts "Ignoring #{g}" unless quiet
next
end
- out.write(src, name: name, quiet: quiet)
+ out.write(src, name: name, newer: File.mtime(g), quiet: quiet)
end
end
end
diff --git a/tool/lib/output.rb b/tool/lib/output.rb
index db59b6ed4e..8590e0ffe2 100644
--- a/tool/lib/output.rb
+++ b/tool/lib/output.rb
@@ -31,7 +31,7 @@ class Output
@vpath.def_options(opt)
end
- def write(data, overwrite: @overwrite, create_only: @create_only, name: nil, quiet: false)
+ def write(data, overwrite: @overwrite, create_only: @create_only, name: nil, newer: nil, quiet: false)
unless (name = name ? (@path ? File.join(@path, name) : name) : @path)
$stdout.print data
return true
@@ -41,8 +41,9 @@ class Output
updated = color.fail("updated")
outpath = nil
- if (@ifchange or overwrite or create_only) and (@vpath.open(name, "rb") {|f|
+ if (@ifchange or overwrite or create_only or newer) and (@vpath.open(name, "rb") {|f|
outpath = f.path
+ next true if newer and f.mtime > newer
if @ifchange or create_only
original = f.read
(@ifchange and original == data) or (create_only and !original.empty?)