Skip to content

Commit

Permalink
add flag to disable guard
Browse files Browse the repository at this point in the history
  • Loading branch information
tdreyno committed Oct 14, 2011
1 parent 38c21cc commit 18018bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/middleman.rb
Expand Up @@ -184,7 +184,7 @@ def self.server(&block)

def self.start_server(options={})
opts = {
:Port => options[:port],
:Port => options[:port] || 4567,
:AccessLog => []
}

Expand Down
2 changes: 1 addition & 1 deletion lib/middleman/builder.rb
Expand Up @@ -16,7 +16,7 @@ def tilt_template(source, *args, &block)

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")
Expand Down
14 changes: 11 additions & 3 deletions lib/middleman/cli.rb
Expand Up @@ -33,6 +33,8 @@ def init(name)
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
Expand All @@ -41,11 +43,17 @@ def server
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"
Expand Down

0 comments on commit 18018bd

Please sign in to comment.