puppet-standalone-mashup/shared/lib/puppet/parser/functions/find_path.rb

11 lines
261 B
Ruby
Raw Normal View History

2012-07-20 14:49:47 +00:00
module Puppet::Parser::Functions
newfunction(:find_path, :type => :rvalue) do |name, root|
Pathname(root).find do |file|
return file.to_s if file.basename == name
end
raise StandardError.new("File not found in #{root}: #{name}")
end
end