Class: RawQ::Generator::Application

Inherits:
Object
  • Object
show all
Extended by:
Shellwords
Defined in:
lib/rawq/generator/application.rb

Class Method Summary collapse

Class Method Details

.run!(*arguments) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rawq/generator/application.rb', line 9

def run!(*arguments)
  options = RawQ::Generator::Options.new(arguments)

  if options[:invalid_option]
    $stderr.puts options[:invalid_option]
    options[:show_help] = true
  end

  if options[:show_help]
    $stderr.puts options.opts
    return 1
  end

  if options[:application_name].nil? || options[:application_name].squeeze.strip == ""
    $stderr.puts "missing application name"
    $stderr.puts options.opts
    return 1
  end

  begin
    generator = RawQ::Generator.new(options)
    generator.run
    return 0
  end
end