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

Inherits:
TaskGenerator show all
Defined in:
lib/tap/generator/generators/file_task/file_task_generator.rb

Overview

:startdoc: Tap::Generator::Generators::FileTaskGenerator::generator a file_task and test

Generates a new Tap::FileTask and associated test files.

Constant Summary

Constants inherited from Task

Task::DEFAULT_HELP_TEMPLATE

Instance Attribute Summary

Attributes inherited from Base

#prompt_in, #prompt_out, #template_dir

Attributes inherited from Task

#name

Attributes included from Support::Executable

#app, #batch, #dependencies, #method_name, #on_complete_block

Instance Method Summary collapse

Methods inherited from Base

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

Methods inherited from Task

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

Methods included from Support::Executable

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

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/file_task/file_task_generator.rb', line 10

def manifest(m, const_name)
  const = super
  
  if test
    test_dir = app.filepath('test', const.path, "test_#{const.basename}")
    
    m.directories test_dir, %W{
      input
      expected
    }
    
    m.template File.join(test_dir, 'input/file.txt'), "file.txt", :const => const, :test_dir => test_dir
    m.template File.join(test_dir, 'expected/result.yml'), "result.yml", :const => const, :test_dir => test_dir
  end
end