diff --git a/lib/middleman/templates.rb b/lib/middleman/templates.rb index 45d683f3..4da13659 100644 --- a/lib/middleman/templates.rb +++ b/lib/middleman/templates.rb @@ -19,13 +19,18 @@ module Middleman::Templates include Thor::Actions argument :location, :type => :string - class_option :css_dir, :default => "stylesheets", :desc => 'The path to the css files' - class_option :js_dir, :default => "javascripts", :desc => 'The path to the javascript files' - class_option :images_dir, :default => "images", :desc => 'The path to the image files' + class_option :template, :default => "default" + class_option :css_dir, :default => "stylesheets" + class_option :js_dir, :default => "javascripts" + class_option :images_dir, :default => "images" end end # Default template require "middleman/templates/default" + # HTML5 template -require "middleman/templates/html5" \ No newline at end of file +require "middleman/templates/html5" + +# Local templates +require "middleman/templates/local" \ No newline at end of file diff --git a/lib/middleman/templates/local.rb b/lib/middleman/templates/local.rb new file mode 100644 index 00000000..affaf8da --- /dev/null +++ b/lib/middleman/templates/local.rb @@ -0,0 +1,20 @@ +module Middleman + def self.templates_path + File.join(`cd ~ && pwd`.chomp, ".middleman") + end +end + +class Middleman::Templates::Local < Middleman::Templates::Base + def self.source_root + Middleman.templates_path + end + + def build_scaffold + directory options[:template].to_s, location + end +end + +Dir[File.join(Middleman.templates_path, "*")].each do |dir| + next unless File.directory?(dir) + Middleman::Templates.register(File.basename(dir).to_sym, Middleman::Templates::Local) +end \ No newline at end of file