diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/with_rubygems | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/with_rubygems b/bin/with_rubygems index f835316d67..59365e40ce 100755 --- a/bin/with_rubygems +++ b/bin/with_rubygems @@ -2,24 +2,26 @@ # frozen_string_literal: true require "pathname" +require_relative "../spec/support/helpers" -def run(cmd) - return if system(cmd, :out => IO::NULL) - raise "Running `#{cmd}` failed" +class RubygemsVersionManager + include Spec::Helpers end +rubygems_version_manager = RubygemsVersionManager.new + version = ENV.delete("RGV") rubygems_path = Pathname.new(version).expand_path unless rubygems_path.directory? rubygems_path = Pathname.new("tmp/rubygems").expand_path unless rubygems_path.directory? rubygems_path.parent.mkpath - run("git clone https://github.com/rubygems/rubygems.git #{rubygems_path}") + rubygems_version_manager.sys_exec!("git clone https://github.com/rubygems/rubygems.git #{rubygems_path}") end Dir.chdir(rubygems_path) do - run("git remote update") + rubygems_version_manager.sys_exec!("git remote update") version = "v#{version}" if version =~ /\A\d/ - run("git checkout #{version} --quiet") + rubygems_version_manager.sys_exec!("git checkout #{version} --quiet") end end |