Class: Puppet::ModuleTool::Applications::Generator::Node
- Inherits:
-
Object
- Object
- Puppet::ModuleTool::Applications::Generator::Node
show all
- Defined in:
- lib/vendor/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.
86
87
88
89
|
# File 'lib/vendor/puppet/module_tool/applications/generator.rb', line 86
def initialize(source, generator)
@generator = generator
@source = source
end
|
Class Method Details
.inherited(klass) ⇒ Object
77
78
79
|
# File 'lib/vendor/puppet/module_tool/applications/generator.rb', line 77
def self.inherited(klass)
types << klass
end
|
.on(path, generator) ⇒ Object
80
81
82
83
84
85
|
# File 'lib/vendor/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
|
74
75
76
|
# File 'lib/vendor/puppet/module_tool/applications/generator.rb', line 74
def self.types
@types ||= []
end
|
Instance Method Details
100
101
102
|
# File 'lib/vendor/puppet/module_tool/applications/generator.rb', line 100
def install!
raise NotImplementedError, "Abstract"
end
|
90
91
92
|
# File 'lib/vendor/puppet/module_tool/applications/generator.rb', line 90
def read
@source.read
end
|
93
94
95
96
97
98
99
|
# File 'lib/vendor/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
|