Class: Fingerprint::Command::Analyze

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

Instance Method Summary collapse

Instance Method Details

#callObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fingerprint/command/analyze.rb', line 50

def call
  output_file = @options[:name]

  if File.exist?(output_file) and !@options[:force]
    abort "Output file #{output_file} already exists. Aborting."
  end

  options = @options.dup
  options[:excludes] = [File.expand_path(options[:name], Dir.pwd)]

  finished = false
  begin
    File.open(output_file, "w") do |io|
      options[:output] = io

      Scanner.scan_paths(@paths, options)
    end
    finished = true
  ensure
    FileUtils.rm(output_file) unless finished
  end  
end