summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-09-18 10:06:10 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-09-19 16:02:47 +0200
commit6a7da1cc9a59cd7e1399f28b5398f1223b89c56a (patch)
tree860abee10c2fd84f974fbf3b2d5bc2bc5105e679 /Rakefile
parent71b96f25ca2970364be15496cd29bccf230b56f9 (diff)
downloadbundler-6a7da1cc9a59cd7e1399f28b5398f1223b89c56a.tar.gz
Replace `with_rubygems` script
Instead, use a better rubygems version manager that makes sure that `ENV["RGV"]` usage is always applied, and its usage is centralized at a single place. This simplifies the rake task organization and makes it much simpler to run locally exactly what's run in CI. For example, since it doesn't rely on the `RGV` being deleted for subsequent subprocesses, it also running `bin/rake spec:travis` task locally which previously would lead to ``` rake aborted! RubyGems version is required on Travis! ``` It also reduces duplication making it so that we only need to change the `.travis.yml` file when updating tested rubies, and not the `Rakefile` as well.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile63
1 files changed, 5 insertions, 58 deletions
diff --git a/Rakefile b/Rakefile
index c41a6e9665..2935410628 100644
--- a/Rakefile
+++ b/Rakefile
@@ -85,80 +85,27 @@ namespace :spec do
ENV["BUNDLER_SUDO_TESTS"] = "1"
end
- # RubyGems specs by version
- namespace :rubygems do
- # When editing this list, also edit .travis.yml!
- branches = %w[master]
- releases = %w[v2.5.2 v2.6.14 v2.7.10 v3.0.6]
- (branches + releases).each do |rg|
- desc "Run specs with RubyGems #{rg}"
- task "parallel_#{rg}" do
- sh("bin/parallel_rspec spec/")
- end
-
- task rg do
- sh("bin/rspec --format progress")
- end
-
- # Create tasks like spec:rubygems:v1.8.3:sudo to run the sudo specs
- namespace rg do
- task :sudo => ["set_sudo", rg]
- task :realworld => ["set_realworld", rg]
- end
-
- task "set_#{rg}" do
- ENV["RGV"] = rg
- end
-
- task rg => ["set_#{rg}"]
- task "rubygems:all" => rg
- end
-
- desc "Run specs under a RubyGems checkout (set RGV=path)"
- task "co" do
- sh("bin/parallel_rspec spec/")
- end
-
- namespace "co" do
- task :sudo => ["set_sudo", "co"]
- task :realworld => ["set_realworld", "co"]
- end
-
- task "setup_co" do
- ENV["RGV"] = if `git -C "#{File.expand_path("..")}" remote --verbose 2> #{IO::NULL}` =~ /rubygems/i
- File.expand_path("..")
- else
- File.expand_path("tmp/rubygems")
- end
- end
-
- task "co" => "setup_co"
- task "rubygems:all" => "co"
- end
-
desc "Run the tests on Travis CI against a RubyGem version (using ENV['RGV'])"
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"
puts "\n\e[1;33m[Travis CI] Running bundler specs against RubyGems #{rg}\e[m\n\n"
- specs = safe_task { Rake::Task["spec:rubygems:#{rg}"].invoke }
+ specs = safe_task { Rake::Task["spec"].invoke }
- Rake::Task["spec:rubygems:#{rg}"].reenable
+ Rake::Task["spec"].reenable
puts "\n\e[1;33m[Travis CI] Running bundler sudo specs against RubyGems #{rg}\e[m\n\n"
- sudos = system("sudo -E rake spec:rubygems:#{rg}:sudo")
+ sudos = system("sudo -E rake spec:sudo")
# clean up by chowning the newly root-owned tmp directory back to the travis user
system("sudo chown -R #{ENV["USER"]} #{File.join(File.dirname(__FILE__), "tmp")}")
- Rake::Task["spec:rubygems:#{rg}"].reenable
+ Rake::Task["spec"].reenable
puts "\n\e[1;33m[Travis CI] Running bundler real world specs against RubyGems #{rg}\e[m\n\n"
- realworld = safe_task { Rake::Task["spec:rubygems:#{rg}:realworld"].invoke }
+ realworld = safe_task { Rake::Task["spec:realworld"].invoke }
{ "specs" => specs, "sudo" => sudos, "realworld" => realworld }.each do |name, passed|
if passed