diff --git a/lib/middleman.rb b/lib/middleman.rb index dffcd299..a79e1bc1 100755 --- a/lib/middleman.rb +++ b/lib/middleman.rb @@ -184,7 +184,7 @@ module Middleman def self.start_server(options={}) opts = { - :Port => options[:port], + :Port => options[:port] || 4567, :AccessLog => [] } diff --git a/lib/middleman/builder.rb b/lib/middleman/builder.rb index e8865679..ec839d3d 100644 --- a/lib/middleman/builder.rb +++ b/lib/middleman/builder.rb @@ -16,7 +16,7 @@ module Middleman request_path = destination.sub(/^#{SHARED_SERVER.build_dir}/, "") - begin + begin destination, request_path = SHARED_SERVER.reroute_builder(destination, request_path) request_path.gsub!(/\s/, "%20") diff --git a/lib/middleman/cli.rb b/lib/middleman/cli.rb index 73c63464..d494a29d 100644 --- a/lib/middleman/cli.rb +++ b/lib/middleman/cli.rb @@ -33,6 +33,8 @@ module Middleman desc "server [-p 4567] [-e development]", "Starts the Middleman preview server" method_option "environment", :aliases => "-e", :default => ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development', :desc => "The environment Middleman will run under" method_option "port", :aliases => "-p", :default => "4567", :desc => "The port Middleman will listen on" + + method_option "disable-watcher", :default => false, :type => :boolean, :desc => "Don't use config.rb watcher (also disables livereload)" method_option "livereload", :default => false, :type => :boolean, :desc => "Whether to enable Livereload or not" method_option "livereload-port", :default => "35729", :desc => "The port Livereload will listen on" def server @@ -41,11 +43,17 @@ module Middleman if options["livereload"] livereload_options = {:port => options["livereload-port"]} end - - Middleman::Guard.start({ + + params = { :port => options[:port], :environment => options[:environment] - }, livereload_options) + } + + if options["disable-watcher"] + Middleman.start_server(params) + else + Middleman::Guard.start(params, livereload_options) + end end desc "build", "Builds the static site for deployment"