2009-10-23 02:25:15 +02:00
|
|
|
#!/usr/bin/env ruby
|
2009-11-18 00:26:23 +01:00
|
|
|
require File.join(File.dirname(File.dirname(__FILE__)), 'lib', 'middleman')
|
2009-10-23 02:25:15 +02:00
|
|
|
require 'templater'
|
|
|
|
|
|
|
|
module Generators
|
|
|
|
extend Templater::Manifold
|
|
|
|
desc "Generator for streamlining staticmatic"
|
|
|
|
|
|
|
|
class NewSite < Templater::Generator
|
|
|
|
desc "Creates a new middleman scaffold."
|
|
|
|
first_argument :location, :required => true, :desc => "Project location"
|
|
|
|
|
|
|
|
option :css_dir, :desc => 'The path to the css files'
|
|
|
|
option :js_dir, :desc => 'The path to the javascript files'
|
|
|
|
option :images_dir, :desc => 'The path to the image files'
|
|
|
|
|
|
|
|
def destination_root
|
|
|
|
File.expand_path(location)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.source_root
|
|
|
|
File.join(File.dirname(__FILE__), '..', 'lib', 'middleman', 'template')
|
|
|
|
end
|
|
|
|
|
|
|
|
template :init, "init.rb"
|
|
|
|
glob! :views
|
|
|
|
glob! :public
|
|
|
|
|
|
|
|
empty_directory :stylesheets, "public/stylesheets"#, File.join("public", css_dir)
|
|
|
|
empty_directory :javascripts, "public/javascripts"#, File.join("public", js_dir)
|
|
|
|
empty_directory :images, "public/images"#, File.join("public", images_dir)
|
|
|
|
end
|
|
|
|
|
|
|
|
add :setup, NewSite
|
|
|
|
end
|
|
|
|
|
|
|
|
Generators.run_cli(Dir.pwd, 'mm-init', 1, %w(setup).concat(ARGV))
|