diff --git a/lib/puppet/face/yardoc.rb b/lib/puppet/face/yardoc.rb index b29faa5..bbb53e6 100644 --- a/lib/puppet/face/yardoc.rb +++ b/lib/puppet/face/yardoc.rb @@ -1,5 +1,4 @@ require 'puppet/face' -require 'puppet/pops' Puppet::Face.define(:yardoc, '0.0.1') do @@ -7,6 +6,17 @@ Puppet::Face.define(:yardoc, '0.0.1') do default 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() parse_result = parser.parse_file(args[0]) diff --git a/lib/puppet/feature/rgen.rb b/lib/puppet/feature/rgen.rb new file mode 100644 index 0000000..0ab9263 --- /dev/null +++ b/lib/puppet/feature/rgen.rb @@ -0,0 +1,3 @@ +require 'puppet/util/feature' + +Puppet.features.add(:rgen, :libs => ['rgen/metamodel_builder', 'rgen/ecore/ecore']) diff --git a/lib/puppet/feature/yard.rb b/lib/puppet/feature/yard.rb new file mode 100644 index 0000000..aab7f6c --- /dev/null +++ b/lib/puppet/feature/yard.rb @@ -0,0 +1,3 @@ +require 'puppet/util/feature' + +Puppet.features.add(:yard, :libs => ['yard'])