class Puppet::ModuleTool::Applications::Generator::Node

Public Class Methods

inherited(klass) click to toggle source
# File lib/puppet/module_tool/applications/generator.rb, line 77
def self.inherited(klass)
  types << klass
end
new(source, generator) click to toggle source
# File lib/puppet/module_tool/applications/generator.rb, line 86
def initialize(source, generator)
  @generator = generator
  @source = source
end
on(path, generator) click to toggle source
# File lib/puppet/module_tool/applications/generator.rb, line 80
def self.on(path, generator)
  klass = types.detect { |t| t.matches?(path) }
  if klass
    klass.new(path, generator)
  end
end
types() click to toggle source
# File lib/puppet/module_tool/applications/generator.rb, line 74
def self.types
  @types ||= []
end

Public Instance Methods

install!() click to toggle source
# File lib/puppet/module_tool/applications/generator.rb, line 100
def install!
  raise NotImplementedError, "Abstract"
end
read() click to toggle source
# File lib/puppet/module_tool/applications/generator.rb, line 90
def read
  @source.read
end
target() click to toggle source
# File lib/puppet/module_tool/applications/generator.rb, line 93
def target
  target = @generator.destination + @source.relative_path_from(@generator.skeleton.path)
  components = target.to_s.split(File::SEPARATOR).map do |part|
    part == 'NAME' ? @generator.metadata.name : part
  end
  Pathname.new(components.join(File::SEPARATOR))
end