From d018511606960c436025680289a014b47e68ef9c Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Thu, 10 Nov 2011 15:24:24 -0800 Subject: [PATCH] debug flag --- lib/middleman/cli.rb | 9 +++++++-- lib/middleman/guard.rb | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/middleman/cli.rb b/lib/middleman/cli.rb index feb3e60e..0418ad49 100644 --- a/lib/middleman/cli.rb +++ b/lib/middleman/cli.rb @@ -57,12 +57,17 @@ module Middleman :aliases => "-p", :default => "4567", :desc => "The port Middleman will listen on" + method_option "debug", + :type => :boolean, + :default => false, + :desc => 'Print debug messages' def server v1_check params = { - :port => options[:port], - :environment => options[:environment] + :port => options["port"], + :environment => options["environment"], + :debug => options["debug"] } puts "== The Middleman is loading" diff --git a/lib/middleman/guard.rb b/lib/middleman/guard.rb index 97a3a828..d61dd4b9 100644 --- a/lib/middleman/guard.rb +++ b/lib/middleman/guard.rb @@ -22,7 +22,8 @@ module Middleman options.each do |k,v| options_hash << ", :#{k} => '#{v}'" end - + + $stderr.puts options_hash.inspect guardfile_contents = %Q{ guard 'middleman'#{options_hash} do watch(%r{(.*)}) @@ -81,6 +82,7 @@ module Guard def server_start app = ::Middleman.server app.set :environment, @options[:environment].to_sym + app.set :logging, @options[:debug] == "true" puts "== The Middleman is standing watch on port #{@options[:Port]||4567}" @app = app.new!