File: Rakefile

package info (click to toggle)
ruby-parallel-tests 5.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 760 kB
  • sloc: ruby: 5,446; javascript: 16; makefile: 4
file content (44 lines) | stat: -rw-r--r-- 1,051 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true
require 'bundler/setup'
require 'bump/tasks'
require 'bundler/gem_tasks'

# update all versions so bundling does not fail on CI
Bump.replace_in_default = Dir["spec/fixtures/rails*/Gemfile.lock"]

task default: [:spec, :rubocop]

task :spec do
  sh "rspec spec/"
end

desc "Run rubocop"
task :rubocop do
  sh "rubocop --parallel"
end

desc "bundle all gemfiles [EXTRA=]"
task :bundle_all do
  extra = ENV["EXTRA"] || "install"

  gemfiles = (["Gemfile"] + Dir["spec/fixtures/rails*/Gemfile"])
  raise if gemfiles.size < 3

  gemfiles.each do |gemfile|
    Bundler.with_unbundled_env do
      sh "GEMFILE=#{gemfile} bundle #{extra}"
    end
  end
end

desc "render the README option section"
task :readme do
  output = `bundle exec ./bin/parallel_test -h`
  abort "Command failed: #{output}" unless $?.success?
  output.sub!(/.*Options are:/m, "") || raise
  file = "README.md"
  separator = "<!-- rake readme -->"
  parts = File.read(file).split(separator)
  parts[1] = output
  File.write file, parts.join(separator)
end