Class: Monorail::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/monorail/app.rb

Constant Summary collapse

TITLE =
"***Monorail version #{Version}"
Cmds =
{
  :server => :run_server,
  :application => :generate_application,
  :controller => :generate_controller,
}

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



53
54
# File 'lib/monorail/app.rb', line 53

def initialize
end

Instance Method Details

#generate_applicationObject



79
80
81
# File 'lib/monorail/app.rb', line 79

def generate_application
  ApplicationGenerator.new.run
end

#generate_controllerObject



83
84
85
# File 'lib/monorail/app.rb', line 83

def generate_controller
  ControllerGenerator.new.run
end

#runObject



57
58
59
60
61
62
63
64
# File 'lib/monorail/app.rb', line 57

def run
  cmd = ARGV.shift
  if cmd and handler = Cmds[cmd.downcase.intern]
    send handler
  else
    write_cmd_summary
  end
end

#run_serverObject



87
88
89
# File 'lib/monorail/app.rb', line 87

def run_server
  MonorailServer.new.run
end

#write_cmd_summaryObject



68
69
70
71
72
73
74
75
76
77
# File 'lib/monorail/app.rb', line 68

def write_cmd_summary
  $>.puts TITLE
  $>.puts
  $>.puts "Command summary:"
  Cmds.keys.each {|cmd|
    $>.puts "   monorail #{cmd} [args]"
  }
  $>.puts
  $>.puts "For more info: monorail <cmd> --help"
end