Class: Woo::Generators::PageGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/woo/page_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_pageObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/generators/woo/page_generator.rb', line 9

def create_page
  path_array = Pathname.new(file_path).each_filename.to_a
  if path_array.length > 2
    puts '
Rut Roh! You specified a path with more than one directory

Example:
    rails generate woo:page [DIRECTORY/]NAME

Creates: app/views/styleguide/DIRECTORY/NAME
If <DIRECTORY> is not specified, it will default to \'pages\''
    return
  end

  @page_path = Pathname.new(file_path).cleanpath.to_s
  template 'example_page.erb', "app/views/styleguide/#{@page_path}.html.haml"
end