middleman/bin/mm-server
tdreyno cf39b2e2cb Revert "update docs"
This reverts commit 43ac01af5c.
2009-10-26 09:33:38 -07:00

43 lines
1.1 KiB
Ruby
Executable file

#!/usr/bin/env ruby
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