Method: ElchScan::Application::Dispatch#dispatch_generate_config

Defined in:
lib/elch_scan/application/dispatch.rb

#dispatch_generate_configObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/elch_scan/application/dispatch.rb', line 17

def dispatch_generate_config
  if File.exist?(@config_src)
    log "Configuration already exists, please delete it do generate another one."
  else
    FileUtils.cp("#{ROOT}/doc/config.yml", @config_src)
    log "Sample configuration created!"
    log "You will need to add at least 1 one movie directory."
    answer = ask("Do you want to open the configuration file now? [Yes/no]")
    if ["", "y", "yes"].include?(answer.downcase)
      if RUBY_PLATFORM.include?("darwin")
        exec("open #{@config_src}")
      else
        system "#{cfg :application, :editor} #{@config_src}"
      end
    end
  end
end