avm-tools 0.33.1 → 0.34.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/avm/git/issue/complete.rb +3 -2
- data/lib/avm/git/issue/complete/_local_branch.rb +1 -4
- data/lib/avm/git/issue/complete/_validations.rb +24 -6
- data/lib/avm/git/issue/complete/_working_tree.rb +14 -0
- data/lib/avm/tools/runner/git/issue/complete.rb +20 -5
- data/lib/avm/tools/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc93a50b713fa65d2893cb05c7a38feab44295c625011c6597d5aeaaf866ccf9
|
4
|
+
data.tar.gz: 67ab9170e9c7e780bf839d0bdb1d5ebe4edb91e2d46b08af22a46c5bfb2c93c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6f5008949bde37c4f319aea45a7676b7acc314408154fabe3ace835206dd44f988cd6593e6b571291898bc659fcd013f3d43e49807f9046233f5c028f4894d6
|
7
|
+
data.tar.gz: d9db915b89d71139af123feab08e08e3a4743a866d3895c9fbedb5b61def92e64d0509c9e7bb7fffbc56f76fdf7239087ef26810d7b80cd6155513d25ea75a82
|
@@ -14,11 +14,12 @@ module Avm
|
|
14
14
|
include ::EacRubyUtils::SimpleCache
|
15
15
|
include ::EacRubyUtils::Console::Speaker
|
16
16
|
|
17
|
-
attr_reader :
|
17
|
+
attr_reader :skip_validations
|
18
18
|
|
19
19
|
def initialize(options)
|
20
20
|
consumer = ::EacRubyUtils::OptionsConsumer.new(options)
|
21
|
-
dir, @
|
21
|
+
dir, @skip_validations = consumer.consume_all(:dir, :skip_validations)
|
22
|
+
validate_skip_validations
|
22
23
|
consumer.validate
|
23
24
|
@git = ::EacLauncher::Git::Base.new(dir)
|
24
25
|
end
|
@@ -1,34 +1,52 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'avm/result'
|
4
|
+
require 'ostruct'
|
4
5
|
|
5
6
|
module Avm
|
6
7
|
module Git
|
7
8
|
module Issue
|
8
9
|
class Complete
|
9
10
|
VALIDATIONS = {
|
11
|
+
clean_workspace: 'Clean workspace?',
|
10
12
|
branch_name: 'Branch name',
|
11
13
|
branch_hash: 'Branch hash',
|
12
14
|
follow_master: 'Follow master?',
|
13
15
|
commits: 'Commits?',
|
14
16
|
bifurcations: 'Bifurcations?',
|
15
17
|
dry_push: 'Dry push?'
|
16
|
-
}.freeze
|
18
|
+
}.with_indifferent_access.freeze
|
17
19
|
|
18
20
|
def valid?
|
19
|
-
validations.
|
21
|
+
validations.map(&:result).none?(&:error?)
|
20
22
|
end
|
21
23
|
|
22
24
|
def validations_banner
|
23
|
-
validations.each do |
|
24
|
-
infov label, result.label
|
25
|
+
validations.each do |v|
|
26
|
+
infov "[#{v.key}] #{v.label}", v.result.label
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
30
|
def validations
|
29
31
|
VALIDATIONS.map do |key, label|
|
30
|
-
|
31
|
-
end
|
32
|
+
::OpenStruct.new(key: key, label: label, result: validation_result(key))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def validation_result(key)
|
37
|
+
if skip_validations.include?(key)
|
38
|
+
::Avm::Result.neutral('skipped')
|
39
|
+
else
|
40
|
+
send("#{key}_result")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def validate_skip_validations
|
45
|
+
skip_validations.each do |validation|
|
46
|
+
next if VALIDATIONS.keys.include?(validation)
|
47
|
+
|
48
|
+
raise "\"#{validation}\" is not a registered validation"
|
49
|
+
end
|
32
50
|
end
|
33
51
|
end
|
34
52
|
end
|
@@ -20,9 +20,13 @@ module Avm
|
|
20
20
|
__PROGRAM__ -h | --help
|
21
21
|
|
22
22
|
Options:
|
23
|
-
-h --help
|
24
|
-
-
|
25
|
-
|
23
|
+
-h --help Show this screen.
|
24
|
+
-s --skip-validations=<validations> Does not validate conditions on <validations>
|
25
|
+
(Comma separated value).
|
26
|
+
-y --yes Does not ask for user confirmation.
|
27
|
+
|
28
|
+
Validations:
|
29
|
+
%%VALIDATIONS%%
|
26
30
|
DOCOPT
|
27
31
|
|
28
32
|
def run
|
@@ -32,15 +36,26 @@ module Avm
|
|
32
36
|
complete.run if confirm?
|
33
37
|
end
|
34
38
|
|
39
|
+
def doc
|
40
|
+
DOC.gsub('%%VALIDATIONS%%', doc_validations_list)
|
41
|
+
end
|
42
|
+
|
35
43
|
private
|
36
44
|
|
37
45
|
def confirm?
|
38
46
|
options.fetch('--yes') || request_input('Confirm issue completion?', bool: true)
|
39
47
|
end
|
40
48
|
|
49
|
+
def skip_validations
|
50
|
+
options.fetch('--skip-validations').to_s.split(',').map(&:strip).reject(&:blank?)
|
51
|
+
end
|
52
|
+
|
41
53
|
def git_complete_issue_options
|
42
|
-
{ dir: context(:repository_path),
|
43
|
-
|
54
|
+
{ dir: context(:repository_path), skip_validations: skip_validations }
|
55
|
+
end
|
56
|
+
|
57
|
+
def doc_validations_list
|
58
|
+
::Avm::Git::Issue::Complete::VALIDATIONS.keys.map { |k| " * #{k}" }.join("\n")
|
44
59
|
end
|
45
60
|
end
|
46
61
|
end
|
data/lib/avm/tools/version.rb
CHANGED
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.
|
4
|
+
version: 0.34.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-02-
|
11
|
+
date: 2020-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha-parsers
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- lib/avm/git/issue/complete/_remote.rb
|
211
211
|
- lib/avm/git/issue/complete/_tracker.rb
|
212
212
|
- lib/avm/git/issue/complete/_validations.rb
|
213
|
+
- lib/avm/git/issue/complete/_working_tree.rb
|
213
214
|
- lib/avm/git/revision_test.rb
|
214
215
|
- lib/avm/git/spec_helper.rb
|
215
216
|
- lib/avm/instances.rb
|