Merge pull request #299 from bhollis/decruft

Three small cleanups
This commit is contained in:
Thomas Reynolds 2012-03-04 22:49:41 -08:00
commit 49ae07bab8
2 changed files with 6 additions and 13 deletions

View file

@ -235,7 +235,9 @@ module Middleman
# #
# @return [Class] # @return [Class]
def server(&block) def server(&block)
Class.new(Middleman::Base) @@servercounter ||= 1
@@servercounter += 1
const_set("MiddlemanBase#{@@servercounter}", Class.new(Middleman::Base))
end end
# Creates a new Rack::Server # Creates a new Rack::Server

View file

@ -16,16 +16,11 @@ module Middleman::Cli
namespace :build namespace :build
desc "build [options]", "Builds the static site for deployment" desc "build [options]", "Builds the static site for deployment"
method_option :relative,
:type => :boolean,
:aliases => "-r",
:default => false,
:desc => 'Force relative urls'
method_option :clean, method_option :clean,
:type => :boolean, :type => :boolean,
:aliases => "-c", :aliases => "-c",
:default => false, :default => false,
:desc => 'Removes orpahand files or directories from build' :desc => 'Removes orphaned files or directories from build'
method_option :glob, method_option :glob,
:type => :string, :type => :string,
:aliases => "-g", :aliases => "-g",
@ -46,10 +41,6 @@ module Middleman::Cli
self.class.shared_instance(options["verbose"] || false) self.class.shared_instance(options["verbose"] || false)
if options.has_key?("relative") && options["relative"]
self.class.shared_instance.activate :relative_assets
end
self.class.shared_rack self.class.shared_rack
opts = {} opts = {}
@ -106,7 +97,7 @@ module Middleman::Cli
# #
# @param [Middleman::Sitemap::Page] page # @param [Middleman::Sitemap::Page] page
# @return [void] # @return [void]
def tilt_template(page) def render_to_file(page)
build_dir = self.class.shared_instance.build_dir build_dir = self.class.shared_instance.build_dir
output_file = File.join(self.class.shared_instance.build_dir, page.destination_path) output_file = File.join(self.class.shared_instance.build_dir, page.destination_path)
@ -223,7 +214,7 @@ module Middleman::Cli
next if page.ignored? next if page.ignored?
next if @config[:glob] && !File.fnmatch(@config[:glob], page.path) next if @config[:glob] && !File.fnmatch(@config[:glob], page.path)
base.tilt_template(page) base.render_to_file(page)
output_path = File.join(@destination, page.destination_path) output_path = File.join(@destination, page.destination_path)
@cleaning_queue.delete(Pathname.new(output_path).realpath) if cleaning? @cleaning_queue.delete(Pathname.new(output_path).realpath) if cleaning?