summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions/versioncmp.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions/versioncmp.rb')
-rw-r--r--lib/puppet/parser/functions/versioncmp.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/puppet/parser/functions/versioncmp.rb b/lib/puppet/parser/functions/versioncmp.rb
index e4edb151e..a7905a6d0 100644
--- a/lib/puppet/parser/functions/versioncmp.rb
+++ b/lib/puppet/parser/functions/versioncmp.rb
@@ -1,20 +1,19 @@
require 'puppet/util/package'
-
-Puppet::Parser::Functions::newfunction( :versioncmp, :type => :rvalue,
-:doc => "Compares two versions
+Puppet::Parser::Functions::newfunction( :versioncmp, :type => :rvalue, :doc =>
+"Compares two version numbers.
Prototype:
\$result = versioncmp(a, b)
-Where a and b are arbitrary version strings
+Where a and b are arbitrary version strings.
-This functions returns a number:
+This function returns:
-* Greater than 0 if version a is greater than version b
-* Equal to 0 if both version are equals
-* Less than 0 if version a is less than version b
+* `1` if version a is greater than version b
+* `0` if the versions are equal
+* `-1` if version a is less than version b
Example:
@@ -22,6 +21,9 @@ Example:
notice('2.6-1 is > than 2.4.5')
}
+This function uses the same version comparison algorithm used by Puppet's
+`package` type.
+
") do |args|
unless args.length == 2