summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-03 02:13:59 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-03 02:13:59 +0000
commit4680341cac51669a6a2ab79df87df5db8286153d (patch)
treeea5c86936f0978246022e79302d6388e8abb2fda
parent0ff27c4604c76382767b929818d0c428aa74e9f1 (diff)
Added sync to all of default gems command.
* Fix command of FileUtils sync operation. test/fileutils is a directory. * When not given gem name option, do sync all of gems. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--tool/sync_default_gems.rb268
1 files changed, 139 insertions, 129 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index da378234ab..169fd83dba 100644
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -22,7 +22,7 @@
# * https://github.com/ruby/strscan
#
-repositories = {
+$repositories = {
rubygems: 'rubygems/rubygems',
rdoc: 'rdoc/rdoc',
json: 'flori/json',
@@ -44,135 +44,145 @@ repositories = {
strscan: 'ruby/strscan',
}
-author, repository = repositories[ARGV[0].to_sym].split('/')
-unless File.exist?("../../#{author}/#{repository}")
- `mkdir -p ../../#{author}`
- `git clone git@github.com:#{author}/#{repository}.git ../../#{author}/#{repository}`
+def sync_default_gems(gem)
+ author, repository = $repositories[gem.to_sym].split('/')
+ unless File.exist?("../../#{author}/#{repository}")
+ `mkdir -p ../../#{author}`
+ `git clone git@github.com:#{author}/#{repository}.git ../../#{author}/#{repository}`
+ end
+
+ puts "Sync #{$repositories[gem.to_sym]}"
+
+ case gem
+ when "rubygems"
+ `rm -rf lib/rubygems* lib/ubygems.rb test/rubygems`
+ `cp -r ../../rubygems/rubygems/lib/rubygems* ./lib`
+ `cp -r ../../rubygems/rubygems/lib/ubygems.rb ./lib`
+ `cp -r ../../rubygems/rubygems/test/rubygems ./test`
+ `cp ../../rubygems/rubygems/LICENSE.txt ./lib/rubygems`
+ when "rdoc"
+ `rm -rf lib/rdoc* test/rdoc`
+ `cp -rf ../../rdoc/rdoc/lib/rdoc* ./lib`
+ `cp -rf ../../rdoc/rdoc/test test/rdoc`
+ `cp ../../rdoc/rdoc/rdoc.gemspec ./lib/rdoc`
+ `rm -f lib/rdoc/markdown.kpeg lib/rdoc/markdown/literals.kpeg lib/rdoc/rd/block_parser.ry lib/rdoc/rd/inline_parser.ry`
+ when "json"
+ `rm -rf ext/json test/json`
+ `cp -rf ../../flori/json/ext/json/ext ext/json`
+ `cp -rf ../../flori/json/tests test/json`
+ `cp -rf ../../flori/json/lib ext/json`
+ `rm -rf ext/json/lib/json/pure*`
+ `cp ../../flori/json/json.gemspec ext/json`
+ `rm -r 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"
+ `rm -rf ext/psych test/psych`
+ `cp -rf ../psych/ext/psych ./ext`
+ `cp -rf ../psych/lib ./ext/psych`
+ `cp -rf ../psych/test/psych ./test`
+ `rm -rf ext/psych/lib/psych.bundle ext/psych/lib/org ext/psych/lib/psych.jar ext/psych/lib/psych_jars.rb`
+ `cp ../psych/psych.gemspec ext/psych/`
+ when "fileutils"
+ `rm -rf lib/fileutils.rb test/fileutils lib/fileutils.gemspec`
+ `cp -rf ../fileutils/lib/* lib`
+ `cp -rf ../fileutils/test/fileutils test`
+ `cp -f ../fileutils/fileutils.gemspec lib`
+ when "fiddle"
+ `rm -rf ext/fiddle test/fiddle`
+ `cp -rf ../fiddle/ext/fiddle ext`
+ `cp -rf ../fiddle/lib ext/fiddle`
+ `cp -rf ../fiddle/test/fiddle test`
+ `cp -f ../fiddle/fiddle.gemspec ext/fiddle`
+ `git checkout ext/fiddle/depend`
+ when "stringio"
+ `rm -rf ext/stringio test/stringio`
+ `cp -rf ../stringio/ext/stringio ext`
+ `cp -rf ../stringio/test/stringio test`
+ `cp -f ../stringio/stringio.gemspec ext/stringio`
+ `git checkout ext/stringio/depend ext/stringio/README.md`
+ when "ioconsole"
+ `rm -rf ext/io/console test/io/console`
+ `cp -rf ../io-console/ext/io/console ext/io`
+ `cp -rf ../io-console/test/io/console test/io`
+ `mkdir -p ext/io/console/lib`
+ `cp -rf ../io-console/lib/console ext/io/console/lib`
+ `cp -f ../io-console/io-console.gemspec ext/io/console`
+ `git checkout ext/io/console/depend`
+ when "csv"
+ `rm -rf lib/csv.rb test/csv lib/csv.gemspec`
+ `cp -rf ../csv/lib/* lib`
+ `cp -rf ../csv/test/csv test`
+ `cp -f ../csv/csv.gemspec lib`
+ when "webrick"
+ `rm -rf lib/webrick test/webrick`
+ `cp -rf ../webrick/lib/webrick lib`
+ `cp -rf ../webrick/test/webrick test`
+ `cp -f ../webrick/webrick.gemspec lib/webrick`
+ when "dbm"
+ `rm -rf ext/dbm test/dbm`
+ `cp -rf ../dbm/ext/dbm ext`
+ `cp -rf ../dbm/test/dbm test`
+ `cp -f ../dbm/dbm.gemspec ext/dbm`
+ `git checkout ext/dbm/depend`
+ when "gdbm"
+ `rm -rf ext/gdbm test/gdbm`
+ `cp -rf ../gdbm/ext/gdbm ext`
+ `cp -rf ../gdbm/test/gdbm test`
+ `cp -f ../gdbm/gdbm.gemspec ext/gdbm`
+ `git checkout ext/gdbm/depend ext/gdbm/README`
+ when "sdbm"
+ `rm -rf ext/sdbm test/sdbm`
+ `cp -rf ../sdbm/ext/sdbm ext`
+ `cp -rf ../sdbm/test/sdbm test`
+ `cp -f ../sdbm/sdbm.gemspec ext/sdbm`
+ `git checkout ext/sdbm/depend`
+ when "etc"
+ `rm -rf ext/etc test/etc`
+ `cp -rf ../etc/ext/etc ext`
+ `cp -rf ../etc/test/etc test`
+ `cp -f ../etc/etc.gemspec ext/etc`
+ `git checkout ext/etc/depend`
+ when "date"
+ `rm -rf ext/date test/date`
+ `cp -rf ../date/ext/date ext`
+ `cp -rf ../date/lib ext/date`
+ `cp -rf ../date/test/date test`
+ `cp -f ../date/date.gemspec ext/date`
+ `git checkout ext/date/depend`
+ when "zlib"
+ `rm -rf ext/zlib test/zlib`
+ `cp -rf ../zlib/ext/zlib ext`
+ `cp -rf ../zlib/test/zlib test`
+ `cp -f ../zlib/zlib.gemspec ext/zlib`
+ `git checkout ext/zlib/depend`
+ when "fcntl"
+ `rm -rf ext/fcntl`
+ `cp -rf ../fcntl/ext/fcntl ext`
+ `cp -f ../fcntl/fcntl.gemspec ext/fcntl`
+ `git checkout ext/fcntl/depend`
+ when "scanf"
+ `rm -rf lib/scanf.rb test/scanf`
+ `cp -rf ../scanf/lib/* lib`
+ `cp -rf ../scanf/test/scanf test`
+ `cp -f ../scanf/scanf.gemspec lib`
+ when "cmath"
+ `rm -rf lib/cmath.rb test/test_cmath.rb`
+ `cp -rf ../cmath/lib/* lib`
+ `cp -rf ../cmath/test/test_cmath.rb test`
+ `cp -f ../cmath/cmath.gemspec lib`
+ when "strscan"
+ `rm -rf ext/strscan test/strscan`
+ `cp -rf ../strscan/ext/strscan ext`
+ `cp -rf ../strscan/test/strscan test`
+ `cp -f ../strscan/strscan.gemspec ext/strscan`
+ `rm -f ext/strscan/regenc.h ext/strscan/regint.h`
+ `git checkout ext/strscan/depend`
+ else
+ end
end
-case ARGV[0]
-when "rubygems"
- `rm -rf lib/rubygems* lib/ubygems.rb test/rubygems`
- `cp -r ../../rubygems/rubygems/lib/rubygems* ./lib`
- `cp -r ../../rubygems/rubygems/lib/ubygems.rb ./lib`
- `cp -r ../../rubygems/rubygems/test/rubygems ./test`
- `cp ../../rubygems/rubygems/LICENSE.txt ./lib/rubygems`
-when "rdoc"
- `rm -rf lib/rdoc* test/rdoc`
- `cp -rf ../../rdoc/rdoc/lib/rdoc* ./lib`
- `cp -rf ../../rdoc/rdoc/test test/rdoc`
- `cp ../../rdoc/rdoc/rdoc.gemspec ./lib/rdoc`
- `rm -f lib/rdoc/markdown.kpeg lib/rdoc/markdown/literals.kpeg lib/rdoc/rd/block_parser.ry lib/rdoc/rd/inline_parser.ry`
-when "json"
- `rm -rf ext/json test/json`
- `cp -rf ../../flori/json/ext/json/ext ext/json`
- `cp -rf ../../flori/json/tests test/json`
- `cp -rf ../../flori/json/lib ext/json`
- `rm -rf ext/json/lib/json/pure*`
- `cp ../../flori/json/json.gemspec ext/json`
- `rm -r 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"
- `rm -rf ext/psych test/psych`
- `cp -rf ../psych/ext/psych ./ext`
- `cp -rf ../psych/lib ./ext/psych`
- `cp -rf ../psych/test/psych ./test`
- `rm -rf ext/psych/lib/psych.bundle ext/psych/lib/org ext/psych/lib/psych.jar ext/psych/lib/psych_jars.rb`
- `cp ../psych/psych.gemspec ext/psych/`
-when "fileutils"
- `rm -f lib/fileutils.rb test/fileutils lib/fileutils.gemspec`
- `cp -rf ../fileutils/lib/* lib`
- `cp -rf ../fileutils/test/fileutils test`
- `cp -f ../fileutils/fileutils.gemspec lib`
-when "fiddle"
- `rm -rf ext/fiddle test/fiddle`
- `cp -rf ../fiddle/ext/fiddle ext`
- `cp -rf ../fiddle/lib ext/fiddle`
- `cp -rf ../fiddle/test/fiddle test`
- `cp -f ../fiddle/fiddle.gemspec ext/fiddle`
- `git checkout ext/fiddle/depend`
-when "stringio"
- `rm -rf ext/stringio test/stringio`
- `cp -rf ../stringio/ext/stringio ext`
- `cp -rf ../stringio/test/stringio test`
- `cp -f ../stringio/stringio.gemspec ext/stringio`
- `git checkout ext/stringio/depend ext/stringio/README.md`
-when "ioconsole"
- `rm -rf ext/io/console test/io/console`
- `cp -rf ../io-console/ext/io/console ext/io`
- `cp -rf ../io-console/test/io/console test/io`
- `mkdir -p ext/io/console/lib`
- `cp -rf ../io-console/lib/console ext/io/console/lib`
- `cp -f ../io-console/io-console.gemspec ext/io/console`
- `git checkout ext/io/console/depend`
-when "csv"
- `rm -rf lib/csv.rb test/csv lib/csv.gemspec`
- `cp -rf ../csv/lib/* lib`
- `cp -rf ../csv/test/csv test`
- `cp -f ../csv/csv.gemspec lib`
-when "webrick"
- `rm -rf lib/webrick test/webrick`
- `cp -rf ../webrick/lib/webrick lib`
- `cp -rf ../webrick/test/webrick test`
- `cp -f ../webrick/webrick.gemspec lib/webrick`
-when "dbm"
- `rm -rf ext/dbm test/dbm`
- `cp -rf ../dbm/ext/dbm ext`
- `cp -rf ../dbm/test/dbm test`
- `cp -f ../dbm/dbm.gemspec ext/dbm`
- `git checkout ext/dbm/depend`
-when "gdbm"
- `rm -rf ext/gdbm test/gdbm`
- `cp -rf ../gdbm/ext/gdbm ext`
- `cp -rf ../gdbm/test/gdbm test`
- `cp -f ../gdbm/gdbm.gemspec ext/gdbm`
- `git checkout ext/gdbm/depend ext/gdbm/README`
-when "sdbm"
- `rm -rf ext/sdbm test/sdbm`
- `cp -rf ../sdbm/ext/sdbm ext`
- `cp -rf ../sdbm/test/sdbm test`
- `cp -f ../sdbm/sdbm.gemspec ext/sdbm`
- `git checkout ext/sdbm/depend`
-when "etc"
- `rm -rf ext/etc test/etc`
- `cp -rf ../etc/ext/etc ext`
- `cp -rf ../etc/test/etc test`
- `cp -f ../etc/etc.gemspec ext/etc`
- `git checkout ext/etc/depend`
-when "date"
- `rm -rf ext/date test/date`
- `cp -rf ../date/ext/date ext`
- `cp -rf ../date/lib ext/date`
- `cp -rf ../date/test/date test`
- `cp -f ../date/date.gemspec ext/date`
- `git checkout ext/date/depend`
-when "zlib"
- `rm -rf ext/zlib test/zlib`
- `cp -rf ../zlib/ext/zlib ext`
- `cp -rf ../zlib/test/zlib test`
- `cp -f ../zlib/zlib.gemspec ext/zlib`
- `git checkout ext/zlib/depend`
-when "fcntl"
- `rm -rf ext/fcntl`
- `cp -rf ../fcntl/ext/fcntl ext`
- `cp -f ../fcntl/fcntl.gemspec ext/fcntl`
- `git checkout ext/fcntl/depend`
-when "scanf"
- `rm -rf lib/scanf.rb test/scanf`
- `cp -rf ../scanf/lib/* lib`
- `cp -rf ../scanf/test/scanf test`
- `cp -f ../scanf/scanf.gemspec lib`
-when "cmath"
- `rm -rf lib/cmath.rb test/test_cmath.rb`
- `cp -rf ../cmath/lib/* lib`
- `cp -rf ../cmath/test/test_cmath.rb test`
- `cp -f ../cmath/cmath.gemspec lib`
-when "strscan"
- `rm -rf ext/strscan test/strscan`
- `cp -rf ../strscan/ext/strscan ext`
- `cp -rf ../strscan/test/strscan test`
- `cp -f ../strscan/strscan.gemspec ext/strscan`
- `rm -f ext/strscan/regenc.h ext/strscan/regint.h`
- `git checkout ext/strscan/depend`
+if ARGV[0]
+ sync_default_gems(ARGV[0])
else
+ $repositories.keys.each{|gem| sync_default_gems(gem.to_s)}
end