Sha256: 24bf3b0dc3167042bc35ba008cd0b905e17365b8ff19b8a5895c0e5caab2df89

Contents?: true

Size: 832 Bytes

Versions: 6

Compression:

Stored size: 832 Bytes

Contents

module Tap::Generator::Generators
  
  # :startdoc: Tap::Generator::Generators::GeneratorGenerator::generator a generator task and test
  #
  # Generates a new generator.
  class GeneratorGenerator < Tap::Generator::Base
    
    def manifest(m, const_name)
      const = Constant.new(const_name.camelize)
      dir= File.join('lib', const.path)
      
      # make the directory
      m.directory app.filepath(dir)
      
      # make the generator
      m.template app.filepath(dir, const.basename + '_generator.rb'), "task.erb", :const => const
      
      # make the templates directory
      m.directory app.filepath(dir, 'templates')
      m.file app.filepath(dir, 'templates', 'template_file.erb') do |file|
        file.puts "# A sample template file."
        file.puts "key: <%= key %>"
      end
      
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
bahuvrihi-tap-0.11.0 lib/tap/generator/generators/generator/generator_generator.rb
bahuvrihi-tap-0.11.1 lib/tap/generator/generators/generator/generator_generator.rb
bahuvrihi-tap-0.11.2 lib/tap/generator/generators/generator/generator_generator.rb
bahuvrihi-tap-0.12.0 lib/tap/generator/generators/generator/generator_generator.rb
tap-0.11.1 lib/tap/generator/generators/generator/generator_generator.rb
tap-0.11.0 lib/tap/generator/generators/generator/generator_generator.rb