2009-07-28 01:25:32 +02:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
require 'templater'
|
|
|
|
|
|
|
|
module Generators
|
|
|
|
extend Templater::Manifold
|
|
|
|
desc "Generator for streamlining staticmatic"
|
|
|
|
|
|
|
|
class NewSite < Templater::Generator
|
2009-10-08 19:49:23 +02:00
|
|
|
desc "Creates a new middleman scaffold."
|
2009-07-28 01:25:32 +02:00
|
|
|
first_argument :location, :required => true, :desc => "Project location"
|
2009-10-06 22:56:24 +02:00
|
|
|
|
|
|
|
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'
|
2009-09-29 04:43:08 +02:00
|
|
|
|
2009-07-28 01:25:32 +02:00
|
|
|
def destination_root
|
|
|
|
File.expand_path(location)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.source_root
|
|
|
|
File.join(File.dirname(__FILE__), '..', 'lib', 'middleman', 'template')
|
|
|
|
end
|
2009-07-29 19:39:00 +02:00
|
|
|
|
2009-10-06 22:56:24 +02:00
|
|
|
template :init, "init.rb"
|
2009-07-28 01:25:32 +02:00
|
|
|
glob! :views
|
|
|
|
glob! :public
|
2009-10-06 22:56:24 +02:00
|
|
|
|
2009-10-07 01:29:51 +02:00
|
|
|
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)
|
2009-07-28 01:25:32 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
add :setup, NewSite
|
|
|
|
end
|
|
|
|
|
|
|
|
Generators.run_cli(Dir.pwd, 'mm-init', 1, %w(setup).concat(ARGV))
|