2011-12-10 20:17:47 +01:00
|
|
|
# Default Middleman template
|
2011-04-13 05:32:13 +02:00
|
|
|
class Middleman::Templates::Default < Middleman::Templates::Base
|
2014-03-13 11:57:19 +01:00
|
|
|
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'
|
2012-08-14 00:39:06 +02:00
|
|
|
|
2011-12-10 20:17:47 +01:00
|
|
|
# Template files are relative to this file
|
2011-12-18 05:12:13 +01:00
|
|
|
# @return [String]
|
2011-04-13 05:32:13 +02:00
|
|
|
def self.source_root
|
2011-07-26 05:48:49 +02:00
|
|
|
File.dirname(__FILE__)
|
2011-04-13 05:32:13 +02:00
|
|
|
end
|
2012-08-14 00:39:06 +02:00
|
|
|
|
2014-03-13 11:57:19 +01:00
|
|
|
# Output the files
|
2011-12-18 05:12:13 +01:00
|
|
|
# @return [void]
|
|
|
|
def build_scaffold!
|
2013-12-28 01:26:31 +01:00
|
|
|
template 'shared/config.tt', File.join(location, 'config.rb')
|
|
|
|
copy_file 'default/source/index.html.erb', File.join(location, 'source/index.html.erb')
|
|
|
|
copy_file 'default/source/layouts/layout.erb', File.join(location, 'source/layouts/layout.erb')
|
|
|
|
empty_directory File.join(location, 'source', options[:css_dir])
|
|
|
|
copy_file 'default/source/stylesheets/all.css', File.join(location, 'source', options[:css_dir], 'all.css')
|
|
|
|
copy_file 'default/source/stylesheets/normalize.css', File.join(location, 'source', options[:css_dir], 'normalize.css')
|
|
|
|
empty_directory File.join(location, 'source', options[:js_dir])
|
|
|
|
copy_file 'default/source/javascripts/all.js', File.join(location, 'source', options[:js_dir], 'all.js')
|
|
|
|
empty_directory File.join(location, 'source', options[:images_dir])
|
|
|
|
copy_file 'default/source/images/background.png', File.join(location, 'source', options[:images_dir], 'background.png')
|
|
|
|
copy_file 'default/source/images/middleman.png', File.join(location, 'source', options[:images_dir], 'middleman.png')
|
2012-08-14 00:39:06 +02:00
|
|
|
end
|
2011-04-13 05:32:13 +02:00
|
|
|
end
|
|
|
|
|
2011-12-10 20:17:47 +01:00
|
|
|
# Register this template
|
2012-08-14 00:39:06 +02:00
|
|
|
Middleman::Templates.register(:default, Middleman::Templates::Default)
|