server
来自「ruby on rails web敏捷开发之路第二版 源代码」· 代码 · 共 49 行
TXT
49 行
#!/Users/dave/ruby1.8/bin/rubyrequire 'webrick'require 'optparse'OPTIONS = { :port => 3000, :ip => "0.0.0.0", :environment => "development", :server_root => File.expand_path(File.dirname(__FILE__) + "/../public/"), :server_type => WEBrick::SimpleServer}ARGV.options do |opts| script_name = File.basename($0) opts.banner = "Usage: ruby #{script_name} [options]" opts.separator "" opts.on("-p", "--port=port", Integer, "Runs Rails on the specified port.", "Default: 3000") { |OPTIONS[:port]| } opts.on("-b", "--binding=ip", String, "Binds Rails to the specified ip.", "Default: 0.0.0.0") { |OPTIONS[:ip]| } opts.on("-e", "--environment=name", String, "Specifies the environment to run this server under (test/development/production).", "Default: development") { |OPTIONS[:environment]| } opts.on("-d", "--daemon", "Make Rails run as a Daemon (only works if fork is available -- meaning on *nix)." ) { OPTIONS[:server_type] = WEBrick::Daemon } opts.separator "" opts.on("-h", "--help", "Show this help message.") { puts opts; exit } opts.parse!endENV["RAILS_ENV"] = OPTIONS[:environment]require File.dirname(__FILE__) + "/../config/environment"require 'webrick_server'OPTIONS['working_directory'] = File.expand_path(RAILS_ROOT)puts "=> Rails application started on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"DispatchServlet.dispatch(OPTIONS)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?