Parse the command line arguments for this application.
Methods
- __adapter
- __app
- __daemon
- __debug
- __devel
- __live
- __mode
- __mongrel
- __port_offset
- __production
- __stage
- __webrick
- default
Attributes
| [RW] | application | The application this parser configures. |
Public Instance methods
Override the adapter.
[ show source ]
# File lib/nitro/application/args.rb, line 32
32: def __adapter(adapter)
33: @application.adapter = adapter.to_sym
34: end
The name of this application.
[ show source ]
# File lib/nitro/application/args.rb, line 20
20: def __app(name)
21: end
Run the application as a daemon.
[ show source ]
# File lib/nitro/application/args.rb, line 77
77: def __daemon
78: require "facets/core/kernel/daemonize"
79:
80: pwd = Dir.pwd
81: daemonize()
82: # Restore the original pwd (daemonize cd's to '/').
83: Dir.chdir(pwd)
84:
85: # Save a process sentinel file.
86: FileUtils.touch(File.join(".temp","a#{Process.pid}.pid"))
87:
88: # Set the logger to a file (daemonize closes the std streams).
89: Logger.set(Logger.new("log/app.log"))
90: end
Run in debug mode. Useful for development.
This method is also aliased as
__devel
[ show source ]
# File lib/nitro/application/args.rb, line 56
56: def __debug
57: Nitro.mode = :debug
58: end
Alias for #__debug
Run in live mode. Used in the production environment.
This method is also aliased as
__production
[ show source ]
# File lib/nitro/application/args.rb, line 70
70: def __live
71: Nitro.mode = :live
72: end
Override the execution mode.
[ show source ]
# File lib/nitro/application/args.rb, line 50
50: def __mode(mode)
51: Nitro.mode = mode.to_sym
52: end
Run with Mongrel adapter.
[ show source ]
# File lib/nitro/application/args.rb, line 44
44: def __mongrel
45: @application.adapter = :mongrel
46: end
Add this offest to the listening port. Useful in cluster configurations.
[ show source ]
# File lib/nitro/application/args.rb, line 26
26: def __port_offset(offset)
27: @application.port += offset.to_i
28: end
Alias for #__live
Run in stage mode. Useful for final testing before going live.
[ show source ]
# File lib/nitro/application/args.rb, line 64
64: def __stage
65: Nitro.mode = :stage
66: end
Run with Webrick adapter.
[ show source ]
# File lib/nitro/application/args.rb, line 38
38: def __webrick
39: @application.adapter = :mongrel
40: end
The default action.
[ show source ]
# File lib/nitro/application/args.rb, line 15
15: def default
16: end