eac_ruby_gems_utils 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0830253271f8c28f89bd1bbc8a05ffc93fa026386ea791e8447c59694a6de8a7'
4
- data.tar.gz: a26a28cad0b5807a4ff25b8339e3f71a579d598dc1c2b0fd562035bd47ec3aaa
3
+ metadata.gz: 72c347cbc4400da953c018b8081969f1efca483256fad6b60c141384f7fd9b72
4
+ data.tar.gz: 63da18372d768e40062eedf2e6ff4474c2569485b400a08bb3808ec1ed73351c
5
5
  SHA512:
6
- metadata.gz: 58e8acf493436867fc6f5aad058308c4622d78bd774c6a2ec920d794390ea63bc064930b9cae7e586652d16d6c1d16c3b28acec248d1ffcd0c5a8ec08bdf31db
7
- data.tar.gz: 5e22feaa46ae1e2119490975e1a59dac53e9879e32183aef5d028d983e16f5ddd55640eb516e1549d886e3e80c616f44a2c492af5c704c073cb5cdaa751061b0
6
+ metadata.gz: ea7aa11db54e66ef34d3f80b14fd410fec3e236418010d123effba634d98fad1cfb50468ee6f9ecba242850aff4bb40d057f75be8d15d65ba60b1adc45e43c0f
7
+ data.tar.gz: 7e39826d5b2a3a7f6f496e41b7f2b6212536a0e0282c526e6c8d5be602c66385da24473b8473629782920663a619fb4fb9e2be4a1945bde5f2e1c24fd15e56ba
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EacRubyGemsUtils
6
+ module Tests
7
+ require_sub(__FILE__)
8
+ end
9
+ end
@@ -5,7 +5,7 @@ require 'eac_ruby_utils/fs_cache'
5
5
  require 'eac_ruby_utils/listable'
6
6
  require 'eac_ruby_utils/on_clean_ruby_environment'
7
7
 
8
- module EacRubyUtils
8
+ module EacRubyGemsUtils
9
9
  module Tests
10
10
  class Base
11
11
  include ::EacRubyUtils::Listable
@@ -4,7 +4,7 @@ require 'eac_ruby_gems_utils/tests/base'
4
4
 
5
5
  module EacRubyGemsUtils
6
6
  module Tests
7
- class Minitest < ::EacRubyGemsUtils::Minitest
7
+ class Minitest < ::EacRubyGemsUtils::Tests::Base
8
8
  def bundle_exec_args
9
9
  %w[rake test]
10
10
  end
@@ -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
@@ -4,7 +4,7 @@ require 'eac_ruby_gems_utils/tests/base'
4
4
 
5
5
  module EacRubyGemsUtils
6
6
  module Tests
7
- class Rspec < ::EacRubyUtils::Gem::Test
7
+ class Rspec < ::EacRubyGemsUtils::Tests::Base
8
8
  def bundle_exec_args
9
9
  %w[rspec]
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module EacRubyGemsUtils
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  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.1.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-27 00:00:00.000000000 Z
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'
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.19'
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: