From e91ff4dbaf0bdbf7185b485b43cd9393419efd11 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Sun, 14 Jul 2019 15:20:25 +0900 Subject: Use FileUtils.cp_r instead of cp command directoly. --- tool/sync_default_gems.rb | 136 +++++++++++++++++++++++----------------------- 1 file changed, 68 insertions(+), 68 deletions(-) (limited to 'tool') diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index f958535716..f00e24d87e 100644 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -91,135 +91,135 @@ def sync_default_gems(gem) case gem when "rubygems" FileUtils.rm_rf(%w[lib/rubygems* test/rubygems]) - `cp -r #{upstream}/lib/rubygems* ./lib` - `cp -r #{upstream}/test/rubygems ./test` + FileUtils.cp_r(Dir.glob("#{upstream}/lib/rubygems*"), "lib") + FileUtils.cp_r("#{upstream}/test/rubygems", "test") when "bundler" FileUtils.rm_rf(%w[lib/bundler* libexec/bundler libexec/bundle spec/bundler man/bundle* man/gemfile*]) - `cp -r #{upstream}/lib/bundler* ./lib` - `cp -r #{upstream}/exe/bundle* ./libexec` - `cp #{upstream}/bundler.gemspec ./lib/bundler` - `cp -r #{upstream}/spec spec/bundler` - `cp -r #{upstream}/man/*.{1,5,1\.txt,5\.txt,ronn} ./man` + FileUtils.cp_r(Dir.glob("#{upstream}/lib/bundler*"), "lib") + FileUtils.cp_r(Dir.glob("#{upstream}/exe/bundle*"), "libexec") + FileUtils.cp_r("#{upstream}/bundler.gemspec", "lib/bundler") + FileUtils.cp_r("#{upstream}/spec", "spec/bundler") + FileUtils.cp_r(Dir.glob("#{upstream}/man/*.{1,5,1\.txt,5\.txt,ronn}"), "man") FileUtils.rm_rf(%w[spec/bundler/support/artifice/vcr_cassettes]) when "rdoc" FileUtils.rm_rf(%w[lib/rdoc* test/rdoc libexec/rdoc libexec/ri]) - `cp -rf #{upstream}/lib/rdoc* ./lib` - `cp -rf #{upstream}/test test/rdoc` - `cp #{upstream}/rdoc.gemspec ./lib/rdoc` - `cp -rf #{upstream}/exe/rdoc ./libexec` - `cp -rf #{upstream}/exe/ri ./libexec` + FileUtils.cp_r(Dir.glob("#{upstream}/lib/rdoc*"), "lib") + FileUtils.cp_r("#{upstream}/test", "test/rdoc") + FileUtils.cp_r("#{upstream}/rdoc.gemspec", "lib/rdoc") + FileUtils.cp_r("#{upstream}/exe/rdoc", "libexec") + FileUtils.cp_r("#{upstream}/exe/ri", "libexec") FileUtils.rm_rf(%w[lib/rdoc/markdown.kpeg lib/rdoc/markdown/literals.kpeg lib/rdoc/rd/block_parser.ry lib/rdoc/rd/inline_parser.ry]) `git checkout lib/rdoc/.document` when "reline" FileUtils.rm_rf(%w[lib/reline* test/reline]) - `cp -rf #{upstream}/lib/reline* ./lib` - `cp -rf #{upstream}/test test/reline` - `cp #{upstream}/reline.gemspec ./lib/reline` + FileUtils.cp_r(Dir.glob("#{upstream}/lib/reline*"), "lib") + FileUtils.cp_r("#{upstream}/test", "test/reline") + FileUtils.cp_r("#{upstream}/reline.gemspec", "lib/reline") when "json" FileUtils.rm_rf(%w[ext/json test/json]) - `cp -rf #{upstream}/ext/json/ext ext/json` - `cp -rf #{upstream}/tests test/json` - `cp -rf #{upstream}/lib ext/json` + FileUtils.cp_r("#{upstream}/ext/json/ext", "ext/json") + FileUtils.cp_r("#{upstream}/tests", "test/json") + FileUtils.cp_r("#{upstream}/lib", "ext/json") FileUtils.rm_rf(%[ext/json/lib/json/pure*]) - `cp #{upstream}/json.gemspec ext/json` + FileUtils.cp_r("#{upstream}/json.gemspec", "ext/json") FileUtils.rm_rf(%w[ext/json/lib/json/ext]) `git checkout ext/json/extconf.rb ext/json/parser/prereq.mk ext/json/generator/depend ext/json/parser/depend` when "psych" FileUtils.rm_rf(%w[ext/psych test/psych]) - `cp -rf #{upstream}/ext/psych ./ext` - `cp -rf #{upstream}/lib ./ext/psych` - `cp -rf #{upstream}/test/psych ./test` + FileUtils.cp_r("#{upstream}/ext/psych", "ext") + FileUtils.cp_r("#{upstream}/lib", "ext/psych") + FileUtils.cp_r("#{upstream}/test/psych", "test") FileUtils.rm_rf(%w[ext/psych/lib/org ext/psych/lib/psych.jar ext/psych/lib/psych_jars.rb]) FileUtils.rm_rf(%w[ext/psych/lib/psych.{bundle,so} ext/psych/lib/2.*]) FileUtils.rm_rf(["ext/psych/yaml/LICENSE"]) - `cp #{upstream}/psych.gemspec ext/psych/` + FileUtils.cp_r("#{upstream}/psych.gemspec", "ext/psych") `git checkout ext/psych/depend` when "fiddle" FileUtils.rm_rf(%w[ext/fiddle test/fiddle]) - `cp -rf #{upstream}/ext/fiddle ext` - `cp -rf #{upstream}/lib ext/fiddle` - `cp -rf #{upstream}/test/fiddle test` - `cp -f #{upstream}/fiddle.gemspec ext/fiddle` + FileUtils.cp_r("#{upstream}/ext/fiddle", "ext") + FileUtils.cp_r("#{upstream}/lib", "ext/fiddle") + FileUtils.cp_r("#{upstream}/test/fiddle", "test") + FileUtils.cp_r("#{upstream}/fiddle.gemspec", "ext/fiddle") `git checkout ext/fiddle/depend` FileUtils.rm_rf(%w[ext/fiddle/lib/fiddle.{bundle,so}]) when "stringio" FileUtils.rm_rf(%w[ext/stringio test/stringio]) - `cp -rf #{upstream}/ext/stringio ext` - `cp -rf #{upstream}/test/stringio test` - `cp -f #{upstream}/stringio.gemspec ext/stringio` + FileUtils.cp_r("#{upstream}/ext/stringio", "ext") + FileUtils.cp_r("#{upstream}/test/stringio", "test") + FileUtils.cp_r("#{upstream}/stringio.gemspec", "ext/stringio") `git checkout ext/stringio/depend ext/stringio/README.md` when "ioconsole" FileUtils.rm_rf(%w[ext/io/console test/io/console]) - `cp -rf #{upstream}/ext/io/console ext/io` - `cp -rf #{upstream}/test/io/console test/io` + FileUtils.cp_r("#{upstream}/ext/io/console", "ext/io") + FileUtils.cp_r("#{upstream}/test/io/console", "test/io") `mkdir -p ext/io/console/lib` - `cp -rf #{upstream}/lib/io/console ext/io/console/lib` - `cp -f #{upstream}/io-console.gemspec ext/io/console` + FileUtils.cp_r("#{upstream}/lib/io/console", "ext/io/console/lib") + FileUtils.cp_r("#{upstream}/io-console.gemspec", "ext/io/console") `git checkout ext/io/console/depend` when "dbm" FileUtils.rm_rf(%w[ext/dbm test/dbm]) - `cp -rf #{upstream}/ext/dbm ext` - `cp -rf #{upstream}/test/dbm test` - `cp -f #{upstream}/dbm.gemspec ext/dbm` + FileUtils.cp_r("#{upstream}/ext/dbm", "ext") + FileUtils.cp_r("#{upstream}/test/dbm", "test") + FileUtils.cp_r("#{upstream}/dbm.gemspec", "ext/dbm") `git checkout ext/dbm/depend` when "gdbm" FileUtils.rm_rf(%w[ext/gdbm test/gdbm]) - `cp -rf #{upstream}/ext/gdbm ext` - `cp -rf #{upstream}/test/gdbm test` - `cp -f #{upstream}/gdbm.gemspec ext/gdbm` + FileUtils.cp_r("#{upstream}/ext/gdbm", "ext") + FileUtils.cp_r("#{upstream}/test/gdbm", "test") + FileUtils.cp_r("#{upstream}/gdbm.gemspec", "ext/gdbm") `git checkout ext/gdbm/depend ext/gdbm/README` when "sdbm" FileUtils.rm_rf(%w[ext/sdbm test/sdbm]) - `cp -rf #{upstream}/ext/sdbm ext` - `cp -rf #{upstream}/test/sdbm test` - `cp -f #{upstream}/sdbm.gemspec ext/sdbm` + FileUtils.cp_r("#{upstream}/ext/sdbm", "ext") + FileUtils.cp_r("#{upstream}/test/sdbm", "test") + FileUtils.cp_r("#{upstream}/sdbm.gemspec", "ext/sdbm") `git checkout ext/sdbm/depend` when "etc" FileUtils.rm_rf(%w[ext/etc test/etc]) - `cp -rf #{upstream}/ext/etc ext` - `cp -rf #{upstream}/test/etc test` - `cp -f #{upstream}/etc.gemspec ext/etc` + FileUtils.cp_r("#{upstream}/ext/etc", "ext") + FileUtils.cp_r("#{upstream}/test/etc", "test") + FileUtils.cp_r("#{upstream}/etc.gemspec", "ext/etc") `git checkout ext/etc/depend` when "date" FileUtils.rm_rf(%w[ext/date test/date]) - `cp -rf #{upstream}/ext/date ext` - `cp -rf #{upstream}/lib ext/date` - `cp -rf #{upstream}/test/date test` - `cp -f #{upstream}/date.gemspec ext/date` + FileUtils.cp_r("#{upstream}/ext/date", "ext") + FileUtils.cp_r("#{upstream}/lib", "ext/date") + FileUtils.cp_r("#{upstream}/test/date", "test") + FileUtils.cp_r("#{upstream}/date.gemspec", "ext/date") `git checkout ext/date/depend` FileUtils.rm_rf(["ext/date/lib/date_core.bundle"]) when "zlib" FileUtils.rm_rf(%w[ext/zlib test/zlib]) - `cp -rf #{upstream}/ext/zlib ext` - `cp -rf #{upstream}/test/zlib test` - `cp -f #{upstream}/zlib.gemspec ext/zlib` + FileUtils.cp_r("#{upstream}/ext/zlib", "ext") + FileUtils.cp_r("#{upstream}/test/zlib", "test") + FileUtils.cp_r("#{upstream}/zlib.gemspec", "ext/zlib") `git checkout ext/zlib/depend` when "fcntl" FileUtils.rm_rf(%w[ext/fcntl]) - `cp -rf #{upstream}/ext/fcntl ext` - `cp -f #{upstream}/fcntl.gemspec ext/fcntl` + FileUtils.cp_r("#{upstream}/ext/fcntl", "ext") + FileUtils.cp_r("#{upstream}/fcntl.gemspec", "ext/fcntl") `git checkout ext/fcntl/depend` when "thwait" FileUtils.rm_rf(%w[lib/thwait*]) - `cp -rf #{upstream}/lib/* lib` - `cp -rf #{upstream}/thwait.gemspec lib/thwait` + FileUtils.cp_r(Dir.glob("#{upstream}/lib/*"), "lib") + FileUtils.cp_r("#{upstream}/thwait.gemspec", "lib/thwait") when "e2mmap" FileUtils.rm_rf(%w[lib/e2mmap*]) - `cp -rf #{upstream}/lib/* lib` - `cp -rf #{upstream}/e2mmap.gemspec lib` + FileUtils.cp_r(Dir.glob("#{upstream}/lib/*"), "lib") + FileUtils.cp_r("#{upstream}/e2mmap.gemspec", "lib") when "strscan" FileUtils.rm_rf(%w[ext/strscan test/strscan]) - `cp -rf #{upstream}/ext/strscan ext` - `cp -rf #{upstream}/test/strscan test` - `cp -f #{upstream}/strscan.gemspec ext/strscan` + FileUtils.cp_r("#{upstream}/ext/strscan", "ext") + FileUtils.cp_r("#{upstream}/test/strscan", "test") + FileUtils.cp_r("#{upstream}/strscan.gemspec", "ext/strscan") FileUtils.rm_rf(%w["ext/strscan/regenc.h ext/strscan/regint.h"]) `git checkout ext/strscan/depend` when "racc" FileUtils.rm_rf(%w[lib/racc* ext/racc test/racc]) - `cp -rf #{upstream}/lib/racc* lib` + FileUtils.cp_r(Dir.glob("#{upstream}/lib/racc*"), "lib") `mkdir -p ext/racc/cparse` - `cp -rf #{upstream}/ext/racc/cparse/* ext/racc/cparse` - `cp -rf #{upstream}/test test/racc` + FileUtils.cp_r(Dir.glob("#{upstream}/ext/racc/cparse/*"), "ext/racc/cparse") + FileUtils.cp_r("#{upstream}/test", "test/racc") `git checkout ext/racc/cparse/README` when "rexml", "rss", "matrix", "irb", "csv", "shell", "logger", "ostruct", "scanf", "webrick", "fileutils", "forwardable", "prime", "tracer", "ipaddr", "cmath", "mutex_m", "sync" sync_lib gem @@ -232,19 +232,19 @@ def sync_lib(repo) abort "Expected '../#{repo}' (#{File.expand_path("../#{repo}")}) to be a directory, but it wasn't." end FileUtils.rm_rf(["lib/#{repo}.rb", "lib/#{repo}/*", "test/test_#{repo}.rb"]) - `cp -rf ../#{repo}/lib/* lib` + FileUtils.cp_r(Dir.glob("../#{repo}/lib/*"), "lib") tests = if File.directory?("test/#{repo}") "test/#{repo}" else "test/test_#{repo}.rb" end - `cp -rf ../#{repo}/#{tests} test` + FileUtils.cp_r("../#{repo}/#{tests}", "test") gemspec = if File.directory?("lib/#{repo}") "lib/#{repo}/#{repo}.gemspec" else "lib/#{repo}.gemspec" end - `cp -f ../#{repo}/#{repo}.gemspec #{gemspec}` + FileUtils.cp_r("../#{repo}/#{repo}.gemspec", "#{gemspec}") end def update_default_gems(gem) -- cgit v1.2.3