Class: NeetoCompliance::WebpackerConfigVerifier

Inherits:
Base
  • Object
show all
Defined in:
lib/neeto_compliance/verifiers/webpacker_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



29
30
# File 'lib/neeto_compliance/verifiers/webpacker_config_verifier.rb', line 29

def auto_correct!
end

#autofix_suggestionObject



22
23
24
25
26
27
# File 'lib/neeto_compliance/verifiers/webpacker_config_verifier.rb', line 22

def autofix_suggestion
  warning = "Following configuration lines are missing in webpacker config (config/webpacker.yml). Please refer #{commons_copy}"
    .yellow
  missing_lines = @file_difference.delete("<").red
  "#{warning}\n\n#{missing_lines}"
end

#commons_copyObject



9
10
11
# File 'lib/neeto_compliance/verifiers/webpacker_config_verifier.rb', line 9

def commons_copy
  NeetoCompliance::NeetoCommons.path.join "common_files/webpacker.yml"
end

#compare_filesObject



13
14
15
# File 'lib/neeto_compliance/verifiers/webpacker_config_verifier.rb', line 13

def compare_files
  @file_difference = `diff #{commons_copy} #{local_copy} | grep '<'`
end

#local_copyObject



5
6
7
# File 'lib/neeto_compliance/verifiers/webpacker_config_verifier.rb', line 5

def local_copy
  "config/webpacker.yml"
end

#valid?Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/neeto_compliance/verifiers/webpacker_config_verifier.rb', line 17

def valid?
  compare_files
  @file_difference.empty?
end