2009-10-22 20:25:15 -04:00
|
|
|
#!/usr/bin/env ruby
|
2009-11-17 18:26:23 -05:00
|
|
|
require File.join(File.dirname(File.dirname(__FILE__)), 'lib', 'middleman')
|
2011-04-12 23:32:13 -04:00
|
|
|
require "middleman/templates"
|
2009-10-22 20:25:15 -04:00
|
|
|
|
2011-02-05 13:32:04 -05:00
|
|
|
module Middleman
|
|
|
|
class Generator < ::Thor::Group
|
|
|
|
include Thor::Actions
|
2009-10-22 20:25:15 -04:00
|
|
|
|
2011-02-16 12:36:10 -05:00
|
|
|
argument :location, :type => :string, :desc => "New project location"
|
|
|
|
|
2011-04-12 23:32:13 -04:00
|
|
|
available_templates = Middleman::Templates.registered_names.join(", ")
|
|
|
|
class_option :template, :aliases => "-T", :default => "default", :desc => "Optionally use a pre-defined project template: #{available_templates}"
|
2009-10-22 20:25:15 -04:00
|
|
|
|
2011-02-05 13:32:04 -05: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'
|
|
|
|
|
|
|
|
def create_project
|
2011-04-12 23:32:13 -04:00
|
|
|
key = options[:template].to_sym
|
|
|
|
key = :default unless Middleman::Templates.registered_templates.has_key?(key)
|
|
|
|
|
|
|
|
Middleman::Templates.registered_templates[key].start
|
2011-02-05 13:32:04 -05:00
|
|
|
end
|
2009-10-22 20:25:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-02-16 12:36:10 -05:00
|
|
|
Middleman::Generator.start
|