diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-26 10:31:50 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-28 17:52:50 +0900 |
commit | 00439dbdb4909f0c78b37f6ed1e3f88c4cb05d46 (patch) | |
tree | 7af55956e51c1617f47662451fe56a30c1dd812c /tool | |
parent | 4963dd6b6432549b4685e31bf52b218a728cf50c (diff) |
sync_default_gems.rb: convert keys of REPOSITORIES to strings
Referencing always after conversion to a symbol, and yielded gem name
is always converted to a string.
Diffstat (limited to 'tool')
-rwxr-xr-x | tool/sync_default_gems.rb | 18 | ||||
-rwxr-xr-x | tool/test/test_sync_default_gems.rb | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 83a2c4cbaa..ad52c3faff 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -81,13 +81,13 @@ module SyncDefaultGems yaml: "ruby/yaml", yarp: ["ruby/yarp", "main"], zlib: 'ruby/zlib', - } + }.transform_keys {|k| k.to_s} CLASSICAL_DEFAULT_BRANCH = "master" class << REPOSITORIES def [](gem) - repo, branch = super + repo, branch = super(gem) return repo, branch || CLASSICAL_DEFAULT_BRANCH end @@ -131,7 +131,7 @@ module SyncDefaultGems # We usually don't use this. Please consider using #sync_default_gems_with_commits instead. def sync_default_gems(gem) - repo, = REPOSITORIES[gem.to_sym] + repo, = REPOSITORIES[gem] puts "Sync #{repo}" upstream = File.join("..", "..", repo) @@ -497,7 +497,7 @@ module SyncDefaultGems # @param ranges [Array<String>] "before..after". Note that it will NOT sync "before" (but commits after that). # @param edit [TrueClass] Set true if you want to resolve conflicts. Obviously, update-default-gem.sh doesn't use this. def sync_default_gems_with_commits(gem, ranges, edit: nil) - repo, default_branch = REPOSITORIES[gem.to_sym] + repo, default_branch = REPOSITORIES[gem] puts "Sync #{repo} with commit history." # Fetch the repository to be synchronized @@ -740,7 +740,7 @@ module SyncDefaultGems def update_default_gems(gem, release: false) - repository, default_branch = REPOSITORIES[gem.to_sym] + repository, default_branch = REPOSITORIES[gem] author, repository = repository.split('/') puts "Update #{author}/#{repository}" @@ -778,16 +778,16 @@ module SyncDefaultGems if ARGV[1] update_default_gems(ARGV[1]) else - REPOSITORIES.each_key {|gem| update_default_gems(gem.to_s)} + REPOSITORIES.each_key {|gem| update_default_gems(gem)} end when "all" if ARGV[1] == "release" REPOSITORIES.each_key do |gem| - update_default_gems(gem.to_s, release: true) - sync_default_gems(gem.to_s) + update_default_gems(gem, release: true) + sync_default_gems(gem) end else - REPOSITORIES.each_key {|gem| sync_default_gems(gem.to_s)} + REPOSITORIES.each_key {|gem| sync_default_gems(gem)} end when "list" ARGV.shift diff --git a/tool/test/test_sync_default_gems.rb b/tool/test/test_sync_default_gems.rb index e6c654ed55..a73fc65d6e 100755 --- a/tool/test/test_sync_default_gems.rb +++ b/tool/test/test_sync_default_gems.rb @@ -87,7 +87,7 @@ module Test_SyncDefaultGems system(*%W"git config --global user.name", "Ruby") system(*%W"git config --global init.defaultBranch default") @target = "sync-test" - SyncDefaultGems::REPOSITORIES[@target.to_sym] = ["ruby/#{@target}", "default"] + SyncDefaultGems::REPOSITORIES[@target] = ["ruby/#{@target}", "default"] @sha = {} @origdir = Dir.pwd Dir.chdir(@testdir) @@ -113,7 +113,7 @@ module Test_SyncDefaultGems def teardown if @target Dir.chdir(@origdir) - SyncDefaultGems::REPOSITORIES.delete(@target.to_sym) + SyncDefaultGems::REPOSITORIES.delete(@target) ENV.update(@git_config) FileUtils.rm_rf(@testdir) end |