diff options
-rw-r--r-- | Rakefile | 9 | ||||
-rwxr-xr-x | bin/with_rubygems | 23 |
2 files changed, 17 insertions, 15 deletions
@@ -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"]}) |