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