forked from middleman/middleman
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make mm-init templates extensible. closes middleman#18.
- Loading branch information
Showing
25 changed files
with
75 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
require "thor" | ||
require "thor/group" | ||
|
||
module Middleman::Templates | ||
@@template_mappings = {} | ||
def self.register(name, klass) | ||
@@template_mappings[name] = klass | ||
end | ||
|
||
def self.registered_names | ||
@@template_mappings.keys | ||
end | ||
|
||
def self.registered_templates | ||
@@template_mappings | ||
end | ||
|
||
class Base < ::Thor::Group | ||
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' | ||
end | ||
end | ||
|
||
# Default template | ||
require "middleman/templates/default" | ||
# HTML5 template | ||
require "middleman/templates/html5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class Middleman::Templates::Default < Middleman::Templates::Base | ||
def self.source_root | ||
File.join(File.dirname(__FILE__), 'default') | ||
end | ||
|
||
def build_scaffold | ||
template "config.tt", File.join(location, "config.rb") | ||
template "config.ru", File.join(location, "config.ru") | ||
directory "views", File.join(location, "views") | ||
empty_directory File.join(location, "public", options[:css_dir]) | ||
empty_directory File.join(location, "public", options[:js_dir]) | ||
empty_directory File.join(location, "public", options[:images_dir]) | ||
end | ||
end | ||
|
||
Middleman::Templates.register(:default, Middleman::Templates::Default) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Middleman::Templates::Html5 < Middleman::Templates::Base | ||
def self.source_root | ||
File.join(File.dirname(__FILE__), 'html5') | ||
end | ||
|
||
def build_scaffold | ||
template "config.tt", File.join(location, "config.rb") | ||
directory "public", File.join(location, "public") | ||
empty_directory File.join(location, "views") | ||
end | ||
end | ||
|
||
Middleman::Templates.register(:html5, Middleman::Templates::Html5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require 'rubygems' | ||
require 'middleman' | ||
|
||
run Middleman::Server |
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.