Add feature guards for necessary requirements
Add `Puppet.feature` guards for the `yard` and `rgen` libraries.
This commit is contained in:
parent
3d71143614
commit
3ad750d103
|
@ -1,5 +1,4 @@
|
||||||
require 'puppet/face'
|
require 'puppet/face'
|
||||||
require 'puppet/pops'
|
|
||||||
|
|
||||||
Puppet::Face.define(:yardoc, '0.0.1') do
|
Puppet::Face.define(:yardoc, '0.0.1') do
|
||||||
|
|
||||||
|
@ -7,6 +6,17 @@ Puppet::Face.define(:yardoc, '0.0.1') do
|
||||||
default
|
default
|
||||||
|
|
||||||
when_invoked do |*args|
|
when_invoked do |*args|
|
||||||
|
|
||||||
|
unless Puppet.features.yard?
|
||||||
|
raise RuntimeError, "The 'yard' gem must be installed in order to use this face."
|
||||||
|
end
|
||||||
|
|
||||||
|
if Puppet.features.rgen?
|
||||||
|
require 'puppet/pops'
|
||||||
|
else
|
||||||
|
raise RuntimeError, "The 'rgen' gem must be installed in order to use this face."
|
||||||
|
end
|
||||||
|
|
||||||
parser = Puppet::Pops::Parser::Parser.new()
|
parser = Puppet::Pops::Parser::Parser.new()
|
||||||
parse_result = parser.parse_file(args[0])
|
parse_result = parser.parse_file(args[0])
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
require 'puppet/util/feature'
|
||||||
|
|
||||||
|
Puppet.features.add(:rgen, :libs => ['rgen/metamodel_builder', 'rgen/ecore/ecore'])
|
|
@ -0,0 +1,3 @@
|
||||||
|
require 'puppet/util/feature'
|
||||||
|
|
||||||
|
Puppet.features.add(:yard, :libs => ['yard'])
|
Loading…
Reference in New Issue