Class: Monorail::Application
- Inherits:
-
Object
- Object
- Monorail::Application
- 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
- #generate_application ⇒ Object
- #generate_controller ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #run ⇒ Object
- #run_server ⇒ Object
- #write_cmd_summary ⇒ Object
Constructor Details
#initialize ⇒ Application
53 54 |
# File 'lib/monorail/app.rb', line 53 def initialize end |
Instance Method Details
#generate_application ⇒ Object
79 80 81 |
# File 'lib/monorail/app.rb', line 79 def generate_application ApplicationGenerator.new.run end |
#generate_controller ⇒ Object
83 84 85 |
# File 'lib/monorail/app.rb', line 83 def generate_controller ControllerGenerator.new.run end |
#run ⇒ Object
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_server ⇒ Object
87 88 89 |
# File 'lib/monorail/app.rb', line 87 def run_server MonorailServer.new.run end |
#write_cmd_summary ⇒ Object
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 |