ruby-changes:53150
From: hsbt <ko1@a...>
Date: Thu, 25 Oct 2018 19:16:34 +0900 (JST)
Subject: [ruby-changes:53150] hsbt:r65364 (trunk): Added initialization task for default gems.
hsbt 2018-10-25 19:16:28 +0900 (Thu, 25 Oct 2018) New Revision: 65364 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65364 Log: Added initialization task for default gems. Modified files: trunk/tool/sync_default_gems.rb Index: tool/sync_default_gems.rb =================================================================== --- tool/sync_default_gems.rb (revision 65363) +++ tool/sync_default_gems.rb (revision 65364) @@ -76,12 +76,6 @@ $repositories = { https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L76 } def sync_default_gems(gem) - author, repository = $repositories[gem.to_sym].split('/') - unless File.exist?("../../#{author}/#{repository}") - `mkdir -p ../../#{author}` - `git clone git@g...:#{author}/#{repository}.git ../../#{author}/#{repository}` - end - puts "Sync #{$repositories[gem.to_sym]}" case gem @@ -218,8 +212,35 @@ def sync_lib(repo) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L212 `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@g...:#{author}/#{repository}.git ../../#{author}/#{repository}` + end + + Dir.chdir("../../#{author}/#{repository}") do + unless `git remote`.match(/ruby\-core/) + `git remote add ruby-core git@g...: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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/