2014-05-16 17:54:34 +00:00
|
|
|
require 'puppet/face'
|
|
|
|
|
|
|
|
Puppet::Face.define(:yardoc, '0.0.1') do
|
|
|
|
|
|
|
|
action(:yardoc) do
|
|
|
|
default
|
|
|
|
|
2014-05-22 05:14:53 +00:00
|
|
|
when_invoked do |manifest, options|
|
2014-05-20 05:24:03 +00:00
|
|
|
|
|
|
|
unless Puppet.features.yard?
|
|
|
|
raise RuntimeError, "The 'yard' gem must be installed in order to use this face."
|
|
|
|
end
|
|
|
|
|
2014-05-24 19:54:22 +00:00
|
|
|
unless Puppet.features.rgen?
|
2014-05-20 05:24:03 +00:00
|
|
|
raise RuntimeError, "The 'rgen' gem must be installed in order to use this face."
|
|
|
|
end
|
|
|
|
|
2014-05-24 19:54:22 +00:00
|
|
|
require 'puppetx/yardoc/yard/plugin'
|
|
|
|
|
2014-05-23 04:02:35 +00:00
|
|
|
parser = Puppetx::Yardoc::YARD::PuppetParser.new(File.read(manifest), manifest)
|
|
|
|
parser.parse
|
2014-05-16 17:54:34 +00:00
|
|
|
|
2014-05-23 05:44:15 +00:00
|
|
|
return parser.enumerator.map {|s| s.comments}
|
2014-05-16 17:54:34 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|