Class: Fingerprint::Command::Verify

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/fingerprint/command/verify.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#error_countObject (readonly)

Returns the value of attribute error_count.



51
52
53
# File 'lib/fingerprint/command/verify.rb', line 51

def error_count
  @error_count
end

Instance Method Details

#callObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/fingerprint/command/verify.rb', line 53

def call
	input_file = @options[:name]

	unless File.exist? input_file
		abort "Can't find index #{input_file}. Aborting."
	end

	options = @options.dup
	options[:output] = @parent.output

	master = RecordSet.new

	File.open(input_file, "r") do |io|
		master.parse(io)
	end

	if master.configuration
		options.merge!(master.configuration.options)
	end

	scanner = Scanner.new(@paths, options)
	
	# We use a sparse record set here, so we can't check for additions.
	copy = SparseRecordSet.new(scanner)

	@error_count = Checker.verify(master, copy, **options)
	
	if @options[:fail_on_errors]
		abort "Data inconsistent, #{error_count} error(s) found!" if error_count != 0
	end
end