Class: Puppet::Module::Tool::Applications::Generator::Node
- Inherits:
-
Object
- Object
- Puppet::Module::Tool::Applications::Generator::Node
show all
- Defined in:
- lib/puppet/module/tool/applications/generator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(source, generator) ⇒ Node
Returns a new instance of Node.
60
61
62
63
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 60
def initialize(source, generator)
@generator = generator
@source = source
end
|
Class Method Details
.inherited(klass) ⇒ Object
51
52
53
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 51
def self.inherited(klass)
types << klass
end
|
.on(path, generator) ⇒ Object
54
55
56
57
58
59
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 54
def self.on(path, generator)
klass = types.detect { |t| t.matches?(path) }
if klass
klass.new(path, generator)
end
end
|
.types ⇒ Object
48
49
50
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 48
def self.types
@types ||= []
end
|
Instance Method Details
#install! ⇒ Object
74
75
76
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 74
def install!
raise NotImplementedError, "Abstract"
end
|
#read ⇒ Object
64
65
66
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 64
def read
@source.read
end
|
#target ⇒ Object
67
68
69
70
71
72
73
|
# File 'lib/puppet/module/tool/applications/generator.rb', line 67
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
|