Skip to content

Commit 1a4117d

Browse files
committed
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.
1 parent 2577ba4 commit 1a4117d

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

tool/lib/bundled_gem.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def update_default_gemspecs(basedirs, out, quiet: true)
152152
puts "Ignoring #{g}" unless quiet
153153
next
154154
end
155-
out.write(src, name: name, quiet: quiet)
155+
out.write(src, name: name, newer: File.mtime(g), quiet: quiet)
156156
end
157157
end
158158
end

tool/lib/output.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def def_options(opt)
3131
@vpath.def_options(opt)
3232
end
3333

34-
def write(data, overwrite: @overwrite, create_only: @create_only, name: nil, quiet: false)
34+
def write(data, overwrite: @overwrite, create_only: @create_only, name: nil, newer: nil, quiet: false)
3535
unless (name = name ? (@path ? File.join(@path, name) : name) : @path)
3636
$stdout.print data
3737
return true
@@ -41,8 +41,9 @@ def write(data, overwrite: @overwrite, create_only: @create_only, name: nil, qui
4141
updated = color.fail("updated")
4242
outpath = nil
4343

44-
if (@ifchange or overwrite or create_only) and (@vpath.open(name, "rb") {|f|
44+
if (@ifchange or overwrite or create_only or newer) and (@vpath.open(name, "rb") {|f|
4545
outpath = f.path
46+
next true if newer and f.mtime > newer
4647
if @ifchange or create_only
4748
original = f.read
4849
(@ifchange and original == data) or (create_only and !original.empty?)

0 commit comments

Comments
 (0)