avm-tools 0.111.0 → 0.112.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: 92cca12d352dd32dfdea41ec9d555dbee08eca04c83f7785ed3891a14499a0ed
4
- data.tar.gz: ffbdc42cbaf9eeef401fc04527143c8dc08ee7fded3dd787566603cb27c2a20c
3
+ metadata.gz: 9b66b870dd3773fc0d1b9f01af2b1071c16dd477b97f11fdf97f2635bebadf8c
4
+ data.tar.gz: 1c7d80182eee3d3d144e324c4d189e1252d7b47284f03cc8404d3b01793159c8
5
5
  SHA512:
6
- metadata.gz: 11f618d14612790471d6cbae508a06f86af552fbc89e3f8fe5ab4d430fd6192fe664d9d227ffabc2112e51909d5acb5d8bb306ca8a84f0d2b53fcb7dadcf698d
7
- data.tar.gz: ff821cba12ac826179060f31a3da4780247d07cdaaca31466a211dbb34388274ff2cec72c75355b2d7885971d95f1ad526da9acff4c5a2374fa0f1e18286acf9
6
+ metadata.gz: 6fc387867645488cfa6be38135087ff5ff9cd9b8785b6c09d38562faecc0e3c995d0415d36f70c1ff61765c0f3ea094f9007af3a9a4434c70d242a47e1ad852c
7
+ data.tar.gz: 64cd91c8f706d397354e1900028dc504863c6dedc7182da287d864e19e6ab00caf52e0754867d9c393001dd5486e80db5451e63440fe5db359152302a816cd44
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/tools/core_ext'
4
+ require 'avm/sources/tests/builder'
4
5
 
5
6
  module Avm
6
7
  module Tools
@@ -9,20 +10,81 @@ module Avm
9
10
  class Test
10
11
  runner_with :help do
11
12
  desc 'Test local project.'
13
+ bool_opt '-a', '--all', 'Same as "--self --subs".'
14
+ bool_opt '-f', '--fail-fast', 'Abort after first failure.'
15
+ bool_opt '-m', '--main', 'Test main source.'
16
+ bool_opt '-s', '--subs', 'Test subs\' sources.'
17
+ pos_arg :source_id, repeat: true, optional: true
12
18
  end
13
19
 
14
20
  def run
15
- runner_context.call(:instance_banner)
16
- infov 'Test command', test_command
17
- if test_command.present?
18
- test_command.system!
21
+ reset_tested_units
22
+ start_banner
23
+ show_units_results
24
+ final_result
25
+ end
26
+
27
+ private
28
+
29
+ attr_accessor :tested_units
30
+
31
+ def failed_units
32
+ tested_units.select(&:failed?)
33
+ end
34
+
35
+ def final_result
36
+ if failed_units.any?
37
+ failed_units.each do |unit|
38
+ infov ' * Source', unit
39
+ info unit.logs.truncate_all
40
+ end
41
+ fatal_error 'Some test did not pass'
19
42
  else
20
- fatal_error 'No test command found'
43
+ success 'None test failed'
21
44
  end
22
45
  end
23
46
 
24
- def test_command
25
- runner_context.call(:instance).configuration.if_present(&:any_test_command)
47
+ def include_main?
48
+ parsed.main? || parsed.all?
49
+ end
50
+
51
+ def include_subs?
52
+ parsed.subs? || parsed.all?
53
+ end
54
+
55
+ def reset_tested_units
56
+ self.tested_units = []
57
+ end
58
+
59
+ def show_units_results
60
+ test_performer.units.each do |unit|
61
+ infov unit, unit_result(unit)
62
+ tested_units << unit
63
+ break if unit.failed? && parsed.fail_fast?
64
+ end
65
+ end
66
+
67
+ def start_banner
68
+ runner_context.call(:instance_banner)
69
+ infov 'Selected units', test_performer.units.count
70
+ end
71
+
72
+ def test_builder
73
+ r = ::Avm::Sources::Tests::Builder.new(runner_context.call(:subject))
74
+ .include_main(include_main?)
75
+ .include_subs(include_subs?)
76
+ parsed.source_id.inject(r) { |a, e| a.include_id(e) }
77
+ end
78
+
79
+ def test_performer_uncached
80
+ test_builder.performer
81
+ end
82
+
83
+ def unit_result(unit)
84
+ (
85
+ [unit.result.to_label] +
86
+ %i[stdout stderr].map { |label| "#{label.to_s.upcase}: #{unit.logs[label]}" }
87
+ ).join(' | '.blue)
26
88
  end
27
89
  end
28
90
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.111.0'
5
+ VERSION = '0.112.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.111.0
4
+ version: 0.112.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-12 00:00:00.000000000 Z
11
+ date: 2021-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: '0.9'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.1'
40
+ version: '0.9'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: avm-eac_asciidoctor_base0
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -254,7 +254,6 @@ files:
254
254
  - Gemfile
255
255
  - exe/avm
256
256
  - lib/avm.rb
257
- - lib/avm/data.rb
258
257
  - lib/avm/eac_rails_base0.rb
259
258
  - lib/avm/eac_rails_base0/apache_host.rb
260
259
  - lib/avm/eac_rails_base0/apache_path.rb
data/lib/avm/data.rb DELETED
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
5
-
6
- module Avm
7
- module Data
8
- end
9
- end