Sha256: a82ab931562bd59c94136cb7ff343c5e6a076cbf92cde3120868878d0bdc6aa5

Contents?: true

Size: 709 Bytes

Versions: 3

Compression:

Stored size: 709 Bytes

Contents

require 'tap/generator/base'
require 'tap/env'

module Tap::Generator::Generators
  class Resource < 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.relative_path}.rb")
      m.directory File.dirname(task_path)
      m.template task_path, "resource.erb", :const => const
      
      if test
        test_path = path('test', "#{const.relative_path}_test.rb")
        m.directory File.dirname(test_path)
        m.template test_path, "test.erb", :const => const
      end
      
      const
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tap-gen-0.8.0 lib/tap/generator/generators/resource.rb
tap-gen-0.7.1 lib/tap/generator/generators/resource.rb
tap-gen-0.7.0 lib/tap/generator/generators/resource.rb