diff --git a/lib/puppet/face/yardoc.rb b/lib/puppet/face/yardoc.rb index bb52f84..ce6f09c 100644 --- a/lib/puppet/face/yardoc.rb +++ b/lib/puppet/face/yardoc.rb @@ -14,6 +14,10 @@ Puppet::Face.define(:yardoc, '0.0.1') do raise RuntimeError, "The 'rgen' gem must be installed in order to use this face." end + if RUBY_VERSION < '1.9' && !Puppet.features.require_relative? + raise RuntimeError, "The 'backports' gem must be installed in order to use this face under Ruby 1.8.7." + end + # The last element of the argument array should be the options hash. # # NOTE: The Puppet Face will throw 'unrecognized option' errors if any diff --git a/lib/puppet/feature/require_relative.rb b/lib/puppet/feature/require_relative.rb new file mode 100644 index 0000000..2a677f0 --- /dev/null +++ b/lib/puppet/feature/require_relative.rb @@ -0,0 +1,4 @@ +require 'puppet/util/feature' + +# Support require_relative under Ruby 1.8.7. +Puppet.features.add(:require_relative, :libs => ['backports/1.9.1/kernel/require_relative'])