Sha256: 98d717507aa1d637f056abf108b20eef16554c576c8f37c77a0afd123c940963
Contents?: true
Size: 1.53 KB
Versions: 12
Compression:
Stored size: 1.53 KB
Contents
#!/usr/bin/env ruby # Non-blocking site rebuilding trap("TSTP") do fork do require "open3" first_run = true Open3.popen3(%Q{cd "#{Dir.pwd}" && #{File.join(File.dirname(__FILE__), "mm-build")} | grep FORCED}) do |stdin, stdout, stderr| puts "\n== Building the site..." stdout.readlines.each do |l| puts "== Updated:" if first_run puts " " + l.split("[FORCED]").last.chomp first_run = false end puts "== Build complete" end end end require 'optparse' # Require Middleman require File.join(File.dirname(__FILE__), '..', 'lib', 'middleman') env = ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development' options = { :Port => 4567, :AccessLog => [] } OptionParser.new { |opts| opts.banner = "Usage: mm-server [rack options]" opts.separator "" opts.separator "Rack options:" opts.on("-p", "--port PORT", "use PORT (default: 4567)") { |port| options[:Port] = port } opts.on("-E", "--env ENVIRONMENT", "use ENVIRONMENT for defaults (default: development)") { |e| env = e } opts.on("--debug", "Debug mode") { ::Middleman::Base.set :logging, true } opts.parse! ARGV } ENV['RACK_ENV'] = env class Middleman::Base set :root, Dir.pwd end require 'shotgun' config = File.join(File.dirname(__FILE__), '..', 'lib', 'middleman', 'config.ru') app = Shotgun.new(config, lambda { |inner_app| Middleman::Base }) require 'thin' Thin::Logging.silent = true Rack::Handler::Thin.run app, options do |inst| puts "== The Middleman is standing watch on port #{options[:Port]}" end
Version data entries
12 entries across 12 versions & 1 rubygems