Class: WpGenerate::Generator::Template

Inherits:
WpGenerate::Generator show all
Defined in:
lib/wp_generate/generator/template.rb

Instance Method Summary collapse

Methods inherited from WpGenerate::Generator

#cwd, #generate, #opt_parse, #templates_dir

Constructor Details

#initialize(args, options) ⇒ Template

Returns a new instance of Template.



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/wp_generate/generator/template.rb', line 2

def initialize args, options
  @options = options
  name = args.shift
  if name.nil? or name.empty?
    STDERR.puts 'Usage: wp-generate template [name]'
    STDERR.puts 'Example: cd wp-content/themes/mytheme && wp-generate template home'
    exit 1
  end

  @templates = {"template.php" => "#{name}.php", "helper.php" => "helpers/#{name}.php", "style.sass" => "sass/#{name}.sass"}
  @vars = {:name => name}
end