Sha256: 0acb3ab935c41cf6211110e59087054b96b77dbb297f67b1fed0decd183a6911

Contents?: true

Size: 803 Bytes

Versions: 6

Compression:

Stored size: 803 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  # Generates the task without test files.
    
    def manifest(m, const_name)
      const = Constant.new(const_name.camelize)
      
      task_path = app.filepath('lib', "#{const.path}.rb")
      m.directory File.dirname(task_path)
      m.template task_path, "task.erb", :const => const
          
      if test
        test_path = app.filepath('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

6 entries across 6 versions & 2 rubygems

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