avoid guard on Windows for now
This commit is contained in:
parent
6ea2ffda5c
commit
d2cbfc432f
4 changed files with 39 additions and 23 deletions
|
@ -160,6 +160,19 @@ module Middleman
|
|||
sandbox.class_eval(&block) if block_given?
|
||||
sandbox
|
||||
end
|
||||
|
||||
def self.start_server(options={})
|
||||
opts = {
|
||||
:Port => options[:port],
|
||||
:AccessLog => []
|
||||
}
|
||||
|
||||
app = ::Middleman.server
|
||||
app.set :environment, options[:environment].to_sym
|
||||
opts[:app] = app.new
|
||||
opts[:server] = 'thin'
|
||||
::Rack::Server.new(opts).start
|
||||
end
|
||||
end
|
||||
|
||||
require "middleman/version"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'thor'
|
||||
require 'rbconfig'
|
||||
|
||||
module Middleman
|
||||
class CLI < Thor
|
||||
|
@ -37,14 +38,20 @@ module Middleman
|
|||
method_option "livereload-port", :default => "35729", :desc => "The port Livereload will listen on"
|
||||
def server
|
||||
v1_check
|
||||
if options["livereload"]
|
||||
livereload_options = {:port => options["livereload-port"]}
|
||||
end
|
||||
|
||||
Middleman::Guard.start({
|
||||
:port => options[:port],
|
||||
:environment => options[:environment]
|
||||
}, livereload_options)
|
||||
if Config::CONFIG['host_os'].downcase =~ %r{mswin|mingw}
|
||||
::Middleman.start_server(options)
|
||||
puts "== The Middleman is standing watch on port #{options[:port]}"
|
||||
else
|
||||
if options["livereload"]
|
||||
livereload_options = {:port => options["livereload-port"]}
|
||||
end
|
||||
|
||||
Middleman::Guard.start({
|
||||
:port => options[:port],
|
||||
:environment => options[:environment]
|
||||
}, livereload_options)
|
||||
end
|
||||
end
|
||||
|
||||
desc "build", "Builds the static site for deployment"
|
||||
|
|
|
@ -38,9 +38,7 @@ module Guard
|
|||
class Middleman < Guard
|
||||
def initialize(watchers = [], options = {})
|
||||
super
|
||||
@options = {
|
||||
:port => '4567'
|
||||
}.update(options)
|
||||
@options = options
|
||||
end
|
||||
|
||||
def start
|
||||
|
@ -54,18 +52,8 @@ module Guard
|
|||
|
||||
private
|
||||
def server_start
|
||||
@server_options = {
|
||||
:Port => @options[:port],
|
||||
:AccessLog => []
|
||||
# :AccessLog => ::WEBrick::Log.new('/dev/null'),
|
||||
# :Logger => ::WEBrick::Log.new('/dev/null')
|
||||
}
|
||||
@server_job = fork do
|
||||
app = ::Middleman.server
|
||||
app.set :environment, @options[:environment].to_sym
|
||||
@server_options[:app] = app.new
|
||||
@server_options[:server] = 'thin'
|
||||
::Rack::Server.new(@server_options).start
|
||||
::Middleman.start_server(@options)
|
||||
end
|
||||
|
||||
puts "== The Middleman is standing watch on port #{@options[:port]}"
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
require "rbconfig"
|
||||
|
||||
$:.push File.expand_path("../lib", __FILE__)
|
||||
require "middleman/version"
|
||||
|
||||
|
@ -51,8 +53,14 @@ eos
|
|||
s.add_runtime_dependency("coffee-script", ["~> 2.2.0"])
|
||||
s.add_runtime_dependency("sprockets", ["2.0.0.beta.13"])
|
||||
s.add_runtime_dependency("httparty", ["~> 0.7.8"])
|
||||
s.add_runtime_dependency("guard", ["~> 0.5.1"])
|
||||
s.add_runtime_dependency("guard-livereload", ["~> 0.2.1"])
|
||||
|
||||
case Config::CONFIG['host_os'].downcase
|
||||
when %r{mswin|mingw}
|
||||
else
|
||||
s.add_runtime_dependency("guard", ["~> 0.5.1"])
|
||||
s.add_runtime_dependency("guard-livereload", ["~> 0.3.0"])
|
||||
end
|
||||
|
||||
s.add_development_dependency("coffee-filter", ["~> 0.1.1"])
|
||||
s.add_development_dependency("cucumber", ["~> 1.0.2"])
|
||||
s.add_development_dependency("rake", ["0.8.7"])
|
||||
|
|
Loading…
Reference in a new issue