Sha256: 2e7f77049c96b7efdf41f443e5844da3f5cc0eda3a49a3387807a41316d7b9b6

Contents?: true

Size: 883 Bytes

Versions: 15

Compression:

Stored size: 883 Bytes

Contents

# encoding: UTF-8


module Spontaneous
  module Generators
    class Page < Generator
      def self.banner; "spot generate page [page_type | PageType]"; end


    def class_name
      case type_name
      when /^[A-Z]/
        type_name
      else
        type_name.camelize
      end
    end

    def disk_name
      case type_name
      when /^[A-Z]/
        type_name.underscore
      else
        type_name
      end
    end

    argument :type_name, :type => :string, :desc => "The name for this page type (page_type_name OR PageTypeName)"
      desc "Generates a new page type"
      def generate_page
        self.destination_root = options[:root]
        empty_directory "schema"
        template 'page.rb.tt', "schema/#{disk_name}.rb"
        copy_file 'inline.html.cut', "templates/#{disk_name}.html.#{Spontaneous::Output::Template.extension}"
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
spontaneous-0.2.0.beta10 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.beta9 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.beta8 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.beta7 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.beta6 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.beta5 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.beta4 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.beta3 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.beta2 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.beta1 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.alpha7 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.alpha6 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.alpha5 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.alpha4 lib/spontaneous/generators/page.rb
spontaneous-0.2.0.alpha3 lib/spontaneous/generators/page.rb