diff options
author | Andrey Chernih <andrey.chernih@gmail.com> | 2014-07-11 23:26:33 +0400 |
---|---|---|
committer | Andrey Chernih <andrey.chernih@gmail.com> | 2014-07-11 23:26:33 +0400 |
commit | b3a34cd3747840a8bd92612d02d947da01bcd00e (patch) | |
tree | ba9ffca697fdea43a20a61eca138d1cfe6f63b23 /install.rb | |
parent | 132d400b6f1b73f828b8d50b90edac72244e11c5 (diff) | |
download | rails-b3a34cd3747840a8bd92612d02d947da01bcd00e.tar.gz rails-b3a34cd3747840a8bd92612d02d947da01bcd00e.tar.bz2 rails-b3a34cd3747840a8bd92612d02d947da01bcd00e.zip |
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
Diffstat (limited to 'install.rb')
0 files changed, 0 insertions, 0 deletions