Class: NeetoCompliance::CypressConfigVerifier
- Inherits:
-
Base
- Object
- Base
- NeetoCompliance::CypressConfigVerifier
show all
- Defined in:
- lib/neeto_compliance/verifiers/cypress_config_verifier.rb
Instance Method Summary
collapse
Methods inherited from Base
#app_is_exception?, #app_name, #apps_exception_list, #audit, #error_message, #print_description, #process, #verifier_name
Instance Method Details
#auto_correct! ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/neeto_compliance/verifiers/cypress_config_verifier.rb', line 15
def auto_correct!
unless valid?
@autofix_commands.each do |command|
puts command
system command
end
end
end
|
#autofix_suggestion ⇒ Object
24
25
26
|
# File 'lib/neeto_compliance/verifiers/cypress_config_verifier.rb', line 24
def autofix_suggestion
@autofix_commands.join("\n").yellow
end
|
#cypress_config_files ⇒ Object
#same_file?(local_file, common_file) ⇒ Boolean
41
42
43
44
|
# File 'lib/neeto_compliance/verifiers/cypress_config_verifier.rb', line 41
def same_file?(local_file, common_file)
File.exist?(local_file) &&
`diff #{local_file} #{common_file.to_s}`.empty?
end
|
#valid? ⇒ Boolean
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/neeto_compliance/verifiers/cypress_config_verifier.rb', line 28
def valid?
@autofix_commands = []
cypress_config_files.each_pair do |local_file, common_file|
unless same_file?(local_file, common_file)
@autofix_commands << "cp #{common_file.to_s} #{local_file}"
@autofix_commands << "cd cypress-tests && yarn" if local_file == "cypress-tests/package.json"
end
end
@autofix_commands.length == 0
end
|