summaryrefslogtreecommitdiff
path: root/types
diff options
context:
space:
mode:
Diffstat (limited to 'types')
-rw-r--r--types/compat/absolute_path.pp7
-rw-r--r--types/compat/array.pp2
-rw-r--r--types/compat/bool.pp2
-rw-r--r--types/compat/re.pp3
-rw-r--r--types/compat/string.pp2
5 files changed, 16 insertions, 0 deletions
diff --git a/types/compat/absolute_path.pp b/types/compat/absolute_path.pp
new file mode 100644
index 0000000..d11784e
--- /dev/null
+++ b/types/compat/absolute_path.pp
@@ -0,0 +1,7 @@
+# Emulate the is_absolute_path and validate_absolute_path functions
+#
+# The first pattern is originally from is_absolute_path, which had it from 2.7.x's lib/puppet/util.rb Puppet::Util.absolute_path?
+# slash = '[\\\\/]'
+# name = '[^\\\\/]+'
+# %r!^(([A-Z]:#{slash})|(#{slash}#{slash}#{name}#{slash}#{name})|(#{slash}#{slash}\?#{slash}#{name}))!i,
+type Stdlib::Compat::Absolute_path = Variant[Pattern[/^(([a-zA-Z]:[\\\/])|([\\\/][\\\/][^\\\/]+[\\\/][^\\\/]+)|([\\\/][\\\/]\?[\\\/][^\\\/]+))/], Pattern[/^\//]]
diff --git a/types/compat/array.pp b/types/compat/array.pp
new file mode 100644
index 0000000..ba65dc4
--- /dev/null
+++ b/types/compat/array.pp
@@ -0,0 +1,2 @@
+# Emulate the is_array and validate_array functions
+type Stdlib::Compat::Array = Array[Any]
diff --git a/types/compat/bool.pp b/types/compat/bool.pp
new file mode 100644
index 0000000..dda5f4b
--- /dev/null
+++ b/types/compat/bool.pp
@@ -0,0 +1,2 @@
+ # Emulate the is_bool and validate_bool functions
+ type Stdlib::Compat::Bool = Boolean
diff --git a/types/compat/re.pp b/types/compat/re.pp
new file mode 100644
index 0000000..e4b5f30
--- /dev/null
+++ b/types/compat/re.pp
@@ -0,0 +1,3 @@
+# Emulate the validate_re function
+# validate_re(value, re) translates to Pattern[re], which is not directly mappable as a type alias, but can be specified as Pattern[re].
+# Therefore this needs to be translated directly.
diff --git a/types/compat/string.pp b/types/compat/string.pp
new file mode 100644
index 0000000..4c36e5f
--- /dev/null
+++ b/types/compat/string.pp
@@ -0,0 +1,2 @@
+# Emulate the is_string and validate_string functions
+type Stdlib::Compat::String = String