avm-tools 0.48.0 → 0.49.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: 7ebefeec62ed2a18b49480f8da27d9582ab7c4bf6f71e19d0c2c2a82a7ec87ec
4
- data.tar.gz: 1616f697714aecc0ea58b6695a8d7672b79e384c352a9e0ec1ece91daf88667c
3
+ metadata.gz: c4de0474ea4576b01ebad7cc61770d10f4be52e95820681eed2918d0d9faaab9
4
+ data.tar.gz: 7f849db68edcbe9d6070a814698c69011a73e33940b086c96476509cbd85bff8
5
5
  SHA512:
6
- metadata.gz: 17fbb28c4bdaf19ca33c1db1cb3f0d9678dd476f5804f972c19fff2e0ab0aae151568b2e82ce46a6da6b524682de4df11b0d231606d61ce0a1fe67c089490262
7
- data.tar.gz: 8fda39f66fb0d7e2108245b33e76d7f7053223572b0571534f57cdc5f1632ddd595b1f0a510bfc453a61286f2fee2b5fc3e8d786ce9f587bd16a6334e1f84833
6
+ metadata.gz: b35a21622b980f23e8a578277fac9204465543e431b3cd530f6d18d4d224bf811709ecbf61777a96fb0c84820491d0a72d7d020af7f07792ed579ceb5e84320e
7
+ data.tar.gz: 5360f604e835e82cb18cd8e97224c33d563df588b78a46a9f82ede674828caae31898d41459051f015dae44fdd43bda06b929adca4405f055053ff983774f13b
@@ -2,16 +2,20 @@
2
2
 
3
3
  require 'avm/instances/configuration'
4
4
  require 'avm/result'
5
+ require 'eac_ruby_utils/fs/temp'
5
6
 
6
7
  module Avm
7
8
  module Git
8
9
  module Issue
9
10
  class Complete
10
11
  def test_result
11
- test_command = configuration.if_present(&:test_command)
12
+ test_command = configuration.if_present(&:any_test_command)
12
13
  return ::Avm::Result.success('unconfigured') unless test_command.present?
13
14
 
14
- if test_command.execute[:exit_code].zero?
15
+ infom "Running test command \"#{test_command}\"..."
16
+ result = test_command.execute
17
+ test_result_log(result)
18
+ if result.fetch(:exit_code).zero?
15
19
  ::Avm::Result.success('yes')
16
20
  else
17
21
  ::Avm::Result.error('no')
@@ -20,6 +24,16 @@ module Avm
20
24
 
21
25
  private
22
26
 
27
+ def test_result_log(result)
28
+ stdout_file = ::EacRubyUtils::Fs::Temp.file
29
+ stderr_file = ::EacRubyUtils::Fs::Temp.file
30
+ stdout_file.write(result.fetch(:stdout))
31
+ stderr_file.write(result.fetch(:stderr))
32
+ infov ' * Exit code', result.fetch(:exit_code)
33
+ infov ' * STDOUT', stdout_file.to_path
34
+ infov ' * STDERR', stderr_file.to_path
35
+ end
36
+
23
37
  def configuration_uncached
24
38
  ::Avm::Instances::Configuration.find_by_path(@git)
25
39
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/git/issue/complete/validation'
3
4
  require 'avm/result'
4
5
  require 'ostruct'
5
6
 
@@ -28,20 +29,6 @@ module Avm
28
29
  end
29
30
  end
30
31
 
31
- def validations
32
- VALIDATIONS.map do |key, label|
33
- ::OpenStruct.new(key: key, label: label, result: validation_result(key))
34
- end
35
- end
36
-
37
- def validation_result(key)
38
- if skip_validations.include?(key)
39
- ::Avm::Result.neutral('skipped')
40
- else
41
- send("#{key}_result")
42
- end
43
- end
44
-
45
32
  def validate_skip_validations
46
33
  skip_validations.each do |validation|
47
34
  next if VALIDATIONS.keys.include?(validation)
@@ -49,6 +36,14 @@ module Avm
49
36
  raise "\"#{validation}\" is not a registered validation"
50
37
  end
51
38
  end
39
+
40
+ private
41
+
42
+ def validations_uncached
43
+ VALIDATIONS.map do |key, label|
44
+ ::Avm::Git::Issue::Complete::Validation.new(self, key, label)
45
+ end
46
+ end
52
47
  end
53
48
  end
54
49
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/result'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Git
8
+ module Issue
9
+ class Complete
10
+ class Validation
11
+ enable_simple_cache
12
+ common_constructor :parent, :key, :label
13
+
14
+ def skip?
15
+ parent.skip_validations.include?(key)
16
+ end
17
+
18
+ private
19
+
20
+ def result_uncached
21
+ if skip?
22
+ ::Avm::Result.neutral('skipped')
23
+ else
24
+ parent.send("#{key}_result")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,13 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_ruby_gems_utils/gem'
4
+
3
5
  module Avm
4
6
  module Instances
5
7
  class Configuration < ::EacRubyUtils::Configs
8
+ BUNDLE_TEST_COMMAND_KEY = 'test.bundle_command'
6
9
  TEST_COMMAND_KEY = 'test.command'
7
10
 
11
+ def any_test_command
12
+ bundle_test_command || test_command
13
+ end
14
+
8
15
  def test_command
9
16
  read_command(TEST_COMMAND_KEY)
10
17
  end
18
+
19
+ def bundle_test_command
20
+ read_entry(BUNDLE_TEST_COMMAND_KEY).if_present do |v|
21
+ args = v.is_a?(::Enumerable) ? v.map(&:to_s) : ::Shellwords.split(v)
22
+ ::EacRubyGemsUtils::Gem.new(::File.dirname(storage_path)).bundle(*args).chdir_root
23
+ end
24
+ end
11
25
  end
12
26
  end
13
27
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.48.0'
5
+ VERSION = '0.49.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.48.0
4
+ version: 0.49.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: 2020-05-18 00:00:00.000000000 Z
11
+ date: 2020-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -126,20 +126,14 @@ dependencies:
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: '0.32'
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: 0.32.1
129
+ version: '0.35'
133
130
  type: :runtime
134
131
  prerelease: false
135
132
  version_requirements: !ruby/object:Gem::Requirement
136
133
  requirements:
137
134
  - - "~>"
138
135
  - !ruby/object:Gem::Version
139
- version: '0.32'
140
- - - ">="
141
- - !ruby/object:Gem::Version
142
- version: 0.32.1
136
+ version: '0.35'
143
137
  - !ruby/object:Gem::Dependency
144
138
  name: filesize
145
139
  requirement: !ruby/object:Gem::Requirement
@@ -280,6 +274,7 @@ files:
280
274
  - lib/avm/git/issue/complete/_tracker.rb
281
275
  - lib/avm/git/issue/complete/_validations.rb
282
276
  - lib/avm/git/issue/complete/_working_tree.rb
277
+ - lib/avm/git/issue/complete/validation.rb
283
278
  - lib/avm/git/revision_test.rb
284
279
  - lib/avm/git/spec_helper.rb
285
280
  - lib/avm/instances.rb