Class: WpGenerate::Generator::Theme

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

Instance Method Summary collapse

Methods inherited from WpGenerate::Generator

#cwd, #generate, #opt_parse, #templates_dir

Constructor Details

#initialize(args, options) ⇒ Theme

Returns a new instance of Theme.



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/wp_generate/generator/theme.rb', line 2

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

  templates = %w[
    index.php
    style.css
    helpers/helper.php
    partials/header.php
    partials/footer.php
    sass/sass_output.php
  ]
  @templates = {}
  templates.each do |t|
    @templates[t] = "#{name}/#{t}"
  end
  @vars = {:name => name}
end