summaryrefslogtreecommitdiff
path: root/tool/fetch-bundled_gems.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-24 12:40:34 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-24 12:40:34 +0900
commitf8401732dea7b22c849cefc722d7d7f41f2ddd1b (patch)
tree7ed8c5e5cc1b3168ade194657bf273c0931609ac /tool/fetch-bundled_gems.rb
parent116b9e6a16c72276e92578b761846d05eaa3eff6 (diff)
downloadruby-f8401732dea7b22c849cefc722d7d7f41f2ddd1b.tar.gz
Try with and without "v" prefix for numeric tag
Diffstat (limited to 'tool/fetch-bundled_gems.rb')
-rwxr-xr-xtool/fetch-bundled_gems.rb15
1 files changed, 3 insertions, 12 deletions
diff --git a/tool/fetch-bundled_gems.rb b/tool/fetch-bundled_gems.rb
index 5769a19b37..28ae3d4327 100755
--- a/tool/fetch-bundled_gems.rb
+++ b/tool/fetch-bundled_gems.rb
@@ -9,25 +9,16 @@ BEGIN {
}
n, v, u = $F
-case n
-when "test-unit"
-else
- v = "v" + v
-end
if File.directory?(n)
puts "updating #{n} ..."
- if v == "master"
- system(*%W"git pull", chdir: n) or abort
- else
- system(*%W"git fetch", chdir: n) or abort
- end
+ system("git", (v == "master" ? "pull" : "fetch"), chdir: n) or abort
else
puts "retrieving #{n} ..."
system(*%W"git clone #{u} #{n}") or abort
end
-unless system(*%W"git checkout #{v}", chdir: n)
- unless v.sub!(/\Av/, '') and system(*%W"git checkout #{v}", chdir: n)
+unless system(*%W"git checkout #{v.sub(/\A(?=\d)/, 'v')}", chdir: n)
+ unless /\A\d/ =~ v and system(*%W"git checkout #{v}", chdir: n)
abort
end
end