Method: CVGen::Exec.call

Defined in:
lib/cvgen/exec.rb

.callObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cvgen/exec.rb', line 8

def self.call
  config = parse_command_line_args
  watch = config.delete('watch')

  input_file, output_file = ARGV[0], ARGV[1]

  create_output(input_file, output_file, config)

  if watch
    trap(:INT) { exit }

    require 'listen'
    Listen.to('.', :only => Regexp.new(input_file)) do |modified, added, removed|
      #assume the only possibility is modification of source file
      create_output(input_file, output_file, config)
    end.start

    puts 'Listening for changes, Ctrl-C to exit'
    sleep
  end
end