Sha256: f9c2781431f20305a9b5349e96afc6b8aba70621d39e437d714aecdbd85361cb

Contents?: true

Size: 818 Bytes

Versions: 2

Compression:

Stored size: 818 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
    
    config :test, true, &c.switch  # specifies creation of a test file
    
    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.1 lib/tap/generator/generators/generator.rb
tap-gen-0.1.0 lib/tap/generator/generators/generator.rb