Sha256: 52055ca00762fd750ea7954dd43a209ec69395985207d8082d762e063827d2c0

Contents?: true

Size: 792 Bytes

Versions: 3

Compression:

Stored size: 792 Bytes

Contents

module Tap::Generator::Generators
  
  # :startdoc: Tap::Generator::Generators::TaskGenerator::generator a task and test
  #
  # Generates a new Tap::Task and an associated test file.
  class TaskGenerator < Tap::Generator::Base
    
    config :test, true, &c.switch  # specifies creation of a test file
    
    def manifest(m, const_name)
      const = Tap::Support::Constant.new(const_name.camelize)
      
      task_path = path('lib', "#{const.path}.rb")
      m.directory File.dirname(task_path)
      m.template task_path, "task.erb", :const => const
      
      if test
        test_path = path('test', "#{const.path}_test.rb")
        m.directory File.dirname(test_path)
        m.template test_path, "test.erb", :const => const
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tap-0.12.3 lib/tap/generator/generators/task/task_generator.rb
tap-0.12.2 lib/tap/generator/generators/task/task_generator.rb
tap-0.12.4 lib/tap/generator/generators/task/task_generator.rb