Class: Tap::Generator::Generators::Generator

Inherits:
Resource
  • Object
show all
Defined in:
lib/tap/generator/generators/generator.rb

Overview

:startdoc::generator a generator task and test

Generates a new generator.

Instance Attribute Summary

Attributes inherited from Base

#prompt_in, #prompt_out, #template_dir

Instance Method Summary collapse

Methods inherited from Base

#action, #directories, #directory, #file, #initialize, #iterate, #log_relative, #on, #path, #process, #set, #template, #template_files

Constructor Details

This class inherits a constructor from Tap::Generator::Base

Instance Method Details

#manifest(m, const_name) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tap/generator/generators/generator.rb', line 10

def manifest(m, const_name)
  const = super
  
  # 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
  
  const
end