Add sync_tool.rake [ci skip]
This commit is contained in:
parent
afc98e3b55
commit
9ea1281a76
Notes:
git
2023-04-28 13:05:31 +00:00
15
tool/rakelib/sync_tool.rake
Normal file
15
tool/rakelib/sync_tool.rake
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
task :sync_tool, [:from] do |t, from: (File.identical?(__dir__, "rakelib") ? "../ruby/tool" : __dir__)|
|
||||||
|
require 'fileutils'
|
||||||
|
|
||||||
|
{
|
||||||
|
"rakelib/sync_tool.rake" => "rakelib",
|
||||||
|
"lib/core_assertions.rb" => "test/lib",
|
||||||
|
"lib/envutil.rb" => "test/lib",
|
||||||
|
"lib/find_executable.rb" => "test/lib",
|
||||||
|
"lib/helper.rb" => "test/lib",
|
||||||
|
}.each do |src, dest|
|
||||||
|
FileUtils.mkpath(dest)
|
||||||
|
FileUtils.cp "#{from}/#{src}", dest
|
||||||
|
rescue Errno::ENOENT
|
||||||
|
end
|
||||||
|
end
|
@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
|
|
||||||
test_lib_files = %w[
|
test_lib_files = [
|
||||||
core_assertions.rb
|
["lib/core_assertions.rb", "test/lib"],
|
||||||
find_executable.rb
|
["lib/find_executable.rb", "test/lib"],
|
||||||
envutil.rb
|
["lib/envutil.rb", "test/lib"],
|
||||||
helper.rb
|
["lib/helper.rb", "test/lib"],
|
||||||
].map do |file|
|
["rakelib/sync_tool.rake", "rakelib"],
|
||||||
[file, File.read("#{__dir__}/lib/#{file}")]
|
].map do |file, dest|
|
||||||
|
[file, dest, File.read("#{__dir__}/#{file}")]
|
||||||
end
|
end
|
||||||
|
|
||||||
repos = %w[
|
repos = %w[
|
||||||
@ -25,6 +26,7 @@ commit = `git rev-parse HEAD`.chomp
|
|||||||
message = "Update test libraries from https://github.com/ruby/ruby/commit/#{commit}"
|
message = "Update test libraries from https://github.com/ruby/ruby/commit/#{commit}"
|
||||||
|
|
||||||
topdir = ARGV.shift || '..'
|
topdir = ARGV.shift || '..'
|
||||||
|
repos = ARGV unless ARGV.empty?
|
||||||
|
|
||||||
repos.each do |repo|
|
repos.each do |repo|
|
||||||
puts "#{repo}: start"
|
puts "#{repo}: start"
|
||||||
@ -38,10 +40,11 @@ repos.each do |repo|
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
test_lib_files.each do |file, code|
|
test_lib_files.each do |file, dest, code|
|
||||||
FileUtils.mkdir_p("test/lib")
|
FileUtils.mkdir_p(dest)
|
||||||
File.binwrite("test/lib/#{file}", code)
|
file = "#{dest}/#{File.basename(file)}"
|
||||||
system "git add test/lib/#{file}"
|
File.binwrite(file, code)
|
||||||
|
system "git add #{file}"
|
||||||
end
|
end
|
||||||
|
|
||||||
if `git commit -m '#{message}'`.chomp =~ /nothing to commit/
|
if `git commit -m '#{message}'`.chomp =~ /nothing to commit/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user