Sha256: ed774e6b48f2f677ecde8de24a30ce83f1b568364caf6a3b2fc1dd3520ced7b2

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

require 'tap/env'

module Tap::Generator::Generators
  
  # :startdoc::generator a task and test
  #
  # Generates a new Tap::Task and an associated test file.
  class Task < Tap::Generator::Base
    
    config :test, true, &c.switch  # specifies creation of a test file
    
    def manifest(m, const_name)
      const = Tap::Env::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

2 entries across 2 versions & 1 rubygems

Version Path
tap-gen-0.1.1 lib/tap/generator/generators/task.rb
tap-gen-0.1.0 lib/tap/generator/generators/task.rb