Sha256: 3013674f68de2a6715407761e0d39e57cb71265ba2f1208dddc2548544128472

Contents?: true

Size: 742 Bytes

Versions: 2

Compression:

Stored size: 742 Bytes

Contents

require 'tap/generator/generators/task'

module Tap::Generator::Generators
  
  # :startdoc::generator a generator task and test
  #
  # Generates a new generator.
  class Generator < Tap::Generator::Generators::Task
    
    def manifest(m, const_name)
      super
      
      const = Tap::Env::Constant.new(const_name.camelize)
      
      # make the templates directory
      m.directory path('templates', const.path)
      
      # make a template file
      # (note it's easier to do this as a file since erb is
      # added, and would have to be escaped in a template)
      m.file path('templates', const.path, 'template_file.erb') do |file|
        file << "# A sample template file.\nkey: <%= key %>\n"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tap-gen-0.1.2 lib/tap/generator/generators/generator.rb
tap-gen-0.1.3 lib/tap/generator/generators/generator.rb