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.
This commit is contained in:
parent
4963dd6b64
commit
00439dbdb4
@ -81,13 +81,13 @@ module SyncDefaultGems
|
|||||||
yaml: "ruby/yaml",
|
yaml: "ruby/yaml",
|
||||||
yarp: ["ruby/yarp", "main"],
|
yarp: ["ruby/yarp", "main"],
|
||||||
zlib: 'ruby/zlib',
|
zlib: 'ruby/zlib',
|
||||||
}
|
}.transform_keys {|k| k.to_s}
|
||||||
|
|
||||||
CLASSICAL_DEFAULT_BRANCH = "master"
|
CLASSICAL_DEFAULT_BRANCH = "master"
|
||||||
|
|
||||||
class << REPOSITORIES
|
class << REPOSITORIES
|
||||||
def [](gem)
|
def [](gem)
|
||||||
repo, branch = super
|
repo, branch = super(gem)
|
||||||
return repo, branch || CLASSICAL_DEFAULT_BRANCH
|
return repo, branch || CLASSICAL_DEFAULT_BRANCH
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ module SyncDefaultGems
|
|||||||
|
|
||||||
# We usually don't use this. Please consider using #sync_default_gems_with_commits instead.
|
# We usually don't use this. Please consider using #sync_default_gems_with_commits instead.
|
||||||
def sync_default_gems(gem)
|
def sync_default_gems(gem)
|
||||||
repo, = REPOSITORIES[gem.to_sym]
|
repo, = REPOSITORIES[gem]
|
||||||
puts "Sync #{repo}"
|
puts "Sync #{repo}"
|
||||||
|
|
||||||
upstream = File.join("..", "..", 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 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.
|
# @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)
|
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."
|
puts "Sync #{repo} with commit history."
|
||||||
|
|
||||||
# Fetch the repository to be synchronized
|
# Fetch the repository to be synchronized
|
||||||
@ -740,7 +740,7 @@ module SyncDefaultGems
|
|||||||
|
|
||||||
def update_default_gems(gem, release: false)
|
def update_default_gems(gem, release: false)
|
||||||
|
|
||||||
repository, default_branch = REPOSITORIES[gem.to_sym]
|
repository, default_branch = REPOSITORIES[gem]
|
||||||
author, repository = repository.split('/')
|
author, repository = repository.split('/')
|
||||||
|
|
||||||
puts "Update #{author}/#{repository}"
|
puts "Update #{author}/#{repository}"
|
||||||
@ -778,16 +778,16 @@ module SyncDefaultGems
|
|||||||
if ARGV[1]
|
if ARGV[1]
|
||||||
update_default_gems(ARGV[1])
|
update_default_gems(ARGV[1])
|
||||||
else
|
else
|
||||||
REPOSITORIES.each_key {|gem| update_default_gems(gem.to_s)}
|
REPOSITORIES.each_key {|gem| update_default_gems(gem)}
|
||||||
end
|
end
|
||||||
when "all"
|
when "all"
|
||||||
if ARGV[1] == "release"
|
if ARGV[1] == "release"
|
||||||
REPOSITORIES.each_key do |gem|
|
REPOSITORIES.each_key do |gem|
|
||||||
update_default_gems(gem.to_s, release: true)
|
update_default_gems(gem, release: true)
|
||||||
sync_default_gems(gem.to_s)
|
sync_default_gems(gem)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
REPOSITORIES.each_key {|gem| sync_default_gems(gem.to_s)}
|
REPOSITORIES.each_key {|gem| sync_default_gems(gem)}
|
||||||
end
|
end
|
||||||
when "list"
|
when "list"
|
||||||
ARGV.shift
|
ARGV.shift
|
||||||
|
@ -87,7 +87,7 @@ module Test_SyncDefaultGems
|
|||||||
system(*%W"git config --global user.name", "Ruby")
|
system(*%W"git config --global user.name", "Ruby")
|
||||||
system(*%W"git config --global init.defaultBranch default")
|
system(*%W"git config --global init.defaultBranch default")
|
||||||
@target = "sync-test"
|
@target = "sync-test"
|
||||||
SyncDefaultGems::REPOSITORIES[@target.to_sym] = ["ruby/#{@target}", "default"]
|
SyncDefaultGems::REPOSITORIES[@target] = ["ruby/#{@target}", "default"]
|
||||||
@sha = {}
|
@sha = {}
|
||||||
@origdir = Dir.pwd
|
@origdir = Dir.pwd
|
||||||
Dir.chdir(@testdir)
|
Dir.chdir(@testdir)
|
||||||
@ -113,7 +113,7 @@ module Test_SyncDefaultGems
|
|||||||
def teardown
|
def teardown
|
||||||
if @target
|
if @target
|
||||||
Dir.chdir(@origdir)
|
Dir.chdir(@origdir)
|
||||||
SyncDefaultGems::REPOSITORIES.delete(@target.to_sym)
|
SyncDefaultGems::REPOSITORIES.delete(@target)
|
||||||
ENV.update(@git_config)
|
ENV.update(@git_config)
|
||||||
FileUtils.rm_rf(@testdir)
|
FileUtils.rm_rf(@testdir)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user