From: Ken Barber Date: Sat, 30 Apr 2011 14:00:49 +0000 (+0200) Subject: Moved more functions into lib/puppet/parser/functions/ X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=aafce9c99b779855e1e10e5a337848fa9f676a01;p=puppet-stdlib.git Moved more functions into lib/puppet/parser/functions/ --- diff --git a/capitalize.rb b/lib/puppet/parser/functions/capitalize.rb similarity index 100% rename from capitalize.rb rename to lib/puppet/parser/functions/capitalize.rb diff --git a/chomp.rb b/lib/puppet/parser/functions/chomp.rb similarity index 100% rename from chomp.rb rename to lib/puppet/parser/functions/chomp.rb diff --git a/chop.rb b/lib/puppet/parser/functions/chop.rb similarity index 100% rename from chop.rb rename to lib/puppet/parser/functions/chop.rb diff --git a/date.rb b/lib/puppet/parser/functions/date.rb similarity index 100% rename from date.rb rename to lib/puppet/parser/functions/date.rb diff --git a/delete.rb b/lib/puppet/parser/functions/delete.rb similarity index 100% rename from delete.rb rename to lib/puppet/parser/functions/delete.rb diff --git a/downcase.rb b/lib/puppet/parser/functions/downcase.rb similarity index 100% rename from downcase.rb rename to lib/puppet/parser/functions/downcase.rb diff --git a/flatten.rb b/lib/puppet/parser/functions/flatten.rb similarity index 100% rename from flatten.rb rename to lib/puppet/parser/functions/flatten.rb diff --git a/grep.rb b/lib/puppet/parser/functions/grep.rb similarity index 100% rename from grep.rb rename to lib/puppet/parser/functions/grep.rb diff --git a/hash.rb b/lib/puppet/parser/functions/hash.rb similarity index 100% rename from hash.rb rename to lib/puppet/parser/functions/hash.rb diff --git a/is_float.rb b/lib/puppet/parser/functions/is_float.rb similarity index 100% rename from is_float.rb rename to lib/puppet/parser/functions/is_float.rb diff --git a/is_integer.rb b/lib/puppet/parser/functions/is_integer.rb similarity index 100% rename from is_integer.rb rename to lib/puppet/parser/functions/is_integer.rb diff --git a/is_numeric.rb b/lib/puppet/parser/functions/is_numeric.rb similarity index 100% rename from is_numeric.rb rename to lib/puppet/parser/functions/is_numeric.rb diff --git a/is_valid_domain_name.rb b/lib/puppet/parser/functions/is_valid_domain_name.rb similarity index 100% rename from is_valid_domain_name.rb rename to lib/puppet/parser/functions/is_valid_domain_name.rb diff --git a/is_valid_ip_address.rb b/lib/puppet/parser/functions/is_valid_ip_address.rb similarity index 100% rename from is_valid_ip_address.rb rename to lib/puppet/parser/functions/is_valid_ip_address.rb diff --git a/is_valid_mac_address.rb b/lib/puppet/parser/functions/is_valid_mac_address.rb similarity index 100% rename from is_valid_mac_address.rb rename to lib/puppet/parser/functions/is_valid_mac_address.rb diff --git a/is_valid_netmask.rb b/lib/puppet/parser/functions/is_valid_netmask.rb similarity index 100% rename from is_valid_netmask.rb rename to lib/puppet/parser/functions/is_valid_netmask.rb diff --git a/load_json.rb b/lib/puppet/parser/functions/load_json.rb similarity index 100% rename from load_json.rb rename to lib/puppet/parser/functions/load_json.rb diff --git a/load_yaml.rb b/lib/puppet/parser/functions/load_yaml.rb similarity index 100% rename from load_yaml.rb rename to lib/puppet/parser/functions/load_yaml.rb diff --git a/lstrip.rb b/lib/puppet/parser/functions/lstrip.rb similarity index 100% rename from lstrip.rb rename to lib/puppet/parser/functions/lstrip.rb diff --git a/lib/puppet/parser/functions/member.rb b/lib/puppet/parser/functions/member.rb index a491a76..bb43a37 100644 --- a/lib/puppet/parser/functions/member.rb +++ b/lib/puppet/parser/functions/member.rb @@ -1,28 +1,28 @@ # -# include.rb +# member.rb # # TODO(Krzysztof Wilczynski): We need to add support for regular expression ... # TODO(Krzysztof Wilczynski): Support for strings and hashes too ... module Puppet::Parser::Functions - newfunction(:includes, :type => :rvalue, :doc => <<-EOS + newfunction(:member, :type => :rvalue, :doc => <<-EOS EOS ) do |arguments| - raise(Puppet::ParseError, "includes(): Wrong number of arguments " + + raise(Puppet::ParseError, "member(): Wrong number of arguments " + "given (#{arguments.size} for 2)") if arguments.size < 2 array = arguments[0] - if not array.is_a?(Array) - raise(Puppet::ParseError, 'includes(): Requires an array to work with') + unless array.is_a?(Array) + raise(Puppet::ParseError, 'member(): Requires array to work with') end item = arguments[1] - raise(Puppet::ParseError, 'includes(): You must provide item ' + - 'to search for within given array') if item.empty? + raise(Puppet::ParseError, 'member(): You must provide item ' + + 'to search for within array given') if item.empty? result = array.include?(item) diff --git a/rand.rb b/lib/puppet/parser/functions/rand.rb similarity index 100% rename from rand.rb rename to lib/puppet/parser/functions/rand.rb diff --git a/rstrip.rb b/lib/puppet/parser/functions/rstrip.rb similarity index 100% rename from rstrip.rb rename to lib/puppet/parser/functions/rstrip.rb diff --git a/sort.rb b/lib/puppet/parser/functions/sort.rb similarity index 100% rename from sort.rb rename to lib/puppet/parser/functions/sort.rb diff --git a/squeeze.rb b/lib/puppet/parser/functions/squeeze.rb similarity index 100% rename from squeeze.rb rename to lib/puppet/parser/functions/squeeze.rb diff --git a/str2bool.rb b/lib/puppet/parser/functions/str2bool.rb similarity index 100% rename from str2bool.rb rename to lib/puppet/parser/functions/str2bool.rb diff --git a/strip.rb b/lib/puppet/parser/functions/strip.rb similarity index 100% rename from strip.rb rename to lib/puppet/parser/functions/strip.rb diff --git a/swapcase.rb b/lib/puppet/parser/functions/swapcase.rb similarity index 100% rename from swapcase.rb rename to lib/puppet/parser/functions/swapcase.rb diff --git a/upcase.rb b/lib/puppet/parser/functions/upcase.rb similarity index 100% rename from upcase.rb rename to lib/puppet/parser/functions/upcase.rb diff --git a/zip.rb b/lib/puppet/parser/functions/zip.rb similarity index 100% rename from zip.rb rename to lib/puppet/parser/functions/zip.rb diff --git a/member.rb b/member.rb deleted file mode 100644 index bb43a37..0000000 --- a/member.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# member.rb -# - -# TODO(Krzysztof Wilczynski): We need to add support for regular expression ... -# TODO(Krzysztof Wilczynski): Support for strings and hashes too ... - -module Puppet::Parser::Functions - newfunction(:member, :type => :rvalue, :doc => <<-EOS - EOS - ) do |arguments| - - raise(Puppet::ParseError, "member(): Wrong number of arguments " + - "given (#{arguments.size} for 2)") if arguments.size < 2 - - array = arguments[0] - - unless array.is_a?(Array) - raise(Puppet::ParseError, 'member(): Requires array to work with') - end - - item = arguments[1] - - raise(Puppet::ParseError, 'member(): You must provide item ' + - 'to search for within array given') if item.empty? - - result = array.include?(item) - - return result - end -end - -# vim: set ts=2 sw=2 et :