summaryrefslogtreecommitdiff
path: root/tool/lib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-02-21 20:30:08 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-02-22 02:07:59 +0900
commit289080e4d86c70f8231a74a78892b2db65a86e9a (patch)
treee46529c82bb4778930a156b23477a578e7cc1d4c /tool/lib
parent241c4cfdd47c3f5df0738bb636d3f3954101de49 (diff)
downloadruby-289080e4d86c70f8231a74a78892b2db65a86e9a.tar.gz
Clone and create dummy gemspec in sequential build
Diffstat (limited to 'tool/lib')
-rw-r--r--tool/lib/bundled_gem.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/tool/lib/bundled_gem.rb b/tool/lib/bundled_gem.rb
index a08124b679..81549acbdf 100644
--- a/tool/lib/bundled_gem.rb
+++ b/tool/lib/bundled_gem.rb
@@ -83,4 +83,15 @@ module BundledGem
File.write(gemfile, spec.to_ruby)
end
end
+
+ def checkout(gemdir, repo, rev, git: $git)
+ return unless rev
+ unless File.exist?("#{gemdir}/.git")
+ puts "Cloning #{repo}"
+ system("#{git} clone #{repo} #{gemdir}") or raise
+ end
+ puts "Update #{File.basename(gemdir)} to #{rev}"
+ system("#{git} fetch origin #{rev}", chdir: gemdir)
+ system("#{git} checkout --detach #{rev}", chdir: gemdir)
+ end
end