diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-03-27 13:22:22 +0100 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-03-28 17:40:54 +0100 |
commit | f10dbf56ebb5eec6f721a75c1e05f6d6edf89546 (patch) | |
tree | 76a6e757173e2f2dcdebfedcd4b8cd12292c5657 /bin | |
parent | 83cb83670f658610ee35886b565f376e6683188a (diff) | |
download | bundler-f10dbf56ebb5eec6f721a75c1e05f6d6edf89546.tar.gz |
Make "co" tasks family use RGV env variable too
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/with_rubygems | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/bin/with_rubygems b/bin/with_rubygems index 614e2beb42..72edc1c928 100755 --- a/bin/with_rubygems +++ b/bin/with_rubygems @@ -9,18 +9,21 @@ def run(*cmd) end version = ENV.delete("RGV") -rubygems_path = Pathname.new("tmp/rubygems").expand_path +rubygems_path = Pathname.new(version).expand_path unless rubygems_path.directory? - rubygems_path.parent.mkpath unless rubygems_path.directory? - run("git", "clone", "https://github.com/rubygems/rubygems.git", rubygems_path.to_s) + rubygems_path = Pathname.new("tmp/rubygems").expand_path + unless rubygems_path.directory? + rubygems_path.parent.mkpath unless rubygems_path.directory? + run("git", "clone", "https://github.com/rubygems/rubygems.git", rubygems_path.to_s) + end + Dir.chdir(rubygems_path) do + run("git remote update") + version = "v#{version}" if version =~ /\A\d/ + run("git", "checkout", version, "--quiet") + hash = `git rev-parse HEAD`.chomp + puts "Checked out rubygems '#{version}' at #{hash}" + end end -Dir.chdir(rubygems_path) do - run("git remote update") - version = "v#{version}" if version =~ /\A\d/ - run("git", "checkout", version, "--quiet") - hash = `git rev-parse HEAD`.chomp - puts "Checked out rubygems '#{version}' at #{hash}" -end if version rubygems_lib = rubygems_path + "lib" ENV["RUBYOPT"] = %(-I#{rubygems_lib} #{ENV["RUBYOPT"]}) |