eac_ruby_gems_utils 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/lib/eac_ruby_gems_utils/tests.rb +9 -0
- data/lib/eac_ruby_gems_utils/tests/base.rb +1 -1
- data/lib/eac_ruby_gems_utils/tests/minitest.rb +1 -1
- data/lib/eac_ruby_gems_utils/tests/multiple.rb +100 -0
- data/lib/eac_ruby_gems_utils/tests/rspec.rb +1 -1
- data/lib/eac_ruby_gems_utils/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72c347cbc4400da953c018b8081969f1efca483256fad6b60c141384f7fd9b72
|
4
|
+
data.tar.gz: 63da18372d768e40062eedf2e6ff4474c2569485b400a08bb3808ec1ed73351c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea7aa11db54e66ef34d3f80b14fd410fec3e236418010d123effba634d98fad1cfb50468ee6f9ecba242850aff4bb40d057f75be8d15d65ba60b1adc45e43c0f
|
7
|
+
data.tar.gz: 7e39826d5b2a3a7f6f496e41b7f2b6212536a0e0282c526e6c8d5be602c66385da24473b8473629782920663a619fb4fb9e2be4a1945bde5f2e1c24fd15e56ba
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_gems_utils/tests/minitest'
|
4
|
+
require 'eac_ruby_gems_utils/tests/rspec'
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
6
|
+
|
7
|
+
module EacRubyGemsUtils
|
8
|
+
module Tests
|
9
|
+
class Multiple
|
10
|
+
enable_console_speaker
|
11
|
+
enable_simple_cache
|
12
|
+
common_constructor :gems
|
13
|
+
set_callback :initialize, :after, :run
|
14
|
+
|
15
|
+
def ok?
|
16
|
+
failed_tests.none?
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def all_tests_uncached
|
22
|
+
decorated_gems.flat_map(&:tests)
|
23
|
+
end
|
24
|
+
|
25
|
+
def bundle_all_gems
|
26
|
+
infom 'Bundling all gems...'
|
27
|
+
decorated_gems.each do |gem|
|
28
|
+
next unless gem.gemfile_path.exist?
|
29
|
+
|
30
|
+
infov 'Bundle install', gem
|
31
|
+
gem.bundle.execute!
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def decorated_gems_uncached
|
36
|
+
gems.map { |gem| DecoratedGem.new(gem) }
|
37
|
+
end
|
38
|
+
|
39
|
+
def failed_tests_uncached
|
40
|
+
all_tests.select { |r| r.result == ::EacRubyGemsUtils::Tests::Base::RESULT_FAILED }
|
41
|
+
end
|
42
|
+
|
43
|
+
def final_results_banner
|
44
|
+
if failed_tests.any?
|
45
|
+
warn 'Some test did not pass:'
|
46
|
+
failed_tests.each do |test|
|
47
|
+
infov ' * Test', test
|
48
|
+
infov ' * STDOUT', test.stdout_cache.content_path
|
49
|
+
infov ' * STDERR', test.stderr_cache.content_path
|
50
|
+
end
|
51
|
+
else
|
52
|
+
success 'All tests passed'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def run
|
57
|
+
start_banner
|
58
|
+
bundle_all_gems
|
59
|
+
test_all_gems
|
60
|
+
final_results_banner
|
61
|
+
end
|
62
|
+
|
63
|
+
def start_banner
|
64
|
+
infov 'Gems to test', decorated_gems.count
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_all_gems
|
68
|
+
infom 'Running tests...'
|
69
|
+
all_tests.each do |test|
|
70
|
+
infov test, Result.new(test.result).tag
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
class DecoratedGem < ::SimpleDelegator
|
75
|
+
def tests
|
76
|
+
[::EacRubyGemsUtils::Tests::Minitest.new(__getobj__),
|
77
|
+
::EacRubyGemsUtils::Tests::Rspec.new(__getobj__)]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class Result
|
82
|
+
common_constructor :result
|
83
|
+
|
84
|
+
COLORS = {
|
85
|
+
::EacRubyGemsUtils::Tests::Base::RESULT_FAILED => :red,
|
86
|
+
::EacRubyGemsUtils::Tests::Base::RESULT_NONEXISTENT => :white,
|
87
|
+
::EacRubyGemsUtils::Tests::Base::RESULT_SUCCESSFUL => :green
|
88
|
+
}.freeze
|
89
|
+
|
90
|
+
def tag
|
91
|
+
result.to_s.send(color)
|
92
|
+
end
|
93
|
+
|
94
|
+
def color
|
95
|
+
COLORS.fetch(result)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_ruby_gems_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_ruby_utils
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.20'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.20'
|
27
27
|
description:
|
28
28
|
email:
|
29
29
|
executables: []
|
@@ -33,8 +33,10 @@ files:
|
|
33
33
|
- README.rdoc
|
34
34
|
- lib/eac_ruby_gems_utils.rb
|
35
35
|
- lib/eac_ruby_gems_utils/gem.rb
|
36
|
+
- lib/eac_ruby_gems_utils/tests.rb
|
36
37
|
- lib/eac_ruby_gems_utils/tests/base.rb
|
37
38
|
- lib/eac_ruby_gems_utils/tests/minitest.rb
|
39
|
+
- lib/eac_ruby_gems_utils/tests/multiple.rb
|
38
40
|
- lib/eac_ruby_gems_utils/tests/rspec.rb
|
39
41
|
- lib/eac_ruby_gems_utils/version.rb
|
40
42
|
homepage:
|