class Middleman::Cli::Build

def build

Returns:
  • (void) -
def build
  if !ENV["MM_ROOT"]
    raise Thor::Error, "Error: Could not find a Middleman project config, perhaps you are in the wrong folder?"
  end
  # Use Rack::Test for inspecting a running server for output
  require "rack"
  require "rack/test"
  require 'find'
  @debugging = Middleman::Cli::Base.respond_to?(:debugging) && Middleman::Cli::Base.debugging
  @had_errors = false
  self.class.shared_instance(options["verbose"], options["instrument"])
  self.class.shared_rack
  opts = {}
  opts[:glob]  = options["glob"]  if options.has_key?("glob")
  opts[:clean] = options["clean"] if options.has_key?("clean")
  action GlobAction.new(self, opts)
  if @had_errors && !@debugging
    cmd = "middleman build --verbose"
    cmd = "bundle exec '#{cmd}'" if defined?(Bundler)
    self.shell.say "There were errors during this build, re-run with `#{cmd}` to see the full exception."
  end
  exit(1) if @had_errors
  self.class.shared_instance.run_hook :after_build, self
end