lib/jekyll/commands/serve.rb in jekyll-2.4.0 vs lib/jekyll/commands/serve.rb in jekyll-2.5.0

- old
+ new

@@ -8,10 +8,11 @@ def init_with_program(prog) prog.command(:serve) do |c| c.syntax 'serve [options]' c.description 'Serve your site locally' c.alias :server + c.alias :s add_build_options(c) c.option 'detach', '-B', '--detach', 'Run the server in the background (detach)' c.option 'port', '-P', '--port [PORT]', 'Port to listen on' @@ -73,21 +74,25 @@ end end def webrick_options(config) opts = { - :DocumentRoot => config['destination'], - :Port => config['port'], :BindAddress => config['host'], - :MimeTypes => mime_types, + :DirectoryIndex => %w(index.html index.htm index.cgi index.rhtml index.xml), + :DocumentRoot => config['destination'], :DoNotReverseLookup => true, - :StartCallback => start_callback(config['detach']), - :DirectoryIndex => %w(index.html index.htm index.cgi index.rhtml index.xml) + :MimeTypes => mime_types, + :Port => config['port'], + :StartCallback => start_callback(config['detach']) } - if !config['verbose'] + if config['verbose'] opts.merge!({ + :Logger => WEBrick::Log.new($stdout, WEBrick::Log::DEBUG) + }) + else + opts.merge!({ :AccessLog => [], :Logger => WEBrick::Log.new([], WEBrick::Log::WARN) }) end @@ -116,12 +121,13 @@ ].map(&:to_s).join("") end # recreate NondisclosureName under utf-8 circumstance def file_handler_options - fh_option = WEBrick::Config::FileHandler - fh_option[:NondisclosureName] = ['.ht*','~*'] - fh_option + WEBrick::Config::FileHandler.merge({ + :FancyIndexing => true, + :NondisclosureName => ['.ht*','~*'] + }) end end end