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

Inherits:
Base show all
Defined in:
lib/tap/generator/generators/generator/generator_generator.rb

Overview

:startdoc: Tap::Generator::Generators::GeneratorGenerator::generator a generator task and test

Generates a new generator.

Constant Summary

Constants inherited from Base

Base::Constant

Constants inherited from Task

Task::DEFAULT_HELP_TEMPLATE

Instance Attribute Summary

Attributes inherited from Base

#file_task, #target_dir, #template_dir

Attributes inherited from Task

#name

Attributes included from Support::Executable

#_method_name, #app, #batch, #dependencies, #on_complete_block

Attributes included from Support::Configurable

#config

Instance Method Summary collapse

Methods inherited from Base

#directories, #directory, #file, #initialize, #iterate, lazydoc, #log_relative, #process, #template, #template_files

Methods inherited from Task

execute, help, inherited, #initialize, #initialize_batch_obj, #inspect, instance, intern, lazydoc, #log, parse, parse!, #process, #to_s

Methods included from Support::Executable

#_execute, #batch_index, #batch_with, #batched?, #check_terminate, #depends_on, #enq, #execute, #fork, initialize, #initialize_batch_obj, #inspect, #merge, #on_complete, #reset_dependencies, #resolve_dependencies, #sequence, #switch, #sync_merge, #unbatched_depends_on, #unbatched_enq, #unbatched_on_complete

Methods included from Support::Configurable

included, #initialize_copy, #reconfigure

Constructor Details

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

Instance Method Details

#manifest(m, const_name) ⇒ Object



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

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