summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-27 13:22:22 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-28 17:40:54 +0100
commitf10dbf56ebb5eec6f721a75c1e05f6d6edf89546 (patch)
tree76a6e757173e2f2dcdebfedcd4b8cd12292c5657
parent83cb83670f658610ee35886b565f376e6683188a (diff)
downloadbundler-f10dbf56ebb5eec6f721a75c1e05f6d6edf89546.tar.gz
Make "co" tasks family use RGV env variable too
-rw-r--r--Rakefile9
-rwxr-xr-xbin/with_rubygems23
2 files changed, 17 insertions, 15 deletions
diff --git a/Rakefile b/Rakefile
index 41d2aedd44..55557077f4 100644
--- a/Rakefile
+++ b/Rakefile
@@ -119,7 +119,6 @@ namespace :spec do
# RubyGems specs by version
namespace :rubygems do
- rubyopt = ENV["RUBYOPT"]
# When editing this list, also edit .travis.yml!
branches = %w[master]
releases = %w[v2.5.2 v2.6.14 v2.7.9 v3.0.3]
@@ -143,7 +142,7 @@ namespace :spec do
task "rubygems:all" => rg
end
- desc "Run specs under a RubyGems checkout (set RG=path)"
+ desc "Run specs under a RubyGems checkout (set RGV=path)"
task "co" do
sh("bin/rspec --format progress")
end
@@ -154,9 +153,7 @@ namespace :spec do
end
task "setup_co" do
- rg = File.expand_path ENV["RG"]
- puts "Running specs against RubyGems in #{rg}..."
- ENV["RUBYOPT"] = "-I#{rg} #{rubyopt}"
+ ENV["RGV"] = RUBYGEMS_REPO
end
task "co" => "setup_co"
@@ -167,6 +164,8 @@ namespace :spec do
task :travis do
rg = ENV["RGV"] || raise("RubyGems version is required on Travis!")
+ rg = "co" if File.directory?(File.expand_path(ENV["RGV"]))
+
# disallow making network requests on CI
ENV["BUNDLER_SPEC_PRE_RECORDED"] = "TRUE"
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"]})