Sha256: 18423fe3e9d8c916b4a0eef9ca0004fafdc700c2f26cf0bfc56a3765132369f9
Contents?: true
Size: 995 Bytes
Versions: 1
Compression:
Stored size: 995 Bytes
Contents
# frozen_string_literal: true module NeetoCompliance class GitignoreFileVerifier < Base def local_copy ".gitignore" end def commons_copy NeetoCompliance::NeetoCommons.path.join "common_files", local_copy end def verify_command "diff #{commons_copy} #{local_copy}" end def valid? @missing_lines = [] local_gitignore = process_data File.read(local_copy) common_gitignore = process_data File.read(NeetoCompliance::GitignoreFileVerifier.new.commons_copy) common_gitignore.map { |line| @missing_lines << line unless local_gitignore.include?(line) } @missing_lines.empty? end def process_data(gitignore_data) gitignore_data.split("\n").map { |line| line.gsub(/^#.*/, "") } end def autofix_command "echo '#{@missing_lines.join("\n")}' >> #{local_copy}" end def autofix_suggestion "Add following lines to#{local_copy}: \n#{@missing_lines.join("\n")}".yellow end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
neeto-compliance-1.0.58 | lib/neeto_compliance/verifiers/gitignore_file_verifier.rb |