Class: Monorail::MonorailServer
- Inherits:
-
Object
- Object
- Monorail::MonorailServer
- Defined in:
- lib/monorail/server.rb
Instance Method Summary collapse
-
#initialize ⇒ MonorailServer
constructor
A new instance of MonorailServer.
- #run ⇒ Object
Constructor Details
#initialize ⇒ MonorailServer
Returns a new instance of MonorailServer.
41 42 |
# File 'lib/monorail/server.rb', line 41 def initialize end |
Instance Method Details
#run ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/monorail/server.rb', line 45 def run = OpenStruct.new .host = "127.0.0.1" .port = 8900 .ssl = false .daemon = false .environment = :monorail .directory = "." opts = OptionParser.new {|opts| opts.separator "" opts.separator "Options summary:" opts.on("-a", "--addr IP-address", "Requires the host IP address to listen on", " default: 127.0.0.1") {|addr| .host = addr } opts.on("-p", "--port TCP port", "Requires the TCP port to listen on", " default: 8900") {|port| .port = port.to_i } opts.on("-s", "--[no-]ssl", "Require SSL (HTTPS)", " default: false") {|ssl| .ssl = ssl } #opts.on("-d", "--[no-]daemon", "Run in the background", # " default: false") {|d| # options.daemon = d #} opts.on("-e", "--env ENVIRONMENT", "execution environment", " choices: monorail, rails, static", " default: monorail") {|e| .environment = e.to_s.downcase.intern } opts.on("-d", "--dir DIRECTORY", "directory where the application is located", " default: the current directory") {|d| .directory = d.to_s } # Options summary opts.on_tail("-h", "--help", "Show this message") { puts opts exit } # Version opts.on_tail("--version", "Show version") { puts Version exit } } opts.parse!(ARGV) Monorail.new( ).run end |