summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 f22b8a6503..72cb3b16f9 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