Class: NeetoCompliance::Base
- Inherits:
-
Object
- Object
- NeetoCompliance::Base
show all
- Defined in:
- lib/neeto_compliance/verifiers/base.rb
Direct Known Subclasses
AutoUpdatePrsWithLatestMasterVerifier, BumpVersionWithPrLabelVerifier, BundlerVersionVerifier, CircleciConfigVerifier, CommonGemfileVerifier, CommonInitializersVerifier, CypressConfigVerifier, CypressPluginsIndexVerifier, DockerFileDevVerifier, EnvironmentConfigVerifier, GemsVerifierBase, GitignoreFileVerifier, JsconfigVerifier, NeetoCommonsSyncVerifier, NewrelicVerifier, NodeVersionVerifier, PackageDependenciesVersionVerifier, PackageJsonVerifier, RolesVerifier, RubyVersionVerifier, SemaphoreciConfigVerifier, SidekiqQueuesVerifier, SimplecovConfigVerifier, SitemapConfigVerifier, SlugignoreFileVerifier, SyncNeetoCommonsVerifier, WebpackerConfigVerifier
Instance Method Summary
collapse
Instance Method Details
#app_is_exception? ⇒ Boolean
65
66
67
|
# File 'lib/neeto_compliance/verifiers/base.rb', line 65
def app_is_exception?
apps_exception_list.include?(app_name)
end
|
#app_name ⇒ Object
69
70
71
|
# File 'lib/neeto_compliance/verifiers/base.rb', line 69
def app_name
@_app_name ||= `git config --get remote.origin.url`.split("/").last.strip.split(".git").first
end
|
#apps_exception_list ⇒ Object
73
74
75
|
# File 'lib/neeto_compliance/verifiers/base.rb', line 73
def apps_exception_list
[]
end
|
#audit ⇒ Object
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/neeto_compliance/verifiers/base.rb', line 54
def audit
print_description
errors = []
unless valid?
errors << [error_message, autofix_suggestion, "\n"].join("\n")
end
[errors.length == 0, errors]
end
|
#auto_correct! ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/neeto_compliance/verifiers/base.rb', line 37
def auto_correct!
return true if app_is_exception?
unless valid?
puts autofix_command
system autofix_command
end
end
|
#autofix_suggestion ⇒ Object
46
47
48
|
# File 'lib/neeto_compliance/verifiers/base.rb', line 46
def autofix_suggestion
"To fix run: #{autofix_command.yellow}"
end
|
#error_message ⇒ Object
50
51
52
|
# File 'lib/neeto_compliance/verifiers/base.rb', line 50
def error_message
"[FAIL]".red
end
|
#print_description ⇒ Object
33
34
35
|
# File 'lib/neeto_compliance/verifiers/base.rb', line 33
def print_description
print "%-80s" % [verifier_name]
end
|
#process ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/neeto_compliance/verifiers/base.rb', line 10
def process
return true if app_is_exception?
NeetoCompliance::NeetoCommons.path
success, errors = audit
unless success
errors.each do |error|
puts error
end
else
print "[PASS]\n".green
end
success
end
|
#verifier_name ⇒ Object
29
30
31
|
# File 'lib/neeto_compliance/verifiers/base.rb', line 29
def verifier_name
self.class.to_s
end
|