Class: Taza::PageGenerator

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/taza/generators/page_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



11
12
13
# File 'lib/taza/generators/page_generator.rb', line 11

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#pageObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/taza/generators/page_generator.rb', line 16

def page
  name = site_name.underscore

  if File.directory?("lib/sites/#{name}")
    template('templates/page/page.rb.tt', "lib/sites/#{name}/pages/#{page_name}_page.rb")
    template('templates/page/page_spec.rb.tt', "spec/isolation/#{page_name}_page_spec.rb")
  else
    say "No such site #{name} exists! ", :red
    say "Please run 'taza create #{name}'", :green
  end

end