rails/rails — pull request #16142 by andreychernih (2014-07-11 19:35:58+00:00)
Title: Add ability to extend `rails server` command options parser

With this change it will be possible to add additional options to the `option_parser` like this:

require 'rails/commands/server'
module Rails
class Server < ::Rack::Server
class Options
def option_parser_with_open(options)
parser = option_parser_without_open options
parser.on('-o', '--open', 'Open in default browser') { options[:open] = true }
parser
end
alias_method_chain :option_parser, :open
end

def start_with_open
start_without_open do
`open http://localhost:3000` if options[:open]
end
end
alias_method_chain :start, :open
end
end