instance method
option_parser
Ruby on Rails 5.0.7.2
Since v4.2.11.3 Last seen in v5.0.7.2 Private — implementation detail, not part of the public APIAvailable in: v4.2.11.3 v5.0.7.2
Signature
option_parser(options)
No documentation comment.
Parameters
-
optionsreq
Source
# File railties/lib/rails/commands/server.rb, line 28
def option_parser(options)
OptionParser.new do |opts|
opts.banner = "Usage: rails server [mongrel, thin etc] [options]"
opts.on("-p", "--port=port", Integer,
"Runs Rails on the specified port.", "Default: 3000") { |v|
options[:user_supplied_options] << :Port
options[:Port] = v
}
opts.on("-b", "--binding=IP", String,
"Binds Rails to the specified IP.", "Default: localhost") { |v|
options[:user_supplied_options] << :Host
options[:Host] = v
}
opts.on("-c", "--config=file", String,
"Uses a custom rackup configuration.") { |v|
options[:user_supplied_options] << :config
options[:config] = v
}
opts.on("-d", "--daemon", "Runs server as a Daemon.") {
options[:user_supplied_options] << :daemonize
options[:daemonize] = true
}
opts.on("-e", "--environment=name", String,
"Specifies the environment to run this server under (test/development/production).",
"Default: development") { |v|
options[:user_supplied_options] << :environment
options[:environment] = v
}
opts.on("-P", "--pid=pid", String,
"Specifies the PID file.",
"Default: tmp/pids/server.pid") { |v|
options[:user_supplied_options] << :pid
options[:pid] = v
}
opts.on("-C", "--[no-]dev-caching",
"Specifies whether to perform caching in development.",
"true or false") { |v|
options[:user_supplied_options] << :caching
options[:caching] = v
}
opts.separator ""
opts.on("-h", "--help", "Shows this help message.") { puts opts; exit }
end
end
Defined in railties/lib/rails/commands/server.rb line 28
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Server::Options