summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-25 10:16:28 (GMT)
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-25 10:16:28 (GMT)
commita509de06bc9c0a308d14547b4d5560bbf6895b9d (patch)
treecf5e09688e9daf1630b417c3b3e36c7095a27516 /tool
parent2160c4dead7949ea429b3c38e95102e229573d00 (diff)
Added initialization task for default gems.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rw-r--r--tool/sync_default_gems.rb39
1 files changed, 30 insertions, 9 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index f22b8a6..72cb3b1 100644
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -76,12 +76,6 @@ $repositories = {
}
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
@@ -218,8 +212,35 @@ def sync_lib(repo)
`cp -f ../#{repo}/#{repo}.gemspec #{gemspec}`
end
-if ARGV[0]
- sync_default_gems(ARGV[0])
-else
+def update_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
+
+ Dir.chdir("../../#{author}/#{repository}") do
+ unless `git remote`.match(/ruby\-core/)
+ `git remote add ruby-core git@github.com:ruby/ruby.git`
+ `git fetch ruby-core`
+ `git co ruby-core/trunk`
+ `git branch ruby-core`
+ end
+ `git co ruby-core`
+ `git fetch ruby-core trunk`
+ `git rebase ruby-core/trunk`
+ `git co master`
+ `git stash`
+ `git pull --rebase`
+ end
+end
+
+case ARGV[0]
+when "up"
+ $repositories.keys.each{|gem| update_default_gems(gem.to_s)}
+when "all"
$repositories.keys.each{|gem| sync_default_gems(gem.to_s)}
+else
+ sync_default_gems(ARGV[0])
end