Sha256: a4b261ae3abf1f4e8f13104ac505486d01f25a145c9ac2ca2689ac844acccf29

Contents?: true

Size: 779 Bytes

Versions: 14

Compression:

Stored size: 779 Bytes

Contents

module Woo
  module Generators
    class PageGenerator < Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)
      argument :file_path

      desc 'Create a Page for woo!'

      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
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
woo-0.2.0 lib/generators/woo/page_generator.rb
woo-0.1.12 lib/generators/woo/page_generator.rb
woo-0.1.11 lib/generators/woo/page_generator.rb
woo-0.1.10 lib/generators/woo/page_generator.rb
woo-0.1.9 lib/generators/woo/page_generator.rb
woo-0.1.8 lib/generators/woo/page_generator.rb
woo-0.1.7 lib/generators/woo/page_generator.rb
woo-0.1.6 lib/generators/woo/page_generator.rb
woo-0.1.5 lib/generators/woo/page_generator.rb
woo-0.1.4 lib/generators/woo/page_generator.rb
woo-0.1.3 lib/generators/woo/page_generator.rb
woo-0.1.2 lib/generators/woo/page_generator.rb
woo-0.1.0 lib/generators/woo/page_generator.rb
woo-0.1.0.pre1 lib/generators/woo/page_generator.rb