yast-rake 0.2.23 → 0.2.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/tasks/test_unit.rake +41 -19
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21462d119c8a35afda622d16ccf4c3431bd8893c3d9bf175c4aa4e1276c71582
4
- data.tar.gz: 7b48079004e2c7711a0758cf885ff227856446ebcf493da180b32962dfc9ae1a
3
+ metadata.gz: 8758e3fbdf6fe89445ab8ad1f44499a5f768eb79607a19bbb17a59e0c70644d3
4
+ data.tar.gz: 8437a6b3c4564ef99bddc6f372ff181dc798aafde2474357f9926f81e60b3c5b
5
5
  SHA512:
6
- metadata.gz: c842c7ef8e558b53082563e28268527c47021e8ec870a597e60cce5a235edb0c4f87202923798035e87e52383f286a1207e9b089d97067497c8a4ff62f7e193d
7
- data.tar.gz: 4b7e1c4efdd71cea18d41ea1f4767913a577f0410ff16d5ad7a5755b4ba9dd8c837b9ec27ed44f3dd1605386b7d83c36a6367443409608874f4e130362681706
6
+ metadata.gz: 872170f3ad82a09f91cc6b523b59fd088b803f45f9fbdb6c4f3edc33a27ad2aeaf86f465e39ef9a64f4d82291993cf9437b7a2f1e4ad4337135e30feb0966063
7
+ data.tar.gz: 43f81719151b782420793d9924941c967508472d5b5d7d293564acb1a36eab57a1bda27c3b986dfddf0a7809d0557bdf8b32823c678c629be654b551462bb8f2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.23
1
+ 0.2.24
@@ -12,32 +12,54 @@
12
12
  # details.
13
13
  #++
14
14
 
15
+ # defines $CHILD_STATUS
16
+ require "English"
17
+
18
+ def parallel_rspec_installed?
19
+ system("which parallel_rspec &> /dev/null")
20
+ end
21
+
22
+ def parallel_tests_wanted?
23
+ (File.exist?(".rspec_parallel") && ENV["PARALLEL_TESTS"] != "0") ||
24
+ ENV["PARALLEL_TESTS"] == "1"
25
+ end
26
+
27
+ def run_parallel_tests(files)
28
+ # pass custom parameters to parallel_rspec if needed,
29
+ # e.g. the number of CPUs to use
30
+ sh("parallel_rspec --verbose #{ENV["PARALLEL_TESTS_OPTIONS"]} '#{files}'")
31
+
32
+ # use coveralls for on-line code coverage reporting at Travis CI, it needs
33
+ # to be called only once, after *all* parallel tests have been finished
34
+ if ENV["COVERAGE"] && ENV["TRAVIS"] && File.exist?(".coveralls.yml")
35
+ require "coveralls/rake/task"
36
+ Coveralls::RakeTask.new
37
+ Rake::Task["coveralls:push"].invoke
38
+ end
39
+ end
40
+
41
+ def run_sequential_tests(files)
42
+ sh("rspec --color --format doc '#{files}'")
43
+ # with standard RSpec the code coverage is usually configured in the
44
+ # test helper and is already sent at this point, no special handling
45
+ # is required
46
+ end
47
+
15
48
  namespace :test do
16
49
  desc "Runs unit tests."
17
50
  task "unit" do
18
51
  files = Dir["**/test/**/*_{spec,test}.rb"].join("' '")
19
52
  next if files.empty?
20
53
 
21
- # use parallel_tests if configured, allow changing it via environment
22
- if (File.exist?(".rspec_parallel") && ENV["PARALLEL_TESTS"] != "0") ||
23
- ENV["PARALLEL_TESTS"] == "1"
24
-
25
- # pass custom parameters to parallel_rspec if needed,
26
- # e.g. the number of CPUs to use
27
- sh "parallel_rspec --verbose #{ENV["PARALLEL_TESTS_OPTIONS"]} '#{files}'"
28
-
29
- # use coveralls for on-line code coverage reporting at Travis CI, it needs
30
- # to be called only once, after *all* parallel tests have been finished
31
- if ENV["COVERAGE"] && ENV["TRAVIS"] && File.exist?(".coveralls.yml")
32
- require "coveralls/rake/task"
33
- Coveralls::RakeTask.new
34
- Rake::Task["coveralls:push"].invoke
35
- end
54
+ # use parallel_tests if wanted and available
55
+ if parallel_tests_wanted? && parallel_rspec_installed?
56
+ run_parallel_tests(files)
36
57
  else
37
- sh "rspec --color --format doc '#{files}'"
38
- # with standard RSpec the code coverage is usually configured in the
39
- # test helper and is already sent at this point, no special handling
40
- # is required
58
+ if parallel_tests_wanted?
59
+ $stderr.puts "WARNING: parallel tests enabled, but 'parallel_rspec' is" \
60
+ " not installed, falling back to the standard 'rspec' runner."
61
+ end
62
+ run_sequential_tests(files)
41
63
  end
42
64
  end
43
65
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yast-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.23
4
+ version: 0.2.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Reidinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-04 00:00:00.000000000 Z
11
+ date: 2018-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake