Sha256: 4958e6d18fb5ccca1d3217f4cc0ae97f5c9621b9c81885a16a65f8666111e273
Contents?: true
Size: 1.76 KB
Versions: 5
Compression:
Stored size: 1.76 KB
Contents
# CLI Module module Middleman::Cli # Server thor task class Server < Thor check_unknown_options! namespace :server desc "server [options]", "Start the preview server" method_option :environment, :aliases => "-e", :default => ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development', :desc => "The environment Middleman will run under" method_option :host, :type => :string, :aliases => "-h", :default => "0.0.0.0", :desc => "Bind to HOST address" method_option :port, :aliases => "-p", :default => "4567", :desc => "The port Middleman will listen on" method_option :verbose, :type => :boolean, :default => false, :desc => 'Print debug messages' method_option "disable-watcher", :type => :boolean, :default => false, :desc => 'Disable the file change and delete watcher process' # Start the server def server require "middleman-core" require "middleman-core/preview_server" if !ENV["MM_ROOT"] puts "== Could not find a Middleman project config.rb" puts "== Treating directory as a static site to be served" ENV["MM_ROOT"] = Dir.pwd ENV["MM_SOURCE"] = "" end params = { :port => options["port"], :host => options["host"], :environment => options["environment"], :debug => options["verbose"], :"disable-watcher" => options["disable-watcher"] } puts "== The Middleman is loading" ::Middleman::PreviewServer.start(params) end end def self.exit_on_failure? true end # Map "s" to "server" Base.map({ "s" => "server" }) end
Version data entries
5 entries across 5 versions & 1 rubygems