puppet 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COMMITTERS.md +2 -2
- data/CONTRIBUTING.md +51 -10
- data/Gemfile +27 -14
- data/LICENSE +3 -3
- data/MAINTAINERS +66 -0
- data/README.md +9 -11
- data/Rakefile +36 -0
- data/conf/auth.conf +23 -2
- data/conf/fileserver.conf +7 -12
- data/conf/hiera.yaml +11 -0
- data/conf/puppet.conf +1 -1
- data/ext/README.environment +1 -1
- data/ext/build_defaults.yaml +10 -37
- data/ext/debian/README.source +1 -1
- data/ext/debian/control +3 -5
- data/ext/debian/copyright +4 -4
- data/ext/debian/puppet-common.install +0 -1
- data/ext/debian/puppet-common.manpages +0 -2
- data/ext/debian/puppet.default +0 -5
- data/ext/debian/puppet.init +1 -16
- data/ext/debian/puppet.logrotate +14 -5
- data/ext/debian/puppetmaster.README.debian +11 -9
- data/ext/envpuppet +2 -2
- data/ext/hiera/hiera.yaml +15 -0
- data/ext/ips/puppetagent.xml +1 -1
- data/ext/ips/puppetmaster.xml +1 -1
- data/ext/logcheck/puppet +1 -1
- data/ext/osx/puppet.plist +30 -0
- data/ext/project_data.yaml +29 -16
- data/ext/puppet-test +3 -27
- data/ext/rack/config.ru +2 -2
- data/ext/rack/example-passenger-vhost.conf +1 -1
- data/ext/redhat/client.init +67 -17
- data/ext/redhat/client.sysconfig +1 -10
- data/ext/redhat/logrotate +15 -3
- data/ext/redhat/puppet.spec.erb +6 -14
- data/ext/redhat/server.init +1 -1
- data/ext/regexp_nodes/regexp_nodes.rb +1 -1
- data/ext/solaris/pkginfo +1 -1
- data/ext/solaris/smf/puppet +44 -0
- data/ext/solaris/smf/puppet.xml +44 -0
- data/ext/suse/client.init +30 -33
- data/ext/suse/puppet.spec +2 -2
- data/ext/suse/server.init +2 -2
- data/ext/systemd/puppet.service +13 -1
- data/ext/upload_facts.rb +1 -1
- data/ext/windows/puppet_interactive.bat +6 -0
- data/ext/windows/puppet_shell.bat +9 -0
- data/ext/windows/run_puppet_interactive.bat +9 -0
- data/ext/windows/service/daemon.rb +10 -15
- data/ext/yaml_nodes.rb +1 -1
- data/install.rb +99 -66
- data/lib/hiera/puppet_function.rb +28 -18
- data/lib/hiera/scope.rb +12 -14
- data/lib/hiera_puppet.rb +6 -14
- data/lib/puppet/agent/disabler.rb +3 -3
- data/lib/puppet/agent/locker.rb +12 -3
- data/lib/puppet/agent.rb +35 -39
- data/lib/puppet/application/agent.rb +53 -25
- data/lib/puppet/application/apply.rb +83 -28
- data/lib/puppet/application/ca.rb +1 -0
- data/lib/puppet/application/cert.rb +54 -5
- data/lib/puppet/application/describe.rb +2 -2
- data/lib/puppet/application/device.rb +80 -50
- data/lib/puppet/application/doc.rb +9 -9
- data/lib/puppet/application/face_base.rb +11 -12
- data/lib/puppet/application/filebucket.rb +84 -10
- data/lib/puppet/application/generate.rb +5 -0
- data/lib/puppet/application/lookup.rb +357 -0
- data/lib/puppet/application/master.rb +33 -26
- data/lib/puppet/application/resource.rb +22 -23
- data/lib/puppet/application.rb +31 -15
- data/lib/puppet/application_support.rb +1 -1
- data/lib/puppet/compilable_resource_type.rb +15 -0
- data/lib/puppet/configurer/downloader.rb +2 -2
- data/lib/puppet/configurer/fact_handler.rb +13 -4
- data/lib/puppet/configurer/plugin_handler.rb +7 -5
- data/lib/puppet/configurer.rb +198 -55
- data/lib/puppet/context/trusted_information.rb +22 -2
- data/lib/puppet/context.rb +20 -5
- data/lib/puppet/daemon.rb +17 -13
- data/lib/puppet/data_binding.rb +4 -2
- data/lib/puppet/defaults.rb +309 -123
- data/lib/puppet/environments.rb +105 -10
- data/lib/puppet/error.rb +32 -2
- data/lib/puppet/etc.rb +161 -0
- data/lib/puppet/external/dot.rb +1 -1
- data/lib/puppet/external/pson/common.rb +4 -0
- data/lib/puppet/face/ca.rb +56 -44
- data/lib/puppet/face/catalog/select.rb +4 -4
- data/lib/puppet/face/catalog.rb +3 -3
- data/lib/puppet/face/certificate.rb +28 -22
- data/lib/puppet/face/certificate_request.rb +3 -1
- data/lib/puppet/face/certificate_revocation_list.rb +3 -1
- data/lib/puppet/face/config.rb +12 -12
- data/lib/puppet/face/epp.rb +96 -50
- data/lib/puppet/face/facts.rb +5 -5
- data/lib/puppet/face/generate.rb +64 -0
- data/lib/puppet/face/help/face.erb +3 -0
- data/lib/puppet/face/help/man.erb +1 -1
- data/lib/puppet/face/help.rb +37 -29
- data/lib/puppet/face/key.rb +4 -3
- data/lib/puppet/face/man.rb +12 -10
- data/lib/puppet/face/module/build.rb +7 -7
- data/lib/puppet/face/module/changes.rb +8 -7
- data/lib/puppet/face/module/generate.rb +25 -25
- data/lib/puppet/face/module/install.rb +19 -15
- data/lib/puppet/face/module/list.rb +16 -12
- data/lib/puppet/face/module/search.rb +4 -4
- data/lib/puppet/face/module/uninstall.rb +13 -10
- data/lib/puppet/face/module/upgrade.rb +11 -7
- data/lib/puppet/face/module.rb +3 -3
- data/lib/puppet/face/node/clean.rb +8 -8
- data/lib/puppet/face/node.rb +6 -6
- data/lib/puppet/face/parser.rb +28 -25
- data/lib/puppet/face/plugin.rb +14 -21
- data/lib/puppet/face/report.rb +10 -10
- data/lib/puppet/face/resource.rb +13 -13
- data/lib/puppet/face/status.rb +9 -6
- data/lib/puppet/feature/base.rb +13 -5
- data/lib/puppet/feature/cfpropertylist.rb +3 -0
- data/lib/puppet/feature/eventlog.rb +1 -1
- data/lib/puppet/feature/hiera_eyaml.rb +3 -0
- data/lib/puppet/feature/hocon.rb +3 -0
- data/lib/puppet/feature/telnet.rb +9 -0
- data/lib/puppet/file_bucket/dipper.rb +62 -6
- data/lib/puppet/file_bucket/file.rb +4 -17
- data/lib/puppet/file_serving/base.rb +3 -3
- data/lib/puppet/file_serving/configuration/parser.rb +12 -12
- data/lib/puppet/file_serving/configuration.rb +3 -3
- data/lib/puppet/file_serving/content.rb +1 -1
- data/lib/puppet/file_serving/fileset.rb +7 -5
- data/lib/puppet/file_serving/http_metadata.rb +46 -0
- data/lib/puppet/file_serving/metadata.rb +33 -12
- data/lib/puppet/file_serving/mount/file.rb +6 -6
- data/lib/puppet/file_serving/mount/modules.rb +1 -1
- data/lib/puppet/file_serving/mount.rb +1 -1
- data/lib/puppet/file_serving/terminus_helper.rb +7 -8
- data/lib/puppet/file_serving/terminus_selector.rb +3 -1
- data/lib/puppet/file_system/file_impl.rb +13 -4
- data/lib/puppet/file_system/memory_impl.rb +10 -2
- data/lib/puppet/file_system/path_pattern.rb +7 -6
- data/lib/puppet/file_system/uniquefile.rb +5 -5
- data/lib/puppet/file_system/windows.rb +39 -16
- data/lib/puppet/file_system.rb +46 -5
- data/lib/puppet/forge/cache.rb +1 -0
- data/lib/puppet/forge/errors.rb +12 -12
- data/lib/puppet/forge/repository.rb +5 -36
- data/lib/puppet/forge.rb +17 -15
- data/lib/puppet/functions/alert.rb +14 -0
- data/lib/puppet/functions/annotate.rb +108 -0
- data/lib/puppet/functions/assert_type.rb +53 -19
- data/lib/puppet/functions/binary_file.rb +19 -0
- data/lib/puppet/functions/break.rb +22 -0
- data/lib/puppet/functions/call.rb +42 -0
- data/lib/puppet/functions/contain.rb +33 -0
- data/lib/puppet/functions/crit.rb +14 -0
- data/lib/puppet/functions/debug.rb +14 -0
- data/lib/puppet/functions/defined.rb +160 -0
- data/lib/puppet/functions/dig.rb +23 -0
- data/lib/puppet/functions/each.rb +89 -39
- data/lib/puppet/functions/emerg.rb +14 -0
- data/lib/puppet/functions/epp.rb +29 -37
- data/lib/puppet/functions/err.rb +14 -0
- data/lib/puppet/functions/eyaml_lookup_key.rb +94 -0
- data/lib/puppet/functions/filter.rb +64 -38
- data/lib/puppet/functions/find_file.rb +31 -0
- data/lib/puppet/functions/hiera.rb +83 -3
- data/lib/puppet/functions/hiera_array.rb +73 -4
- data/lib/puppet/functions/hiera_hash.rb +82 -2
- data/lib/puppet/functions/hiera_include.rb +93 -6
- data/lib/puppet/functions/hocon_data.rb +41 -0
- data/lib/puppet/functions/include.rb +21 -0
- data/lib/puppet/functions/info.rb +14 -0
- data/lib/puppet/functions/inline_epp.rb +44 -71
- data/lib/puppet/functions/json_data.rb +33 -0
- data/lib/puppet/functions/lest.rb +17 -0
- data/lib/puppet/functions/lookup.rb +172 -184
- data/lib/puppet/functions/map.rb +60 -33
- data/lib/puppet/functions/match.rb +32 -14
- data/lib/puppet/functions/new.rb +31 -0
- data/lib/puppet/functions/next.rb +23 -0
- data/lib/puppet/functions/notice.rb +14 -0
- data/lib/puppet/functions/reduce.rb +112 -71
- data/lib/puppet/functions/regsubst.rb +23 -26
- data/lib/puppet/functions/require.rb +37 -0
- data/lib/puppet/functions/return.rb +22 -0
- data/lib/puppet/functions/reverse_each.rb +25 -0
- data/lib/puppet/functions/scanf.rb +15 -18
- data/lib/puppet/functions/slice.rb +25 -39
- data/lib/puppet/functions/split.rb +3 -3
- data/lib/puppet/functions/step.rb +26 -0
- data/lib/puppet/functions/strftime.rb +43 -0
- data/lib/puppet/functions/then.rb +14 -0
- data/lib/puppet/functions/type.rb +31 -0
- data/lib/puppet/functions/unique.rb +132 -0
- data/lib/puppet/functions/unwrap.rb +40 -0
- data/lib/puppet/functions/versioncmp.rb +36 -0
- data/lib/puppet/functions/warning.rb +14 -0
- data/lib/puppet/functions/with.rb +15 -7
- data/lib/puppet/functions/yaml_data.rb +42 -0
- data/lib/puppet/functions.rb +226 -76
- data/lib/puppet/generate/models/type/property.rb +70 -0
- data/lib/puppet/generate/models/type/type.rb +62 -0
- data/lib/puppet/generate/templates/type/pcore.erb +42 -0
- data/lib/puppet/generate/type.rb +239 -0
- data/lib/puppet/graph/rb_tree_map.rb +1 -1
- data/lib/puppet/graph/relationship_graph.rb +4 -1
- data/lib/puppet/graph/simple_graph.rb +51 -74
- data/lib/puppet/indirector/catalog/compiler.rb +242 -38
- data/lib/puppet/indirector/catalog/json.rb +18 -0
- data/lib/puppet/indirector/certificate/disabled_ca.rb +1 -1
- data/lib/puppet/indirector/certificate_request/ca.rb +3 -3
- data/lib/puppet/indirector/certificate_request/disabled_ca.rb +1 -1
- data/lib/puppet/indirector/certificate_revocation_list/disabled_ca.rb +1 -1
- data/lib/puppet/indirector/certificate_status/file.rb +6 -6
- data/lib/puppet/indirector/data_binding/none.rb +4 -1
- data/lib/puppet/indirector/exec.rb +2 -2
- data/lib/puppet/indirector/face.rb +24 -19
- data/lib/puppet/indirector/facts/facter.rb +9 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +142 -29
- data/lib/puppet/indirector/file_content/http.rb +15 -0
- data/lib/puppet/indirector/file_metadata/http.rb +27 -0
- data/lib/puppet/indirector/file_server.rb +10 -2
- data/lib/puppet/indirector/generic_http.rb +16 -0
- data/lib/puppet/indirector/hiera.rb +12 -4
- data/lib/puppet/indirector/indirection.rb +25 -18
- data/lib/puppet/indirector/json.rb +11 -12
- data/lib/puppet/indirector/key/ca.rb +2 -2
- data/lib/puppet/indirector/key/disabled_ca.rb +1 -1
- data/lib/puppet/indirector/key/file.rb +4 -3
- data/lib/puppet/indirector/ldap.rb +6 -5
- data/lib/puppet/indirector/memory.rb +1 -1
- data/lib/puppet/indirector/msgpack.rb +9 -8
- data/lib/puppet/indirector/node/exec.rb +9 -7
- data/lib/puppet/indirector/node/ldap.rb +10 -8
- data/lib/puppet/indirector/node/plain.rb +2 -1
- data/lib/puppet/indirector/node/write_only_yaml.rb +6 -1
- data/lib/puppet/indirector/node/yaml.rb +0 -9
- data/lib/puppet/indirector/report/processor.rb +2 -2
- data/lib/puppet/indirector/report/rest.rb +13 -0
- data/lib/puppet/indirector/request.rb +40 -23
- data/lib/puppet/indirector/resource/ral.rb +1 -1
- data/lib/puppet/indirector/resource/validator.rb +1 -1
- data/lib/puppet/indirector/rest.rb +103 -10
- data/lib/puppet/indirector/ssl_file.rb +33 -12
- data/lib/puppet/indirector/terminus.rb +7 -7
- data/lib/puppet/indirector/yaml.rb +5 -5
- data/lib/puppet/indirector.rb +2 -2
- data/lib/puppet/info_service/class_information_service.rb +110 -0
- data/lib/puppet/info_service.rb +7 -0
- data/lib/puppet/interface/documentation.rb +1 -1
- data/lib/puppet/interface/face_collection.rb +7 -2
- data/lib/puppet/interface.rb +12 -4
- data/lib/puppet/loaders.rb +6 -0
- data/lib/puppet/metatype/manager.rb +25 -8
- data/lib/puppet/module.rb +73 -34
- data/lib/puppet/module_tool/applications/application.rb +8 -9
- data/lib/puppet/module_tool/applications/builder.rb +9 -9
- data/lib/puppet/module_tool/applications/checksummer.rb +2 -2
- data/lib/puppet/module_tool/applications/installer.rb +21 -20
- data/lib/puppet/module_tool/applications/searcher.rb +1 -1
- data/lib/puppet/module_tool/applications/uninstaller.rb +2 -1
- data/lib/puppet/module_tool/applications/unpacker.rb +4 -4
- data/lib/puppet/module_tool/applications/upgrader.rb +19 -18
- data/lib/puppet/module_tool/checksums.rb +1 -1
- data/lib/puppet/module_tool/contents_description.rb +1 -1
- data/lib/puppet/module_tool/dependency.rb +0 -1
- data/lib/puppet/module_tool/errors/installer.rb +23 -23
- data/lib/puppet/module_tool/errors/shared.rb +44 -42
- data/lib/puppet/module_tool/errors/uninstaller.rb +13 -9
- data/lib/puppet/module_tool/errors/upgrader.rb +11 -11
- data/lib/puppet/module_tool/install_directory.rb +1 -1
- data/lib/puppet/module_tool/installed_modules.rb +10 -10
- data/lib/puppet/module_tool/local_tarball.rb +7 -7
- data/lib/puppet/module_tool/metadata.rb +47 -21
- data/lib/puppet/module_tool/shared_behaviors.rb +6 -6
- data/lib/puppet/module_tool/skeleton/templates/generator/Gemfile +14 -3
- data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +48 -38
- data/lib/puppet/module_tool/skeleton/templates/generator/Rakefile +19 -4
- data/lib/puppet/module_tool/skeleton/templates/generator/{tests → examples}/init.pp.erb +3 -3
- data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +25 -18
- data/lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb +1 -2
- data/lib/puppet/module_tool/tar/mini.rb +3 -3
- data/lib/puppet/module_tool/tar.rb +5 -4
- data/lib/puppet/module_tool.rb +11 -7
- data/lib/puppet/network/auth_config_parser.rb +13 -12
- data/lib/puppet/network/authconfig.rb +23 -3
- data/lib/puppet/network/authorization.rb +8 -1
- data/lib/puppet/network/authstore.rb +2 -2
- data/lib/puppet/network/format.rb +7 -7
- data/lib/puppet/network/format_handler.rb +12 -9
- data/lib/puppet/network/format_support.rb +11 -5
- data/lib/puppet/network/formats.rb +38 -27
- data/lib/puppet/network/http/api/indirected_routes.rb +86 -58
- data/lib/puppet/network/http/api/master/v3/environment.rb +82 -0
- data/lib/puppet/network/http/api/master/v3.rb +7 -1
- data/lib/puppet/network/http/compression.rb +12 -8
- data/lib/puppet/network/http/connection.rb +21 -15
- data/lib/puppet/network/http/error.rb +14 -10
- data/lib/puppet/network/http/factory.rb +8 -4
- data/lib/puppet/network/http/handler.rb +11 -6
- data/lib/puppet/network/http/issues.rb +1 -0
- data/lib/puppet/network/http/pool.rb +10 -1
- data/lib/puppet/network/http/rack/rest.rb +27 -3
- data/lib/puppet/network/http/rack.rb +2 -2
- data/lib/puppet/network/http/request.rb +34 -20
- data/lib/puppet/network/http/response.rb +13 -1
- data/lib/puppet/network/http/webrick/rest.rb +2 -2
- data/lib/puppet/network/http/webrick.rb +7 -6
- data/lib/puppet/network/rights.rb +7 -17
- data/lib/puppet/network/server.rb +2 -2
- data/lib/puppet/node/environment.rb +73 -17
- data/lib/puppet/node/facts.rb +1 -6
- data/lib/puppet/node.rb +61 -18
- data/lib/puppet/parameter/boolean.rb +1 -1
- data/lib/puppet/parameter/package_options.rb +1 -1
- data/lib/puppet/parameter/path.rb +3 -3
- data/lib/puppet/parameter/value.rb +1 -1
- data/lib/puppet/parameter/value_collection.rb +4 -4
- data/lib/puppet/parameter.rb +24 -29
- data/lib/puppet/parser/ast/node.rb +1 -1
- data/lib/puppet/parser/ast/pops_bridge.rb +103 -29
- data/lib/puppet/parser/ast/resource.rb +5 -0
- data/lib/puppet/parser/ast/resource_instance.rb +5 -1
- data/lib/puppet/parser/ast/resourceparam.rb +5 -0
- data/lib/puppet/parser/ast.rb +5 -0
- data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +64 -0
- data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +57 -0
- data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +20 -0
- data/lib/puppet/parser/compiler/catalog_validator.rb +33 -0
- data/lib/puppet/parser/compiler.rb +351 -128
- data/lib/puppet/parser/e4_parser_adapter.rb +14 -14
- data/lib/puppet/parser/environment_compiler.rb +199 -0
- data/lib/puppet/parser/functions/assert_type.rb +47 -17
- data/lib/puppet/parser/functions/binary_file.rb +24 -0
- data/lib/puppet/parser/functions/break.rb +39 -0
- data/lib/puppet/parser/functions/contain.rb +7 -15
- data/lib/puppet/parser/functions/create_resources.rb +49 -25
- data/lib/puppet/parser/functions/defined.rb +106 -69
- data/lib/puppet/parser/functions/dig.rb +29 -0
- data/lib/puppet/parser/functions/each.rb +86 -28
- data/lib/puppet/parser/functions/epp.rb +30 -38
- data/lib/puppet/parser/functions/file.rb +4 -2
- data/lib/puppet/parser/functions/filter.rb +60 -24
- data/lib/puppet/parser/functions/find_file.rb +28 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +3 -3
- data/lib/puppet/parser/functions/generate.rb +5 -4
- data/lib/puppet/parser/functions/hiera.rb +98 -28
- data/lib/puppet/parser/functions/hiera_array.rb +86 -29
- data/lib/puppet/parser/functions/hiera_hash.rb +96 -31
- data/lib/puppet/parser/functions/hiera_include.rb +96 -41
- data/lib/puppet/parser/functions/include.rb +5 -8
- data/lib/puppet/parser/functions/inline_epp.rb +36 -61
- data/lib/puppet/parser/functions/inline_template.rb +3 -3
- data/lib/puppet/parser/functions/lest.rb +49 -0
- data/lib/puppet/parser/functions/lookup.rb +129 -151
- data/lib/puppet/parser/functions/map.rb +56 -21
- data/lib/puppet/parser/functions/match.rb +29 -13
- data/lib/puppet/parser/functions/new.rb +939 -0
- data/lib/puppet/parser/functions/next.rb +38 -0
- data/lib/puppet/parser/functions/reduce.rb +98 -61
- data/lib/puppet/parser/functions/regsubst.rb +4 -2
- data/lib/puppet/parser/functions/require.rb +4 -27
- data/lib/puppet/parser/functions/return.rb +71 -0
- data/lib/puppet/parser/functions/reverse_each.rb +83 -0
- data/lib/puppet/parser/functions/scanf.rb +25 -31
- data/lib/puppet/parser/functions/slice.rb +18 -25
- data/lib/puppet/parser/functions/split.rb +2 -2
- data/lib/puppet/parser/functions/step.rb +84 -0
- data/lib/puppet/parser/functions/strftime.rb +185 -0
- data/lib/puppet/parser/functions/then.rb +73 -0
- data/lib/puppet/parser/functions/type.rb +53 -0
- data/lib/puppet/parser/functions/with.rb +17 -9
- data/lib/puppet/parser/functions.rb +39 -21
- data/lib/puppet/parser/parser_factory.rb +0 -30
- data/lib/puppet/parser/relationship.rb +49 -20
- data/lib/puppet/parser/resource/param.rb +0 -3
- data/lib/puppet/parser/resource.rb +165 -50
- data/lib/puppet/parser/scope.rb +419 -200
- data/lib/puppet/parser/templatewrapper.rb +4 -3
- data/lib/puppet/parser/type_loader.rb +2 -2
- data/lib/puppet/parser.rb +3 -1
- data/lib/puppet/plugins/configuration.rb +15 -58
- data/lib/puppet/plugins/syntax_checkers.rb +6 -11
- data/lib/puppet/pops/adaptable.rb +12 -7
- data/lib/puppet/pops/adapters.rb +102 -73
- data/lib/puppet/pops/evaluator/access_operator.rb +248 -158
- data/lib/puppet/pops/evaluator/callable_signature.rb +7 -0
- data/lib/puppet/pops/evaluator/closure.rb +251 -109
- data/lib/puppet/pops/evaluator/collector_transformer.rb +51 -37
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +6 -2
- data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +8 -5
- data/lib/puppet/pops/evaluator/compare_operator.rb +113 -13
- data/lib/puppet/pops/evaluator/epp_evaluator.rb +17 -11
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +281 -151
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +2 -9
- data/lib/puppet/pops/evaluator/json_strict_literal_evaluator.rb +82 -0
- data/lib/puppet/pops/evaluator/literal_evaluator.rb +87 -0
- data/lib/puppet/pops/evaluator/puppet_proc.rb +1 -1
- data/lib/puppet/pops/evaluator/relationship_operator.rb +44 -20
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +74 -49
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +117 -0
- data/lib/puppet/pops/evaluator/runtime3_support.rb +142 -91
- data/lib/puppet/pops/functions/dispatch.rb +34 -14
- data/lib/puppet/pops/functions/dispatcher.rb +17 -16
- data/lib/puppet/pops/functions/function.rb +30 -4
- data/lib/puppet/pops/issue_reporter.rb +49 -21
- data/lib/puppet/pops/issues.rb +404 -102
- data/lib/puppet/pops/label_provider.rb +18 -4
- data/lib/puppet/pops/loader/base_loader.rb +74 -20
- data/lib/puppet/pops/loader/dependency_loader.rb +27 -2
- data/lib/puppet/pops/loader/gem_support.rb +2 -2
- data/lib/puppet/pops/loader/loader.rb +57 -48
- data/lib/puppet/pops/loader/loader_paths.rb +113 -6
- data/lib/puppet/pops/loader/module_loaders.rb +128 -35
- data/lib/puppet/pops/loader/null_loader.rb +17 -1
- data/lib/puppet/pops/loader/predefined_loader.rb +24 -0
- data/lib/puppet/pops/loader/puppet_function_instantiator.rb +84 -0
- data/lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb +79 -0
- data/lib/puppet/pops/loader/ruby_function_instantiator.rb +19 -7
- data/lib/puppet/pops/loader/runtime3_type_loader.rb +96 -0
- data/lib/puppet/pops/loader/static_loader.rb +111 -41
- data/lib/puppet/pops/loader/type_definition_instantiator.rb +93 -0
- data/lib/puppet/pops/loader/typed_name.rb +54 -0
- data/lib/puppet/pops/loaders.rb +213 -31
- data/lib/puppet/pops/lookup/configured_data_provider.rb +93 -0
- data/lib/puppet/pops/lookup/context.rb +200 -0
- data/lib/puppet/pops/lookup/data_adapter.rb +27 -0
- data/lib/puppet/pops/lookup/data_dig_function_provider.rb +145 -0
- data/lib/puppet/pops/lookup/data_hash_function_provider.rb +126 -0
- data/lib/puppet/pops/lookup/data_provider.rb +92 -0
- data/lib/puppet/pops/lookup/environment_data_provider.rb +35 -0
- data/lib/puppet/pops/lookup/explainer.rb +594 -0
- data/lib/puppet/pops/lookup/function_provider.rb +110 -0
- data/lib/puppet/pops/lookup/global_data_provider.rb +75 -0
- data/lib/puppet/pops/lookup/hiera_config.rb +761 -0
- data/lib/puppet/pops/lookup/interpolation.rb +154 -0
- data/lib/puppet/pops/lookup/invocation.rb +261 -0
- data/lib/puppet/pops/lookup/location_resolver.rb +99 -0
- data/lib/puppet/pops/lookup/lookup_adapter.rb +471 -0
- data/lib/puppet/pops/lookup/lookup_key.rb +99 -0
- data/lib/puppet/pops/lookup/lookup_key_function_provider.rb +92 -0
- data/lib/puppet/pops/lookup/module_data_provider.rb +89 -0
- data/lib/puppet/pops/lookup/sub_lookup.rb +92 -0
- data/lib/puppet/pops/lookup.rb +49 -49
- data/lib/puppet/pops/merge_strategy.rb +197 -46
- data/lib/puppet/pops/migration/migration_checker.rb +58 -0
- data/lib/puppet/pops/model/ast.pp +692 -0
- data/lib/puppet/pops/model/ast.rb +4833 -0
- data/lib/puppet/pops/model/ast_transformer.rb +15 -9
- data/lib/puppet/pops/model/factory.rb +550 -527
- data/lib/puppet/pops/model/model_label_provider.rb +33 -8
- data/lib/puppet/pops/model/model_tree_dumper.rb +52 -7
- data/lib/puppet/pops/parser/code_merger.rb +13 -1
- data/lib/puppet/pops/parser/egrammar.ra +190 -67
- data/lib/puppet/pops/parser/eparser.rb +1823 -1338
- data/lib/puppet/pops/parser/epp_support.rb +27 -12
- data/lib/puppet/pops/parser/evaluating_parser.rb +31 -17
- data/lib/puppet/pops/parser/heredoc_support.rb +20 -16
- data/lib/puppet/pops/parser/interpolation_support.rb +18 -5
- data/lib/puppet/pops/parser/lexer2.rb +460 -383
- data/lib/puppet/pops/parser/lexer_support.rb +132 -25
- data/lib/puppet/pops/parser/locator.rb +86 -9
- data/lib/puppet/pops/parser/parser_support.rb +59 -54
- data/lib/puppet/pops/parser/slurp_support.rb +37 -12
- data/lib/puppet/pops/patterns.rb +16 -1
- data/lib/puppet/pops/pcore.rb +103 -0
- data/lib/puppet/pops/puppet_stack.rb +43 -0
- data/lib/puppet/pops/resource/param.rb +55 -0
- data/lib/puppet/pops/resource/resource_type_impl.rb +314 -0
- data/lib/puppet/pops/resource/resource_type_set.pcore +22 -0
- data/lib/puppet/pops/semantic_error.rb +12 -0
- data/lib/puppet/pops/serialization/abstract_reader.rb +176 -0
- data/lib/puppet/pops/serialization/abstract_writer.rb +215 -0
- data/lib/puppet/pops/serialization/deserializer.rb +80 -0
- data/lib/puppet/pops/serialization/extension.rb +157 -0
- data/lib/puppet/pops/serialization/from_data_converter.rb +181 -0
- data/lib/puppet/pops/serialization/instance_reader.rb +19 -0
- data/lib/puppet/pops/serialization/instance_writer.rb +14 -0
- data/lib/puppet/pops/serialization/json.rb +297 -0
- data/lib/puppet/pops/serialization/json_path.rb +126 -0
- data/lib/puppet/pops/serialization/object.rb +71 -0
- data/lib/puppet/pops/serialization/serializer.rb +139 -0
- data/lib/puppet/pops/serialization/time_factory.rb +67 -0
- data/lib/puppet/pops/serialization/to_data_converter.rb +292 -0
- data/lib/puppet/pops/serialization.rb +41 -0
- data/lib/puppet/pops/time/timespan.rb +718 -0
- data/lib/puppet/pops/time/timestamp.rb +148 -0
- data/lib/puppet/pops/types/annotatable.rb +36 -0
- data/lib/puppet/pops/types/annotation.rb +71 -0
- data/lib/puppet/pops/types/class_loader.rb +29 -29
- data/lib/puppet/pops/types/enumeration.rb +9 -27
- data/lib/puppet/pops/types/implementation_registry.rb +141 -0
- data/lib/puppet/pops/types/iterable.rb +308 -0
- data/lib/puppet/pops/types/p_binary_type.rb +226 -0
- data/lib/puppet/pops/types/p_meta_type.rb +87 -0
- data/lib/puppet/pops/types/p_object_type.rb +925 -0
- data/lib/puppet/pops/types/p_runtime_type.rb +115 -0
- data/lib/puppet/pops/types/p_sem_ver_range_type.rb +191 -0
- data/lib/puppet/pops/types/p_sem_ver_type.rb +141 -0
- data/lib/puppet/pops/types/p_sensitive_type.rb +73 -0
- data/lib/puppet/pops/types/p_timespan_type.rb +192 -0
- data/lib/puppet/pops/types/p_timestamp_type.rb +69 -0
- data/lib/puppet/pops/types/p_type_set_type.rb +360 -0
- data/lib/puppet/pops/types/puppet_object.rb +26 -0
- data/lib/puppet/pops/types/recursion_guard.rb +136 -0
- data/lib/puppet/pops/types/ruby_generator.rb +439 -0
- data/lib/puppet/pops/types/ruby_method.rb +31 -0
- data/lib/puppet/pops/types/string_converter.rb +1099 -0
- data/lib/puppet/pops/types/type_acceptor.rb +25 -0
- data/lib/puppet/pops/types/type_asserter.rb +21 -19
- data/lib/puppet/pops/types/type_assertion_error.rb +1 -0
- data/lib/puppet/pops/types/type_calculator.rb +252 -1232
- data/lib/puppet/pops/types/type_conversion_error.rb +15 -0
- data/lib/puppet/pops/types/type_factory.rb +300 -166
- data/lib/puppet/pops/types/type_formatter.rb +734 -0
- data/lib/puppet/pops/types/type_mismatch_describer.rb +1106 -0
- data/lib/puppet/pops/types/type_parser.rb +382 -275
- data/lib/puppet/pops/types/type_set_reference.rb +59 -0
- data/lib/puppet/pops/types/types.rb +3287 -289
- data/lib/puppet/pops/utils.rb +7 -30
- data/lib/puppet/pops/validation/checker4_0.rb +353 -125
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +13 -5
- data/lib/puppet/pops/validation.rb +50 -18
- data/lib/puppet/pops/visitor.rb +30 -6
- data/lib/puppet/pops.rb +46 -57
- data/lib/puppet/property/ensure.rb +4 -4
- data/lib/puppet/property/list.rb +1 -10
- data/lib/puppet/property.rb +84 -21
- data/lib/puppet/provider/aixobject.rb +11 -11
- data/lib/puppet/provider/augeas/augeas.rb +89 -34
- data/lib/puppet/provider/command.rb +1 -1
- data/lib/puppet/provider/cron/crontab.rb +3 -3
- data/lib/puppet/provider/exec/posix.rb +4 -4
- data/lib/puppet/provider/exec/windows.rb +4 -4
- data/lib/puppet/provider/exec.rb +14 -7
- data/lib/puppet/provider/file/posix.rb +5 -5
- data/lib/puppet/provider/file/windows.rb +4 -4
- data/lib/puppet/provider/group/aix.rb +6 -6
- data/lib/puppet/provider/group/directoryservice.rb +10 -0
- data/lib/puppet/provider/group/groupadd.rb +2 -2
- data/lib/puppet/provider/group/pw.rb +2 -1
- data/lib/puppet/provider/group/windows_adsi.rb +23 -7
- data/lib/puppet/provider/host/parsed.rb +1 -1
- data/lib/puppet/provider/macauthorization/macauthorization.rb +20 -19
- data/lib/puppet/provider/mailalias/aliases.rb +1 -1
- data/lib/puppet/provider/maillist/mailman.rb +2 -2
- data/lib/puppet/provider/mcx/mcxcontent.rb +6 -5
- data/lib/puppet/provider/mount/parsed.rb +162 -3
- data/lib/puppet/provider/mount.rb +2 -1
- data/lib/puppet/provider/naginator.rb +1 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +65 -72
- data/lib/puppet/provider/nameservice.rb +40 -17
- data/lib/puppet/provider/network_device.rb +2 -1
- data/lib/puppet/provider/package/aix.rb +5 -5
- data/lib/puppet/provider/package/appdmg.rb +7 -6
- data/lib/puppet/provider/package/apple.rb +2 -2
- data/lib/puppet/provider/package/apt.rb +5 -5
- data/lib/puppet/provider/package/aptitude.rb +1 -1
- data/lib/puppet/provider/package/aptrpm.rb +2 -2
- data/lib/puppet/provider/package/blastwave.rb +4 -4
- data/lib/puppet/provider/package/dnf.rb +46 -0
- data/lib/puppet/provider/package/dpkg.rb +3 -3
- data/lib/puppet/provider/package/fink.rb +3 -3
- data/lib/puppet/provider/package/freebsd.rb +1 -1
- data/lib/puppet/provider/package/gem.rb +35 -9
- data/lib/puppet/provider/package/hpux.rb +1 -1
- data/lib/puppet/provider/package/nim.rb +17 -14
- data/lib/puppet/provider/package/openbsd.rb +11 -11
- data/lib/puppet/provider/package/opkg.rb +1 -1
- data/lib/puppet/provider/package/pacman.rb +20 -19
- data/lib/puppet/provider/package/pip.rb +83 -22
- data/lib/puppet/provider/package/pip3.rb +20 -0
- data/lib/puppet/provider/package/pkg.rb +21 -17
- data/lib/puppet/provider/package/pkgdmg.rb +12 -9
- data/lib/puppet/provider/package/pkgin.rb +6 -6
- data/lib/puppet/provider/package/pkgng.rb +143 -0
- data/lib/puppet/provider/package/pkgutil.rb +7 -7
- data/lib/puppet/provider/package/portage.rb +183 -35
- data/lib/puppet/provider/package/ports.rb +3 -6
- data/lib/puppet/provider/package/portupgrade.rb +4 -4
- data/lib/puppet/provider/package/puppet_gem.rb +0 -0
- data/lib/puppet/provider/package/rpm.rb +130 -21
- data/lib/puppet/provider/package/rug.rb +1 -1
- data/lib/puppet/provider/package/sun.rb +4 -3
- data/lib/puppet/provider/package/tdnf.rb +28 -0
- data/lib/puppet/provider/package/up2date.rb +1 -1
- data/lib/puppet/provider/package/urpmi.rb +1 -1
- data/lib/puppet/provider/package/windows/exe_package.rb +10 -9
- data/lib/puppet/provider/package/windows/msi_package.rb +4 -4
- data/lib/puppet/provider/package/windows/package.rb +12 -4
- data/lib/puppet/provider/package/windows.rb +5 -5
- data/lib/puppet/provider/package/yum.rb +73 -94
- data/lib/puppet/provider/package/zypper.rb +70 -16
- data/lib/puppet/provider/package.rb +6 -2
- data/lib/puppet/provider/parsedfile.rb +3 -3
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +39 -7
- data/lib/puppet/provider/selmodule/semodule.rb +20 -16
- data/lib/puppet/provider/service/base.rb +4 -3
- data/lib/puppet/provider/service/bsd.rb +9 -9
- data/lib/puppet/provider/service/daemontools.rb +5 -5
- data/lib/puppet/provider/service/debian.rb +14 -5
- data/lib/puppet/provider/service/freebsd.rb +1 -1
- data/lib/puppet/provider/service/init.rb +27 -3
- data/lib/puppet/provider/service/launchd.rb +57 -19
- data/lib/puppet/provider/service/rcng.rb +51 -0
- data/lib/puppet/provider/service/redhat.rb +2 -1
- data/lib/puppet/provider/service/runit.rb +4 -4
- data/lib/puppet/provider/service/smf.rb +59 -8
- data/lib/puppet/provider/service/src.rb +66 -39
- data/lib/puppet/provider/service/systemd.rb +141 -22
- data/lib/puppet/provider/service/upstart.rb +1 -3
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/provider/sshkey/parsed.rb +20 -10
- data/lib/puppet/provider/user/aix.rb +12 -6
- data/lib/puppet/provider/user/directoryservice.rb +43 -66
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/ldap.rb +1 -1
- data/lib/puppet/provider/user/openbsd.rb +1 -0
- data/lib/puppet/provider/user/pw.rb +1 -0
- data/lib/puppet/provider/user/user_role_add.rb +19 -2
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/provider/user/windows_adsi.rb +51 -2
- data/lib/puppet/provider/yumrepo/inifile.rb +12 -9
- data/lib/puppet/provider/zfs/zfs.rb +2 -2
- data/lib/puppet/provider/zone/solaris.rb +6 -3
- data/lib/puppet/provider/zpool/zpool.rb +2 -2
- data/lib/puppet/provider.rb +11 -7
- data/lib/puppet/reference/configuration.rb +13 -5
- data/lib/puppet/reference/indirection.rb +3 -3
- data/lib/puppet/reference/metaparameter.rb +1 -1
- data/lib/puppet/reference/providers.rb +8 -9
- data/lib/puppet/reference/report.rb +9 -12
- data/lib/puppet/reference/type.rb +3 -3
- data/lib/puppet/relationship.rb +7 -9
- data/lib/puppet/reports/http.rb +6 -2
- data/lib/puppet/reports.rb +5 -1
- data/lib/puppet/resource/capability_finder.rb +128 -0
- data/lib/puppet/resource/catalog.rb +163 -51
- data/lib/puppet/resource/status.rb +34 -20
- data/lib/puppet/resource/type.rb +246 -97
- data/lib/puppet/resource/type_collection.rb +97 -17
- data/lib/puppet/resource.rb +242 -199
- data/lib/puppet/settings/array_setting.rb +1 -1
- data/lib/puppet/settings/autosign_setting.rb +1 -1
- data/lib/puppet/settings/base_setting.rb +9 -3
- data/lib/puppet/settings/boolean_setting.rb +1 -1
- data/lib/puppet/settings/config_file.rb +4 -3
- data/lib/puppet/settings/directory_setting.rb +6 -0
- data/lib/puppet/settings/duration_setting.rb +1 -1
- data/lib/puppet/settings/enum_setting.rb +1 -1
- data/lib/puppet/settings/environment_conf.rb +28 -8
- data/lib/puppet/settings/file_or_directory_setting.rb +6 -0
- data/lib/puppet/settings/file_setting.rb +22 -11
- data/lib/puppet/settings/ini_file.rb +2 -2
- data/lib/puppet/settings/priority_setting.rb +1 -1
- data/lib/puppet/settings/server_list_setting.rb +20 -0
- data/lib/puppet/settings/symbolic_enum_setting.rb +17 -0
- data/lib/puppet/settings/terminus_setting.rb +1 -1
- data/lib/puppet/settings/ttl_setting.rb +2 -2
- data/lib/puppet/settings.rb +118 -46
- data/lib/puppet/ssl/base.rb +16 -3
- data/lib/puppet/ssl/certificate.rb +1 -1
- data/lib/puppet/ssl/certificate_authority/interface.rb +172 -32
- data/lib/puppet/ssl/certificate_authority.rb +67 -31
- data/lib/puppet/ssl/certificate_factory.rb +5 -5
- data/lib/puppet/ssl/certificate_request.rb +19 -19
- data/lib/puppet/ssl/certificate_request_attributes.rb +3 -3
- data/lib/puppet/ssl/certificate_revocation_list.rb +3 -3
- data/lib/puppet/ssl/certificate_signer.rb +1 -1
- data/lib/puppet/ssl/configuration.rb +4 -1
- data/lib/puppet/ssl/host.rb +47 -25
- data/lib/puppet/ssl/inventory.rb +11 -4
- data/lib/puppet/ssl/key.rb +8 -4
- data/lib/puppet/ssl/oids.rb +48 -8
- data/lib/puppet/ssl/validator/default_validator.rb +6 -7
- data/lib/puppet/syntax_checkers/base64.rb +41 -0
- data/lib/puppet/syntax_checkers/json.rb +5 -7
- data/lib/puppet/test/test_helper.rb +21 -11
- data/lib/puppet/transaction/additional_resource_generator.rb +105 -11
- data/lib/puppet/transaction/event.rb +45 -7
- data/lib/puppet/transaction/event_manager.rb +7 -7
- data/lib/puppet/transaction/persistence.rb +84 -0
- data/lib/puppet/transaction/report.rb +113 -37
- data/lib/puppet/transaction/resource_harness.rb +99 -37
- data/lib/puppet/transaction.rb +100 -54
- data/lib/puppet/type/augeas.rb +15 -6
- data/lib/puppet/type/component.rb +11 -0
- data/lib/puppet/type/cron.rb +27 -44
- data/lib/puppet/type/exec.rb +82 -52
- data/lib/puppet/type/file/checksum.rb +1 -0
- data/lib/puppet/type/file/checksum_value.rb +53 -0
- data/lib/puppet/type/file/content.rb +37 -122
- data/lib/puppet/type/file/data_sync.rb +92 -0
- data/lib/puppet/type/file/ensure.rb +22 -19
- data/lib/puppet/type/file/group.rb +3 -3
- data/lib/puppet/type/file/mode.rb +10 -6
- data/lib/puppet/type/file/owner.rb +3 -3
- data/lib/puppet/type/file/selcontext.rb +19 -2
- data/lib/puppet/type/file/source.rb +134 -37
- data/lib/puppet/type/file/target.rb +2 -2
- data/lib/puppet/type/file.rb +160 -61
- data/lib/puppet/type/filebucket.rb +3 -8
- data/lib/puppet/type/group.rb +28 -10
- data/lib/puppet/type/host.rb +7 -7
- data/lib/puppet/type/interface.rb +9 -4
- data/lib/puppet/type/k5login.rb +1 -1
- data/lib/puppet/type/macauthorization.rb +2 -2
- data/lib/puppet/type/mailalias.rb +2 -18
- data/lib/puppet/type/maillist.rb +1 -1
- data/lib/puppet/type/mount.rb +31 -8
- data/lib/puppet/type/notify.rb +3 -1
- data/lib/puppet/type/package.rb +37 -17
- data/lib/puppet/type/resources.rb +7 -7
- data/lib/puppet/type/schedule.rb +14 -14
- data/lib/puppet/type/scheduled_task.rb +18 -5
- data/lib/puppet/type/service.rb +25 -1
- data/lib/puppet/type/ssh_authorized_key.rb +20 -30
- data/lib/puppet/type/sshkey.rb +9 -7
- data/lib/puppet/type/stage.rb +1 -1
- data/lib/puppet/type/tidy.rb +24 -15
- data/lib/puppet/type/user.rb +112 -53
- data/lib/puppet/type/yumrepo.rb +36 -16
- data/lib/puppet/type/zone.rb +13 -13
- data/lib/puppet/type/zpool.rb +3 -3
- data/lib/puppet/type.rb +175 -47
- data/lib/puppet/util/at_fork/noop.rb +18 -0
- data/lib/puppet/util/at_fork/solaris.rb +158 -0
- data/lib/puppet/util/at_fork.rb +35 -0
- data/lib/puppet/util/autoload.rb +18 -13
- data/lib/puppet/util/backups.rb +6 -6
- data/lib/puppet/util/character_encoding.rb +98 -0
- data/lib/puppet/util/checksums.rb +74 -31
- data/lib/puppet/util/classgen.rb +5 -5
- data/lib/puppet/util/command_line/puppet_option_parser.rb +3 -3
- data/lib/puppet/util/command_line/trollop.rb +32 -32
- data/lib/puppet/util/command_line.rb +14 -6
- data/lib/puppet/util/diff.rb +1 -1
- data/lib/puppet/util/errors.rb +4 -4
- data/lib/puppet/util/execution.rb +42 -23
- data/lib/puppet/util/feature.rb +5 -5
- data/lib/puppet/util/fileparsing.rb +8 -8
- data/lib/puppet/util/filetype.rb +26 -20
- data/lib/puppet/util/http_proxy.rb +132 -0
- data/lib/puppet/util/inifile.rb +5 -5
- data/lib/puppet/util/instance_loader.rb +2 -2
- data/lib/puppet/util/json_lockfile.rb +4 -4
- data/lib/puppet/util/ldap/connection.rb +2 -2
- data/lib/puppet/util/ldap/manager.rb +2 -2
- data/lib/puppet/util/limits.rb +1 -1
- data/lib/puppet/util/log/destinations.rb +33 -18
- data/lib/puppet/util/log.rb +92 -16
- data/lib/puppet/util/logging.rb +88 -6
- data/lib/puppet/util/metric.rb +9 -6
- data/lib/puppet/util/monkey_patches.rb +41 -65
- data/lib/puppet/util/multi_match.rb +51 -0
- data/lib/puppet/util/network_device/cisco/device.rb +29 -11
- data/lib/puppet/util/network_device/cisco/interface.rb +21 -9
- data/lib/puppet/util/network_device/config.rb +7 -7
- data/lib/puppet/util/network_device/transport/ssh.rb +13 -9
- data/lib/puppet/util/network_device/transport/telnet.rb +39 -36
- data/lib/puppet/util/network_device.rb +1 -1
- data/lib/puppet/util/plist.rb +153 -0
- data/lib/puppet/util/posix.rb +5 -5
- data/lib/puppet/util/profiler/aggregate.rb +1 -1
- data/lib/puppet/util/profiler/around_profiler.rb +1 -1
- data/lib/puppet/util/profiler/wall_clock.rb +1 -1
- data/lib/puppet/util/profiler.rb +1 -1
- data/lib/puppet/util/provider_features.rb +1 -1
- data/lib/puppet/util/psych_support.rb +4 -12
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +3 -3
- data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +2 -1
- data/lib/puppet/util/rdoc.rb +6 -6
- data/lib/puppet/util/reference.rb +9 -7
- data/lib/puppet/util/resource_template.rb +2 -2
- data/lib/puppet/util/retry_action.rb +2 -2
- data/lib/puppet/util/rubygems.rb +1 -1
- data/lib/puppet/util/run_mode.rb +3 -16
- data/lib/puppet/util/selinux.rb +54 -12
- data/lib/puppet/util/skip_tags.rb +9 -0
- data/lib/puppet/util/splayer.rb +18 -0
- data/lib/puppet/util/storage.rb +5 -5
- data/lib/puppet/util/suidmanager.rb +4 -4
- data/lib/puppet/util/symbolic_file_mode.rb +9 -9
- data/lib/puppet/util/tag_set.rb +1 -4
- data/lib/puppet/util/tagging.rb +9 -3
- data/lib/puppet/util/watcher/periodic_watcher.rb +2 -2
- data/lib/puppet/util/windows/access_control_entry.rb +2 -2
- data/lib/puppet/util/windows/access_control_list.rb +3 -3
- data/lib/puppet/util/windows/adsi.rb +222 -85
- data/lib/puppet/util/windows/api_types.rb +28 -19
- data/lib/puppet/util/windows/com.rb +7 -7
- data/lib/puppet/util/windows/error.rb +3 -3
- data/lib/puppet/util/windows/eventlog.rb +192 -0
- data/lib/puppet/util/windows/file.rb +115 -22
- data/lib/puppet/util/windows/principal.rb +191 -0
- data/lib/puppet/util/windows/process.rb +90 -13
- data/lib/puppet/util/windows/registry.rb +31 -25
- data/lib/puppet/util/windows/root_certs.rb +6 -6
- data/lib/puppet/util/windows/security.rb +52 -51
- data/lib/puppet/util/windows/security_descriptor.rb +1 -1
- data/lib/puppet/util/windows/sid.rb +89 -20
- data/lib/puppet/util/windows/taskscheduler.rb +154 -98
- data/lib/puppet/util/windows/user.rb +38 -20
- data/lib/puppet/util/windows.rb +7 -0
- data/lib/puppet/util/yaml.rb +15 -3
- data/lib/puppet/util.rb +259 -33
- data/lib/puppet/vendor/deep_merge/deep_merge.gemspec +1 -1
- data/lib/puppet/vendor/deep_merge/test/test_deep_merge.rb +1 -1
- data/lib/puppet/vendor/load_semantic_puppet.rb +1 -0
- data/lib/puppet/vendor/pathspec/LICENSE +2 -2
- data/lib/puppet/vendor/pathspec/README.md +1 -1
- data/lib/puppet/vendor/pathspec/lib/pathspec.rb +2 -1
- data/lib/puppet/vendor/require_vendored.rb +0 -1
- data/lib/puppet/vendor/semantic/lib/semantic.rb +4 -6
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency/graph.rb +2 -2
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency/graph_node.rb +2 -2
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency/module_release.rb +17 -5
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency/source.rb +2 -2
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency/unsatisfiable_graph.rb +2 -2
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency.rb +7 -7
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/gem_version.rb +3 -0
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +203 -0
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb +758 -0
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +9 -0
- data/lib/puppet/vendor/semantic_puppet/locales/config.yaml +21 -0
- data/lib/puppet/version.rb +7 -3
- data/lib/puppet.rb +104 -6
- data/lib/puppet_x.rb +7 -1
- data/locales/config.yaml +29 -0
- data/locales/puppet.pot +7995 -0
- data/man/man5/puppet.conf.5 +61 -41
- data/man/man8/puppet-agent.8 +6 -3
- data/man/man8/puppet-apply.8 +6 -3
- data/man/man8/puppet-ca.8 +3 -3
- data/man/man8/puppet-catalog.8 +3 -3
- data/man/man8/puppet-cert.8 +3 -3
- data/man/man8/puppet-certificate.8 +3 -3
- data/man/man8/puppet-certificate_request.8 +3 -3
- data/man/man8/puppet-certificate_revocation_list.8 +3 -3
- data/man/man8/puppet-config.8 +4 -4
- data/man/man8/puppet-describe.8 +2 -2
- data/man/man8/puppet-device.8 +7 -4
- data/man/man8/puppet-doc.8 +2 -2
- data/man/man8/puppet-epp.8 +3 -3
- data/man/man8/puppet-facts.8 +3 -3
- data/man/man8/puppet-filebucket.8 +3 -3
- data/man/man8/puppet-help.8 +3 -3
- data/man/man8/puppet-inspect.8 +3 -3
- data/man/man8/puppet-key.8 +3 -3
- data/man/man8/puppet-man.8 +3 -3
- data/man/man8/puppet-master.8 +6 -3
- data/man/man8/puppet-module.8 +10 -10
- data/man/man8/puppet-node.8 +3 -3
- data/man/man8/puppet-parser.8 +3 -3
- data/man/man8/puppet-plugin.8 +3 -3
- data/man/man8/puppet-report.8 +3 -3
- data/man/man8/puppet-resource.8 +3 -3
- data/man/man8/puppet-status.8 +4 -4
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/module.tar.gz +0 -0
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +22 -0
- data/spec/fixtures/unit/application/environments/production/environment.conf +1 -0
- data/spec/fixtures/unit/application/environments/production/manifests/site.pp +1 -0
- data/spec/fixtures/unit/application/environments/puppet_func_provider/environment.conf +1 -0
- data/spec/fixtures/unit/application/environments/puppet_func_provider/functions/environment/data.pp +10 -0
- data/spec/fixtures/unit/application/environments/puppet_func_provider/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/data/bad.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/{sample → hiera_bad_syntax_json}/environment.conf +1 -1
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/data/bad.yaml +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/first.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/name.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/second.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/third_utf8.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/utf8.yaml +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data2/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/hiera.yaml +22 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/data/common.yaml +48 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/data/common.yaml +30 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/manifests/init.pp +13 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/data/common.yaml +4 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/data/specific.yaml +4 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/hiera.yaml +7 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/first.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/name.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/second.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/server1.yaml +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/server2.yaml +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data2/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/hiera.yaml +20 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/data/common.yaml +4 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/data/specific.yaml +4 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/hiera.yaml +7 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/one/data/common.yaml +6 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/one/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/one/manifests/init.pp +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/two/data/common.yaml +4 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/two/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/two/manifests/init.pp +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/two/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/production/lib/puppet/functions/environment/data.rb +3 -1
- data/spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/functions/abc/data.rb +2 -1
- data/spec/fixtures/unit/data_providers/environments/production/modules/abc/manifests/init.pp +2 -1
- data/spec/fixtures/unit/data_providers/environments/production/modules/abc/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/production/modules/xyz/functions/data.pp +6 -0
- data/spec/fixtures/unit/data_providers/environments/production/modules/xyz/manifests/init.pp +9 -0
- data/spec/fixtures/unit/data_providers/environments/production/modules/xyz/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/data/common.yaml +19 -0
- data/spec/fixtures/unit/functions/lookup_fixture/data/common.yaml +19 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/abc/metadata.json +9 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/bad_data/lib/puppet/functions/bad_data/data.rb +1 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/bad_data/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/bad_data/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/bca/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_json/data/empty.json +0 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_json/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_json/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_json/data/empty_key.json +1 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_json/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_json/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_yaml/data/empty_key.yaml +1 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_yaml/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_yaml/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_yaml/data/empty.yaml +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_yaml/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_yaml/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/hieraprovider/data/first.json +4 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/hieraprovider/hiera.yaml +8 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/hieraprovider/manifests/init.pp +5 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/hieraprovider/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/meta/lib/puppet/functions/meta/data.rb +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/meta/manifests/init.pp +3 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/meta/metadata.json +9 -0
- data/spec/fixtures/unit/module/trailing-comma.json +1 -1
- data/spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp +0 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/functions/usee_puppet.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/lib/puppet/functions/usee/usee_ruby.rb +6 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/lib/puppet/type/usee_type.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/manifests/init.pp +8 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/types/zero.pp +1 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee2/lib/puppet/functions/usee2/callee.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/functions/puppet_calling_puppet.pp +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/functions/puppet_calling_puppet_init.pp +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/functions/puppet_calling_ruby.pp +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/lib/puppet/functions/user/caller2.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/lib/puppet/functions/user/ruby_calling_puppet.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/lib/puppet/functions/user/ruby_calling_puppet_init.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/lib/puppet/functions/user/ruby_calling_ruby.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/manifests/init.pp +87 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/{user → modules/user}/metadata.json +2 -1
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/types/withuseeone.pp +1 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/types/withuseezero.pp +1 -0
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcalled.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcaller.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/functions/puppetcaller4.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/user/lib/puppet/functions/user/callingpuppet.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/functions/hello.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/manifests/init.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/module_no_lib/modules/modulea/metadata.json +10 -0
- data/spec/fixtures/unit/pops/loaders/loaders/no_modules/manifests/site.pp +10 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/functions/hello.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/functions/subspace/hello.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/metadata.json +1 -10
- data/spec/fixtures/unit/pops/parser/lexer/subclass_name_duplication.pp +0 -0
- data/spec/fixtures/unit/provider/mount/parsed/aix.filesystems +93 -85
- data/spec/fixtures/unit/provider/mount/parsed/aix.mount +11 -7
- data/spec/fixtures/unit/provider/package/pkgng/pkg.info +8 -0
- data/spec/fixtures/unit/provider/package/pkgng/pkg.query +1 -0
- data/spec/fixtures/unit/provider/package/pkgng/pkg.query_absent +1 -0
- data/spec/fixtures/unit/provider/package/pkgng/pkg.version +3 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-broken-notices.txt +187 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-obsoletes.txt +195 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-security.txt +184 -0
- data/spec/fixtures/unit/provider/package/zypper/zypper-list-updates-empty.out +3 -0
- data/spec/fixtures/unit/provider/service/smf/svcs.out +4 -3
- data/spec/fixtures/unit/provider/sshkey/parsed/sample_with_blank_lines +8 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml +205 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml +213 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml +213 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_mtime_is_older_on_disk.yml +205 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_no_header_specified.yml +197 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_not_on_the_local_disk.yml +205 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_not_update_if_mtime_is_newer_on_disk.yml +205 -0
- data/spec/integration/agent/logging_spec.rb +15 -14
- data/spec/integration/application/apply_spec.rb +442 -32
- data/spec/integration/application/doc_spec.rb +0 -0
- data/spec/integration/application/lookup_spec.rb +155 -0
- data/spec/integration/configurer_spec.rb +1 -1
- data/spec/integration/data_binding_spec.rb +195 -0
- data/spec/integration/defaults_spec.rb +29 -4
- data/spec/integration/directory_environments_spec.rb +16 -0
- data/spec/integration/environments/default_manifest_spec.rb +16 -16
- data/spec/integration/environments/setting_hooks_spec.rb +1 -1
- data/spec/integration/environments/settings_spec.rb +32 -4
- data/spec/integration/faces/ca_spec.rb +0 -0
- data/spec/integration/faces/config_spec.rb +80 -0
- data/spec/integration/faces/documentation_spec.rb +2 -2
- data/spec/integration/faces/plugin_spec.rb +0 -4
- data/spec/integration/file_bucket/file_spec.rb +2 -2
- data/spec/integration/file_serving/fileset_spec.rb +0 -0
- data/spec/integration/file_serving/terminus_helper_spec.rb +0 -0
- data/spec/integration/file_system/uniquefile_spec.rb +29 -0
- data/spec/integration/indirector/catalog/compiler_spec.rb +0 -0
- data/spec/integration/indirector/direct_file_server_spec.rb +0 -0
- data/spec/integration/indirector/facts/facter_spec.rb +97 -0
- data/spec/integration/indirector/file_content/file_server_spec.rb +1 -0
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +1 -0
- data/spec/integration/indirector/node/ldap_spec.rb +0 -0
- data/spec/integration/module_tool/tar/mini_spec.rb +28 -0
- data/spec/integration/network/formats_spec.rb +0 -0
- data/spec/integration/network/http/api/indirected_routes_spec.rb +33 -0
- data/spec/integration/node/environment_spec.rb +34 -0
- data/spec/integration/node/facts_spec.rb +0 -0
- data/spec/integration/node_spec.rb +0 -0
- data/spec/integration/parser/catalog_spec.rb +15 -3
- data/spec/integration/parser/class_spec.rb +6 -6
- data/spec/integration/parser/collection_spec.rb +18 -0
- data/spec/integration/parser/compiler_spec.rb +911 -658
- data/spec/integration/parser/dynamic_scoping_spec.rb +66 -0
- data/spec/integration/parser/parameter_defaults_spec.rb +358 -0
- data/spec/integration/parser/pcore_resource_spec.rb +260 -0
- data/spec/integration/parser/resource_expressions_spec.rb +10 -5
- data/spec/integration/parser/scope_spec.rb +99 -11
- data/spec/integration/parser/undef_param_spec.rb +9 -1
- data/spec/integration/provider/mailalias/aliases_spec.rb +0 -0
- data/spec/integration/provider/mount_spec.rb +23 -36
- data/spec/integration/provider/service/init_spec.rb +0 -0
- data/spec/integration/provider/service/windows_spec.rb +3 -2
- data/spec/integration/provider/ssh_authorized_key_spec.rb +0 -0
- data/spec/integration/provider/yumrepo_spec.rb +4 -1
- data/spec/integration/reference/providers_spec.rb +0 -0
- data/spec/integration/reports_spec.rb +0 -0
- data/spec/integration/resource/catalog_spec.rb +1 -5
- data/spec/integration/resource/type_collection_spec.rb +14 -0
- data/spec/integration/ssl/autosign_spec.rb +18 -3
- data/spec/integration/ssl/certificate_authority_spec.rb +0 -1
- data/spec/integration/ssl/certificate_request_spec.rb +0 -1
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +0 -1
- data/spec/integration/ssl/host_spec.rb +0 -1
- data/spec/integration/ssl/key_spec.rb +104 -0
- data/spec/integration/test/test_helper_spec.rb +32 -0
- data/spec/integration/transaction/report_spec.rb +683 -1
- data/spec/integration/transaction_spec.rb +128 -4
- data/spec/integration/type/exec_spec.rb +0 -0
- data/spec/integration/type/file_spec.rb +582 -51
- data/spec/integration/type/package_spec.rb +79 -2
- data/spec/integration/type/tidy_spec.rb +21 -9
- data/spec/integration/type/user_spec.rb +13 -6
- data/spec/integration/type_spec.rb +0 -0
- data/spec/integration/util/autoload_spec.rb +0 -0
- data/spec/integration/util/execution_spec.rb +30 -0
- data/spec/integration/util/rdoc/parser_spec.rb +1 -1
- data/spec/integration/util/settings_spec.rb +26 -0
- data/spec/integration/util/windows/adsi_spec.rb +99 -0
- data/spec/integration/util/windows/principal_spec.rb +250 -0
- data/spec/integration/util/windows/process_spec.rb +35 -2
- data/spec/{unit → integration}/util/windows/registry_spec.rb +92 -2
- data/spec/integration/util/windows/security_spec.rb +75 -21
- data/spec/integration/util/windows/user_spec.rb +27 -5
- data/spec/integration/util_spec.rb +49 -27
- data/spec/lib/matchers/include_in_order.rb +2 -3
- data/spec/lib/matchers/json.rb +3 -3
- data/spec/lib/matchers/resource.rb +22 -1
- data/spec/lib/puppet/face/1.0.0/huzzah.rb +1 -1
- data/spec/lib/puppet/face/basetest.rb +1 -1
- data/spec/lib/puppet/face/huzzah.rb +1 -1
- data/spec/lib/puppet/face/version_matching.rb +1 -1
- data/spec/lib/puppet/indirector_testing.rb +4 -0
- data/spec/lib/puppet_spec/character_encoding.rb +12 -0
- data/spec/lib/puppet_spec/compiler.rb +40 -4
- data/spec/lib/puppet_spec/files.rb +16 -2
- data/spec/lib/puppet_spec/fixtures.rb +0 -0
- data/spec/lib/puppet_spec/language.rb +3 -1
- data/spec/lib/puppet_spec/matchers.rb +6 -4
- data/spec/lib/puppet_spec/module_tool/shared_functions.rb +2 -2
- data/spec/lib/puppet_spec/module_tool/stub_source.rb +1 -1
- data/spec/lib/puppet_spec/modules.rb +2 -2
- data/spec/lib/puppet_spec/network.rb +22 -14
- data/spec/lib/puppet_spec/pops.rb +13 -0
- data/spec/lib/puppet_spec/unindent.rb +5 -0
- data/spec/lib/puppet_spec/verbose.rb +0 -0
- data/spec/shared_behaviours/all_parsedfile_providers.rb +0 -0
- data/spec/shared_behaviours/file_server_terminus.rb +0 -0
- data/spec/shared_behaviours/file_serving.rb +0 -0
- data/spec/shared_behaviours/iterative_functions.rb +9 -9
- data/spec/shared_behaviours/memory_terminus.rb +0 -0
- data/spec/shared_behaviours/path_parameters.rb +0 -0
- data/spec/shared_behaviours/things_that_declare_options.rb +0 -0
- data/spec/shared_contexts/types_setup.rb +143 -0
- data/spec/shared_examples/rhel_package_provider.rb +356 -0
- data/spec/spec_helper.rb +23 -13
- data/spec/unit/agent/locker_spec.rb +4 -4
- data/spec/unit/agent_spec.rb +23 -46
- data/spec/unit/application/agent_spec.rb +22 -0
- data/spec/unit/application/apply_spec.rb +59 -14
- data/spec/unit/application/cert_spec.rb +20 -0
- data/spec/unit/application/certificate_spec.rb +0 -0
- data/spec/unit/application/config_spec.rb +0 -0
- data/spec/unit/application/describe_spec.rb +19 -0
- data/spec/unit/application/device_spec.rb +41 -2
- data/spec/unit/application/doc_spec.rb +0 -0
- data/spec/unit/application/face_base_spec.rb +22 -6
- data/spec/unit/application/facts_spec.rb +0 -0
- data/spec/unit/application/filebucket_spec.rb +88 -2
- data/spec/unit/application/indirection_base_spec.rb +0 -0
- data/spec/unit/application/lookup_spec.rb +532 -0
- data/spec/unit/application/master_spec.rb +53 -11
- data/spec/unit/application/resource_spec.rb +39 -1
- data/spec/unit/application_spec.rb +3 -9
- data/spec/unit/capability_spec.rb +412 -0
- data/spec/unit/configurer/downloader_factory_spec.rb +0 -0
- data/spec/unit/configurer/downloader_spec.rb +5 -5
- data/spec/unit/configurer/fact_handler_spec.rb +76 -20
- data/spec/unit/configurer/plugin_handler_spec.rb +5 -8
- data/spec/unit/configurer_spec.rb +372 -58
- data/spec/unit/confine/exists_spec.rb +0 -0
- data/spec/unit/confine/false_spec.rb +0 -0
- data/spec/unit/confine/feature_spec.rb +0 -0
- data/spec/unit/confine/true_spec.rb +0 -0
- data/spec/unit/confine/variable_spec.rb +0 -0
- data/spec/unit/confine_collection_spec.rb +0 -0
- data/spec/unit/confine_spec.rb +0 -0
- data/spec/unit/confiner_spec.rb +0 -0
- data/spec/unit/context/trusted_information_spec.rb +24 -1
- data/spec/unit/daemon_spec.rb +18 -8
- data/spec/unit/data_providers/function_data_provider_spec.rb +30 -3
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +361 -0
- data/spec/unit/defaults_spec.rb +34 -17
- data/spec/unit/environments_spec.rb +26 -4
- data/spec/unit/etc_spec.rb +442 -0
- data/spec/unit/external/pson_spec.rb +0 -0
- data/spec/unit/face/ca_spec.rb +10 -0
- data/spec/unit/face/catalog_spec.rb +0 -0
- data/spec/unit/face/certificate_request_spec.rb +10 -0
- data/spec/unit/face/certificate_revocation_list_spec.rb +10 -0
- data/spec/unit/face/certificate_spec.rb +10 -2
- data/spec/unit/face/config_spec.rb +47 -0
- data/spec/unit/face/epp_face_spec.rb +24 -5
- data/spec/unit/face/facts_spec.rb +0 -0
- data/spec/unit/face/generate_spec.rb +230 -0
- data/spec/unit/face/help_spec.rb +70 -0
- data/spec/unit/face/key_spec.rb +10 -0
- data/spec/unit/face/module/list_spec.rb +60 -0
- data/spec/unit/face/module/search_spec.rb +1 -1
- data/spec/unit/face/node_spec.rb +1 -1
- data/spec/unit/face/parser_spec.rb +49 -2
- data/spec/unit/face/plugin_spec.rb +29 -4
- data/spec/unit/face/status_spec.rb +10 -0
- data/spec/unit/face_spec.rb +0 -0
- data/spec/unit/file_bucket/dipper_spec.rb +210 -1
- data/spec/unit/file_bucket/file_spec.rb +3 -3
- data/spec/unit/file_serving/base_spec.rb +0 -0
- data/spec/unit/file_serving/configuration/parser_spec.rb +25 -30
- data/spec/unit/file_serving/configuration_spec.rb +1 -1
- data/spec/unit/file_serving/content_spec.rb +0 -0
- data/spec/unit/file_serving/fileset_spec.rb +0 -0
- data/spec/unit/file_serving/http_metadata_spec.rb +85 -0
- data/spec/unit/file_serving/metadata_spec.rb +85 -9
- data/spec/unit/file_serving/mount/file_spec.rb +0 -0
- data/spec/unit/file_serving/mount/modules_spec.rb +0 -0
- data/spec/unit/file_serving/mount/pluginfacts_spec.rb +0 -0
- data/spec/unit/file_serving/mount/plugins_spec.rb +0 -0
- data/spec/unit/file_serving/mount_spec.rb +0 -0
- data/spec/unit/file_serving/terminus_helper_spec.rb +2 -3
- data/spec/unit/file_serving/terminus_selector_spec.rb +12 -2
- data/spec/unit/file_system/uniquefile_spec.rb +20 -0
- data/spec/unit/file_system_spec.rb +373 -6
- data/spec/unit/forge/forge_spec.rb +112 -0
- data/spec/unit/forge/repository_spec.rb +31 -4
- data/spec/unit/functions/annotate_spec.rb +175 -0
- data/spec/unit/functions/assert_type_spec.rb +48 -8
- data/spec/unit/functions/binary_file_spec.rb +46 -0
- data/spec/unit/functions/break_spec.rb +117 -0
- data/spec/unit/functions/call_spec.rb +77 -0
- data/spec/unit/{parser/functions → functions}/contain_spec.rb +69 -4
- data/spec/unit/functions/defined_spec.rb +289 -0
- data/spec/unit/functions/dig_spec.rb +58 -0
- data/spec/unit/functions/epp_spec.rb +17 -9
- data/spec/unit/functions/filter_spec.rb +18 -0
- data/spec/unit/functions/find_file_spec.rb +69 -0
- data/spec/unit/functions/hiera_spec.rb +451 -49
- data/spec/unit/functions/include_spec.rb +175 -0
- data/spec/unit/functions/inline_epp_spec.rb +4 -4
- data/spec/unit/functions/lest_spec.rb +34 -0
- data/spec/unit/functions/logging_spec.rb +54 -0
- data/spec/unit/functions/lookup_fixture_spec.rb +688 -0
- data/spec/unit/functions/lookup_spec.rb +3108 -264
- data/spec/unit/functions/match_spec.rb +2 -2
- data/spec/unit/functions/new_spec.rb +694 -0
- data/spec/unit/functions/next_spec.rb +93 -0
- data/spec/unit/functions/regsubst_spec.rb +30 -9
- data/spec/unit/functions/require_spec.rb +83 -0
- data/spec/unit/functions/return_spec.rb +105 -0
- data/spec/unit/functions/reverse_each_spec.rb +108 -0
- data/spec/unit/functions/scanf_spec.rb +1 -1
- data/spec/unit/{parser/functions → functions}/shared.rb +15 -12
- data/spec/unit/functions/split_spec.rb +11 -3
- data/spec/unit/functions/step_spec.rb +113 -0
- data/spec/unit/functions/strftime_spec.rb +152 -0
- data/spec/unit/functions/then_spec.rb +40 -0
- data/spec/unit/functions/type_spec.rb +35 -0
- data/spec/unit/functions/unique_spec.rb +111 -0
- data/spec/unit/functions/unwrap_spec.rb +29 -0
- data/spec/unit/functions/versioncmp_spec.rb +36 -0
- data/spec/unit/functions4_spec.rb +352 -107
- data/spec/unit/graph/rb_tree_map_spec.rb +1 -1
- data/spec/unit/graph/relationship_graph_spec.rb +0 -0
- data/spec/unit/graph/sequential_prioritizer_spec.rb +1 -1
- data/spec/unit/graph/simple_graph_spec.rb +59 -56
- data/spec/unit/hiera/scope_spec.rb +6 -3
- data/spec/unit/hiera_puppet_spec.rb +49 -8
- data/spec/unit/indirector/catalog/compiler_spec.rb +887 -83
- data/spec/unit/indirector/catalog/json_spec.rb +50 -1
- data/spec/unit/indirector/catalog/msgpack_spec.rb +0 -0
- data/spec/unit/indirector/catalog/rest_spec.rb +0 -0
- data/spec/unit/indirector/catalog/store_configs_spec.rb +0 -0
- data/spec/unit/indirector/catalog/yaml_spec.rb +0 -0
- data/spec/unit/indirector/certificate/ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate/disabled_ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate/file_spec.rb +0 -0
- data/spec/unit/indirector/certificate/rest_spec.rb +0 -0
- data/spec/unit/indirector/certificate_request/ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate_request/disabled_ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate_request/file_spec.rb +0 -0
- data/spec/unit/indirector/certificate_request/rest_spec.rb +0 -0
- data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate_revocation_list/disabled_ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +0 -0
- data/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +0 -0
- data/spec/unit/indirector/certificate_status/file_spec.rb +0 -0
- data/spec/unit/indirector/certificate_status/rest_spec.rb +0 -0
- data/spec/unit/indirector/code_spec.rb +0 -0
- data/spec/unit/indirector/data_binding/none_spec.rb +2 -2
- data/spec/unit/indirector/direct_file_server_spec.rb +0 -0
- data/spec/unit/indirector/envelope_spec.rb +0 -0
- data/spec/unit/indirector/exec_spec.rb +0 -0
- data/spec/unit/indirector/face_spec.rb +10 -2
- data/spec/unit/indirector/facts/facter_spec.rb +6 -7
- data/spec/unit/indirector/facts/network_device_spec.rb +0 -0
- data/spec/unit/indirector/facts/store_configs_spec.rb +0 -0
- data/spec/unit/indirector/facts/yaml_spec.rb +0 -0
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +86 -4
- data/spec/unit/indirector/file_bucket_file/rest_spec.rb +0 -0
- data/spec/unit/indirector/file_content/file_server_spec.rb +0 -0
- data/spec/unit/indirector/file_content/file_spec.rb +0 -0
- data/spec/unit/indirector/file_content/rest_spec.rb +0 -0
- data/spec/unit/indirector/file_metadata/file_server_spec.rb +0 -0
- data/spec/unit/indirector/file_metadata/file_spec.rb +0 -0
- data/spec/unit/indirector/file_metadata/rest_spec.rb +0 -0
- data/spec/unit/indirector/file_server_spec.rb +17 -2
- data/spec/unit/indirector/indirection_spec.rb +14 -38
- data/spec/unit/indirector/json_spec.rb +27 -6
- data/spec/unit/indirector/key/ca_spec.rb +0 -0
- data/spec/unit/indirector/key/disabled_ca_spec.rb +0 -0
- data/spec/unit/indirector/key/file_spec.rb +1 -1
- data/spec/unit/indirector/ldap_spec.rb +0 -0
- data/spec/unit/indirector/memory_spec.rb +0 -0
- data/spec/unit/indirector/msgpack_spec.rb +11 -1
- data/spec/unit/indirector/node/exec_spec.rb +12 -12
- data/spec/unit/indirector/node/ldap_spec.rb +29 -8
- data/spec/unit/indirector/node/memory_spec.rb +0 -0
- data/spec/unit/indirector/node/msgpack_spec.rb +0 -0
- data/spec/unit/indirector/node/plain_spec.rb +16 -6
- data/spec/unit/indirector/node/rest_spec.rb +0 -0
- data/spec/unit/indirector/node/store_configs_spec.rb +0 -0
- data/spec/unit/indirector/node/write_only_yaml_spec.rb +12 -0
- data/spec/unit/indirector/node/yaml_spec.rb +0 -0
- data/spec/unit/indirector/plain_spec.rb +0 -0
- data/spec/unit/indirector/report/msgpack_spec.rb +0 -0
- data/spec/unit/indirector/report/processor_spec.rb +2 -2
- data/spec/unit/indirector/report/rest_spec.rb +29 -3
- data/spec/unit/indirector/report/yaml_spec.rb +0 -0
- data/spec/unit/indirector/request_spec.rb +32 -12
- data/spec/unit/indirector/resource/ral_spec.rb +0 -0
- data/spec/unit/indirector/resource/store_configs_spec.rb +0 -0
- data/spec/unit/indirector/rest_spec.rb +158 -18
- data/spec/unit/indirector/ssl_file_spec.rb +4 -4
- data/spec/unit/indirector/status/rest_spec.rb +0 -0
- data/spec/unit/indirector/store_configs_spec.rb +0 -0
- data/spec/unit/indirector/terminus_spec.rb +0 -0
- data/spec/unit/indirector/yaml_spec.rb +1 -1
- data/spec/unit/indirector_spec.rb +0 -0
- data/spec/unit/info_service_spec.rb +298 -0
- data/spec/unit/interface/action_builder_spec.rb +0 -0
- data/spec/unit/interface/action_manager_spec.rb +0 -0
- data/spec/unit/interface/action_spec.rb +0 -0
- data/spec/unit/interface/documentation_spec.rb +0 -0
- data/spec/unit/interface/face_collection_spec.rb +7 -7
- data/spec/unit/interface/option_builder_spec.rb +0 -0
- data/spec/unit/interface/option_spec.rb +0 -0
- data/spec/unit/interface_spec.rb +27 -0
- data/spec/unit/man_spec.rb +1 -1
- data/spec/unit/module_spec.rb +126 -74
- data/spec/unit/module_tool/application_spec.rb +1 -1
- data/spec/unit/module_tool/applications/builder_spec.rb +44 -9
- data/spec/unit/module_tool/applications/installer_spec.rb +11 -3
- data/spec/unit/module_tool/applications/unpacker_spec.rb +2 -1
- data/spec/unit/module_tool/applications/upgrader_spec.rb +9 -2
- data/spec/unit/module_tool/installed_modules_spec.rb +6 -6
- data/spec/unit/module_tool/metadata_spec.rb +31 -2
- data/spec/unit/module_tool/tar/mini_spec.rb +3 -3
- data/spec/unit/module_tool/tar_spec.rb +16 -10
- data/spec/unit/module_tool_spec.rb +3 -3
- data/spec/unit/network/auth_config_parser_spec.rb +16 -0
- data/spec/unit/network/authconfig_spec.rb +62 -32
- data/spec/unit/network/authorization_spec.rb +30 -2
- data/spec/unit/network/authstore_spec.rb +2 -2
- data/spec/unit/network/format_handler_spec.rb +11 -11
- data/spec/unit/network/format_spec.rb +9 -0
- data/spec/unit/network/formats_spec.rb +322 -138
- data/spec/unit/network/http/api/indirected_routes_spec.rb +125 -116
- data/spec/unit/network/http/api/master/v3/environment_spec.rb +186 -0
- data/spec/unit/network/http/api/master/v3_spec.rb +23 -5
- data/spec/unit/network/http/api_spec.rb +1 -1
- data/spec/unit/network/http/compression_spec.rb +132 -84
- data/spec/unit/network/http/connection_spec.rb +25 -19
- data/spec/unit/network/http/error_spec.rb +1 -1
- data/spec/unit/network/http/factory_spec.rb +18 -0
- data/spec/unit/network/http/handler_spec.rb +17 -18
- data/spec/unit/network/http/nocache_pool_spec.rb +0 -0
- data/spec/unit/network/http/pool_spec.rb +30 -0
- data/spec/unit/network/http/rack/rest_spec.rb +9 -2
- data/spec/unit/network/http/rack_spec.rb +0 -0
- data/spec/unit/network/http/request_spec.rb +110 -0
- data/spec/unit/network/http/response_spec.rb +108 -0
- data/spec/unit/network/http/session_spec.rb +0 -0
- data/spec/unit/network/http/site_spec.rb +0 -0
- data/spec/unit/network/http/webrick/rest_spec.rb +0 -0
- data/spec/unit/network/http/webrick_spec.rb +1 -1
- data/spec/unit/network/http_pool_spec.rb +0 -0
- data/spec/unit/network/http_spec.rb +0 -0
- data/spec/unit/network/resolver_spec.rb +0 -0
- data/spec/unit/network/rights_spec.rb +4 -4
- data/spec/unit/network/server_spec.rb +0 -0
- data/spec/unit/node/environment_spec.rb +10 -0
- data/spec/unit/node/facts_spec.rb +13 -13
- data/spec/unit/node_spec.rb +74 -10
- data/spec/unit/other/selinux_spec.rb +0 -0
- data/spec/unit/parameter/path_spec.rb +0 -0
- data/spec/unit/parameter/value_collection_spec.rb +0 -0
- data/spec/unit/parameter/value_spec.rb +0 -0
- data/spec/unit/parameter_spec.rb +84 -5
- data/spec/unit/parser/ast/leaf_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +135 -34
- data/spec/unit/parser/environment_compiler_spec.rb +686 -0
- data/spec/unit/parser/files_spec.rb +0 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +132 -10
- data/spec/unit/parser/functions/digest_spec.rb +0 -0
- data/spec/unit/parser/functions/fail_spec.rb +0 -0
- data/spec/unit/parser/functions/file_spec.rb +7 -1
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +6 -2
- data/spec/unit/parser/functions/generate_spec.rb +3 -12
- data/spec/unit/parser/functions/hiera_array_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_hash_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_include_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_spec.rb +1 -1
- data/spec/unit/parser/functions/inline_template_spec.rb +0 -0
- data/spec/unit/parser/functions/lookup_spec.rb +1 -1
- data/spec/unit/parser/functions/realize_spec.rb +0 -0
- data/spec/unit/parser/functions/regsubst_spec.rb +1 -1
- data/spec/unit/parser/functions/scanf_spec.rb +0 -0
- data/spec/unit/parser/functions/shellquote_spec.rb +0 -0
- data/spec/unit/parser/functions/split_spec.rb +1 -1
- data/spec/unit/parser/functions/sprintf_spec.rb +0 -0
- data/spec/unit/parser/functions/tag_spec.rb +0 -0
- data/spec/unit/parser/functions/template_spec.rb +1 -1
- data/spec/unit/parser/functions/versioncmp_spec.rb +0 -0
- data/spec/unit/parser/functions_spec.rb +0 -0
- data/spec/unit/parser/relationship_spec.rb +0 -0
- data/spec/unit/parser/resource/param_spec.rb +0 -0
- data/spec/unit/parser/resource_spec.rb +115 -54
- data/spec/unit/parser/scope_spec.rb +84 -86
- data/spec/unit/parser/templatewrapper_spec.rb +1 -1
- data/spec/unit/parser/type_loader_spec.rb +0 -0
- data/spec/unit/pops/benchmark_spec.rb +8 -26
- data/spec/unit/pops/containment_spec.rb +0 -26
- data/spec/unit/pops/evaluator/access_ops_spec.rb +214 -99
- data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +223 -0
- data/spec/unit/pops/evaluator/basic_expressions_spec.rb +5 -6
- data/spec/unit/pops/evaluator/comparison_ops_spec.rb +29 -26
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +218 -47
- data/spec/unit/pops/evaluator/evaluator_rspec_helper.rb +29 -25
- data/spec/unit/pops/evaluator/json_strict_literal_evaluator_spec.rb +63 -0
- data/spec/unit/pops/evaluator/literal_evaluator_spec.rb +43 -0
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +168 -0
- data/spec/unit/pops/evaluator/string_interpolation_spec.rb +10 -10
- data/spec/unit/pops/evaluator/variables_spec.rb +2 -2
- data/spec/unit/pops/factory_rspec_helper.rb +0 -4
- data/spec/unit/pops/factory_spec.rb +83 -83
- data/spec/unit/pops/issues_spec.rb +16 -16
- data/spec/unit/pops/label_provider_spec.rb +5 -1
- data/spec/unit/pops/loaders/dependency_loader_spec.rb +66 -1
- data/spec/unit/pops/loaders/environment_loader_spec.rb +172 -0
- data/spec/unit/pops/loaders/loader_paths_spec.rb +1 -1
- data/spec/unit/pops/loaders/loaders_spec.rb +541 -57
- data/spec/unit/pops/loaders/module_loaders_spec.rb +63 -2
- data/spec/unit/pops/loaders/static_loader_spec.rb +80 -19
- data/spec/unit/pops/lookup/context_spec.rb +334 -0
- data/spec/unit/pops/lookup/interpolation_spec.rb +373 -0
- data/spec/unit/pops/lookup/lookup_spec.rb +294 -0
- data/spec/unit/pops/merge_strategy_spec.rb +18 -0
- data/spec/unit/pops/migration_spec.rb +53 -0
- data/spec/unit/pops/model/model_spec.rb +10 -10
- data/spec/unit/pops/parser/epp_parser_spec.rb +1 -1
- data/spec/unit/pops/parser/lexer2_spec.rb +380 -10
- data/spec/unit/pops/parser/locator_spec.rb +24 -0
- data/spec/unit/pops/parser/parse_application_spec.rb +32 -0
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +35 -4
- data/spec/unit/pops/parser/parse_calls_spec.rb +25 -0
- data/spec/unit/pops/parser/parse_capabilities_spec.rb +37 -0
- data/spec/unit/pops/parser/parse_containers_spec.rb +17 -19
- data/spec/unit/pops/parser/parse_functions_spec.rb +19 -0
- data/spec/unit/pops/parser/parse_heredoc_spec.rb +26 -0
- data/spec/unit/pops/parser/parse_lambda_spec.rb +19 -0
- data/spec/unit/pops/parser/parse_site_spec.rb +48 -0
- data/spec/unit/pops/parser/parser_rspec_helper.rb +6 -0
- data/spec/unit/pops/parser/parser_spec.rb +32 -6
- data/spec/unit/pops/puppet_stack_spec.rb +79 -0
- data/spec/unit/pops/resource/resource_type_impl_spec.rb +109 -0
- data/spec/unit/pops/serialization/packer_spec.rb +154 -0
- data/spec/unit/pops/serialization/serialization_spec.rb +426 -0
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +494 -0
- data/spec/unit/pops/time/timespan_spec.rb +121 -0
- data/spec/unit/pops/time/timestamp_spec.rb +13 -0
- data/spec/unit/pops/types/enumeration_spec.rb +13 -12
- data/spec/unit/pops/types/iterable_spec.rb +262 -0
- data/spec/unit/pops/types/p_binary_type_spec.rb +243 -0
- data/spec/unit/pops/types/p_object_type_spec.rb +1253 -0
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +322 -0
- data/spec/unit/pops/types/p_sensitive_type_spec.rb +169 -0
- data/spec/unit/pops/types/p_timespan_type_spec.rb +273 -0
- data/spec/unit/pops/types/p_timestamp_type_spec.rb +311 -0
- data/spec/unit/pops/types/p_type_set_type_spec.rb +445 -0
- data/spec/unit/pops/types/recursion_guard_spec.rb +93 -0
- data/spec/unit/pops/types/ruby_generator_spec.rb +662 -0
- data/spec/unit/pops/types/string_converter_spec.rb +1132 -0
- data/spec/unit/pops/types/type_acceptor_spec.rb +106 -0
- data/spec/unit/pops/types/type_asserter_spec.rb +43 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +1249 -901
- data/spec/unit/pops/types/type_factory_spec.rb +137 -96
- data/spec/unit/pops/types/type_formatter_spec.rb +409 -0
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +228 -0
- data/spec/unit/pops/types/type_parser_spec.rb +207 -40
- data/spec/unit/pops/types/types_spec.rb +650 -0
- data/spec/unit/pops/validation_spec.rb +66 -0
- data/spec/unit/pops/validator/validator_spec.rb +395 -21
- data/spec/unit/pops/visitor_spec.rb +1 -1
- data/spec/unit/property/ensure_spec.rb +0 -0
- data/spec/unit/property/keyvalue_spec.rb +0 -0
- data/spec/unit/property/list_spec.rb +2 -2
- data/spec/unit/property/ordered_list_spec.rb +0 -0
- data/spec/unit/property_spec.rb +49 -12
- data/spec/unit/provider/augeas/augeas_spec.rb +60 -1
- data/spec/unit/provider/cisco_spec.rb +0 -0
- data/spec/unit/provider/command_spec.rb +0 -0
- data/spec/unit/provider/cron/crontab_spec.rb +0 -0
- data/spec/unit/provider/cron/parsed_spec.rb +1 -0
- data/spec/unit/provider/exec/posix_spec.rb +0 -0
- data/spec/unit/provider/exec/shell_spec.rb +0 -0
- data/spec/unit/provider/exec/windows_spec.rb +0 -0
- data/spec/unit/provider/exec_spec.rb +0 -0
- data/spec/unit/provider/file/posix_spec.rb +0 -0
- data/spec/unit/provider/file/windows_spec.rb +0 -0
- data/spec/unit/provider/group/directoryservice_spec.rb +33 -0
- data/spec/unit/provider/group/groupadd_spec.rb +0 -0
- data/spec/unit/provider/group/ldap_spec.rb +0 -0
- data/spec/unit/provider/group/pw_spec.rb +0 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +88 -18
- data/spec/unit/provider/host/parsed_spec.rb +0 -0
- data/spec/unit/provider/interface/cisco_spec.rb +0 -0
- data/spec/unit/provider/ldap_spec.rb +0 -0
- data/spec/unit/provider/macauthorization_spec.rb +5 -2
- data/spec/unit/provider/mcx/mcxcontent_spec.rb +0 -0
- data/spec/unit/provider/mount/parsed_spec.rb +31 -5
- data/spec/unit/provider/mount_spec.rb +0 -0
- data/spec/unit/provider/naginator_spec.rb +0 -0
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +16 -19
- data/spec/unit/provider/nameservice_spec.rb +167 -15
- data/spec/unit/provider/network_device_spec.rb +0 -0
- data/spec/unit/provider/package/aix_spec.rb +0 -0
- data/spec/unit/provider/package/appdmg_spec.rb +3 -3
- data/spec/unit/provider/package/apt_spec.rb +5 -0
- data/spec/unit/provider/package/aptitude_spec.rb +0 -0
- data/spec/unit/provider/package/aptrpm_spec.rb +3 -3
- data/spec/unit/provider/package/base_spec.rb +18 -0
- data/spec/unit/provider/package/dnf_spec.rb +30 -0
- data/spec/unit/provider/package/dpkg_spec.rb +0 -0
- data/spec/unit/provider/package/freebsd_spec.rb +0 -0
- data/spec/unit/provider/package/gem_spec.rb +77 -0
- data/spec/unit/provider/package/hpux_spec.rb +0 -0
- data/spec/unit/provider/package/macports_spec.rb +0 -0
- data/spec/unit/provider/package/nim_spec.rb +6 -6
- data/spec/unit/provider/package/openbsd_spec.rb +0 -0
- data/spec/unit/provider/package/opkg_spec.rb +0 -0
- data/spec/unit/provider/package/pacman_spec.rb +55 -0
- data/spec/unit/provider/package/pip3_spec.rb +22 -0
- data/spec/unit/provider/package/pip_spec.rb +173 -46
- data/spec/unit/provider/package/pkg_spec.rb +139 -99
- data/spec/unit/provider/package/pkgdmg_spec.rb +32 -8
- data/spec/unit/provider/package/pkgin_spec.rb +23 -13
- data/spec/unit/provider/package/pkgng_spec.rb +186 -0
- data/spec/unit/provider/package/pkgutil_spec.rb +0 -0
- data/spec/unit/provider/package/portage_spec.rb +150 -8
- data/spec/unit/provider/package/puppet_gem_spec.rb +0 -0
- data/spec/unit/provider/package/rpm_spec.rb +183 -12
- data/spec/unit/provider/package/sun_spec.rb +0 -0
- data/spec/unit/provider/package/tdnf_spec.rb +18 -0
- data/spec/unit/provider/package/windows/exe_package_spec.rb +0 -1
- data/spec/unit/provider/package/windows/msi_package_spec.rb +0 -1
- data/spec/unit/provider/package/windows/package_spec.rb +45 -1
- data/spec/unit/provider/package/windows_spec.rb +8 -2
- data/spec/unit/provider/package/yum_spec.rb +29 -466
- data/spec/unit/provider/package/zypper_spec.rb +64 -19
- data/spec/unit/provider/parsedfile_spec.rb +0 -0
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +523 -70
- data/spec/unit/provider/selboolean_spec.rb +0 -0
- data/spec/unit/provider/selmodule_spec.rb +0 -0
- data/spec/unit/provider/service/base_spec.rb +44 -27
- data/spec/unit/provider/service/bsd_spec.rb +130 -0
- data/spec/unit/provider/service/daemontools_spec.rb +0 -0
- data/spec/unit/provider/service/debian_spec.rb +38 -0
- data/spec/unit/provider/service/freebsd_spec.rb +17 -0
- data/spec/unit/provider/service/gentoo_spec.rb +8 -0
- data/spec/unit/provider/service/init_spec.rb +42 -1
- data/spec/unit/provider/service/launchd_spec.rb +124 -25
- data/spec/unit/provider/service/openbsd_spec.rb +1 -0
- data/spec/unit/provider/service/openrc_spec.rb +7 -0
- data/spec/unit/provider/service/openwrt_spec.rb +0 -0
- data/spec/unit/provider/service/rcng_spec.rb +41 -0
- data/spec/unit/provider/service/redhat_spec.rb +9 -1
- data/spec/unit/provider/service/runit_spec.rb +0 -0
- data/spec/unit/provider/service/smf_spec.rb +77 -13
- data/spec/unit/provider/service/src_spec.rb +31 -4
- data/spec/unit/provider/service/systemd_spec.rb +228 -39
- data/spec/unit/provider/service/upstart_spec.rb +64 -0
- data/spec/unit/provider/service/windows_spec.rb +0 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -1
- data/spec/unit/provider/sshkey/parsed_spec.rb +42 -18
- data/spec/unit/provider/user/aix_spec.rb +7 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +171 -90
- data/spec/unit/provider/user/hpux_spec.rb +0 -0
- data/spec/unit/provider/user/ldap_spec.rb +0 -0
- data/spec/unit/provider/user/openbsd_spec.rb +0 -0
- data/spec/unit/provider/user/pw_spec.rb +0 -0
- data/spec/unit/provider/user/user_role_add_spec.rb +0 -0
- data/spec/unit/provider/user/useradd_spec.rb +14 -0
- data/spec/unit/provider/user/windows_adsi_spec.rb +160 -7
- data/spec/unit/provider/vlan/cisco_spec.rb +0 -0
- data/spec/unit/provider/yumrepo/inifile_spec.rb +16 -0
- data/spec/unit/provider/zfs/zfs_spec.rb +0 -0
- data/spec/unit/provider/zone/solaris_spec.rb +64 -12
- data/spec/unit/provider/zpool/zpool_spec.rb +0 -0
- data/spec/unit/provider_spec.rb +0 -0
- data/spec/unit/puppet_spec.rb +16 -3
- data/spec/unit/relationship_spec.rb +15 -36
- data/spec/unit/reports/http_spec.rb +11 -8
- data/spec/unit/reports/store_spec.rb +0 -0
- data/spec/unit/reports_spec.rb +10 -0
- data/spec/unit/resource/capability_finder_spec.rb +147 -0
- data/spec/unit/resource/catalog_spec.rb +294 -41
- data/spec/unit/resource/status_spec.rb +114 -103
- data/spec/unit/resource/type_collection_spec.rb +28 -7
- data/spec/unit/resource/type_spec.rb +172 -82
- data/spec/unit/resource_spec.rb +161 -76
- data/spec/unit/settings/directory_setting_spec.rb +0 -0
- data/spec/unit/settings/duration_setting_spec.rb +0 -0
- data/spec/unit/settings/environment_conf_spec.rb +18 -1
- data/spec/unit/settings/file_setting_spec.rb +37 -0
- data/spec/unit/settings/ini_file_spec.rb +58 -1
- data/spec/unit/settings/path_setting_spec.rb +0 -0
- data/spec/unit/settings/priority_setting_spec.rb +0 -0
- data/spec/unit/settings_spec.rb +120 -5
- data/spec/unit/ssl/base_spec.rb +9 -0
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +180 -13
- data/spec/unit/ssl/certificate_authority_spec.rb +82 -28
- data/spec/unit/ssl/certificate_factory_spec.rb +2 -2
- data/spec/unit/ssl/certificate_request_attributes_spec.rb +6 -0
- data/spec/unit/ssl/certificate_request_spec.rb +4 -5
- data/spec/unit/ssl/certificate_revocation_list_spec.rb +3 -3
- data/spec/unit/ssl/certificate_spec.rb +1 -1
- data/spec/unit/ssl/configuration_spec.rb +11 -2
- data/spec/unit/ssl/host_spec.rb +37 -37
- data/spec/unit/ssl/inventory_spec.rb +27 -3
- data/spec/unit/ssl/key_spec.rb +7 -7
- data/spec/unit/ssl/oids_spec.rb +24 -13
- data/spec/unit/status_spec.rb +7 -7
- data/spec/unit/transaction/additional_resource_generator_spec.rb +160 -31
- data/spec/unit/transaction/event_manager_spec.rb +0 -0
- data/spec/unit/transaction/event_spec.rb +18 -13
- data/spec/unit/transaction/persistence_spec.rb +178 -0
- data/spec/unit/transaction/report_spec.rb +214 -40
- data/spec/unit/transaction/resource_harness_spec.rb +84 -40
- data/spec/unit/transaction_spec.rb +102 -7
- data/spec/unit/type/augeas_spec.rb +0 -0
- data/spec/unit/type/component_spec.rb +0 -0
- data/spec/unit/type/computer_spec.rb +0 -0
- data/spec/unit/type/cron_spec.rb +0 -0
- data/spec/unit/type/exec_spec.rb +57 -12
- data/spec/unit/type/file/checksum_spec.rb +6 -0
- data/spec/unit/type/file/checksum_value_spec.rb +286 -0
- data/spec/unit/type/file/content_spec.rb +59 -208
- data/spec/unit/type/file/ctime_spec.rb +0 -0
- data/spec/unit/type/file/ensure_spec.rb +0 -0
- data/spec/unit/type/file/group_spec.rb +2 -2
- data/spec/unit/type/file/mode_spec.rb +9 -9
- data/spec/unit/type/file/mtime_spec.rb +0 -0
- data/spec/unit/type/file/owner_spec.rb +2 -2
- data/spec/unit/type/file/selinux_spec.rb +2 -0
- data/spec/unit/type/file/source_spec.rb +224 -119
- data/spec/unit/type/file/type_spec.rb +0 -0
- data/spec/unit/type/file_spec.rb +211 -35
- data/spec/unit/type/filebucket_spec.rb +0 -0
- data/spec/unit/type/group_spec.rb +0 -0
- data/spec/unit/type/host_spec.rb +4 -4
- data/spec/unit/type/interface_spec.rb +32 -0
- data/spec/unit/type/k5login_spec.rb +0 -0
- data/spec/unit/type/macauthorization_spec.rb +4 -1
- data/spec/unit/type/mailalias_spec.rb +0 -0
- data/spec/unit/type/maillist_spec.rb +0 -0
- data/spec/unit/type/mcx_spec.rb +0 -0
- data/spec/unit/type/mount_spec.rb +50 -8
- data/spec/unit/type/nagios_spec.rb +0 -0
- data/spec/unit/type/noop_metaparam_spec.rb +0 -0
- data/spec/unit/type/package/package_settings_spec.rb +0 -0
- data/spec/unit/type/package_spec.rb +1 -0
- data/spec/unit/type/resources_spec.rb +0 -0
- data/spec/unit/type/schedule_spec.rb +0 -0
- data/spec/unit/type/selboolean_spec.rb +0 -0
- data/spec/unit/type/selmodule_spec.rb +0 -0
- data/spec/unit/type/service_spec.rb +21 -0
- data/spec/unit/type/ssh_authorized_key_spec.rb +2 -2
- data/spec/unit/type/sshkey_spec.rb +0 -0
- data/spec/unit/type/stage_spec.rb +0 -0
- data/spec/unit/type/tidy_spec.rb +4 -4
- data/spec/unit/type/user_spec.rb +38 -7
- data/spec/unit/type/vlan_spec.rb +1 -1
- data/spec/unit/type/whit_spec.rb +0 -0
- data/spec/unit/type/yumrepo_spec.rb +3 -7
- data/spec/unit/type/zfs_spec.rb +0 -0
- data/spec/unit/type/zone_spec.rb +0 -0
- data/spec/unit/type/zpool_spec.rb +0 -0
- data/spec/unit/type_spec.rb +119 -1
- data/spec/unit/util/at_fork_spec.rb +150 -0
- data/spec/unit/util/autoload_spec.rb +0 -0
- data/spec/unit/util/backups_spec.rb +0 -0
- data/spec/unit/util/character_encoding_spec.rb +229 -0
- data/spec/unit/util/checksums_spec.rb +0 -0
- data/spec/unit/util/colors_spec.rb +0 -0
- data/spec/unit/util/command_line_spec.rb +11 -0
- data/spec/unit/util/constant_inflector_spec.rb +0 -0
- data/spec/unit/util/diff_spec.rb +0 -0
- data/spec/unit/util/errors_spec.rb +0 -0
- data/spec/unit/util/execution_spec.rb +44 -3
- data/spec/unit/util/execution_stub_spec.rb +0 -0
- data/spec/unit/util/feature_spec.rb +1 -1
- data/spec/unit/util/filetype_spec.rb +4 -4
- data/spec/unit/util/http_proxy_spec.rb +91 -0
- data/spec/unit/util/ldap/connection_spec.rb +0 -0
- data/spec/unit/util/ldap/generator_spec.rb +1 -1
- data/spec/unit/util/ldap/manager_spec.rb +0 -0
- data/spec/unit/util/log/destinations_spec.rb +5 -8
- data/spec/unit/util/log_spec.rb +187 -18
- data/spec/unit/util/logging_spec.rb +69 -0
- data/spec/unit/util/metric_spec.rb +9 -2
- data/spec/unit/util/monkey_patches_spec.rb +37 -127
- data/spec/unit/util/multi_match_spec.rb +39 -0
- data/spec/unit/util/nagios_maker_spec.rb +0 -0
- data/spec/unit/util/network_device/cisco/device_spec.rb +253 -216
- data/spec/unit/util/network_device/cisco/facts_spec.rb +0 -0
- data/spec/unit/util/network_device/cisco/interface_spec.rb +0 -0
- data/spec/unit/util/network_device/config_spec.rb +0 -0
- data/spec/unit/util/network_device/ipcalc_spec.rb +0 -0
- data/spec/unit/util/network_device/transport/base_spec.rb +0 -0
- data/spec/unit/util/network_device/transport/ssh_spec.rb +1 -1
- data/spec/unit/util/network_device/transport/telnet_spec.rb +60 -58
- data/spec/unit/util/network_device_spec.rb +1 -1
- data/spec/unit/util/package_spec.rb +0 -0
- data/spec/unit/util/plist_spec.rb +135 -0
- data/spec/unit/util/posix_spec.rb +0 -0
- data/spec/unit/util/rdoc_spec.rb +0 -0
- data/spec/unit/util/resource_template_spec.rb +2 -2
- data/spec/unit/util/retry_action_spec.rb +0 -0
- data/spec/unit/util/run_mode_spec.rb +44 -13
- data/spec/unit/util/selinux_spec.rb +0 -0
- data/spec/unit/util/splayer_spec.rb +45 -0
- data/spec/unit/util/storage_spec.rb +8 -1
- data/spec/unit/util/suidmanager_spec.rb +0 -0
- data/spec/unit/util/symbolic_file_mode_spec.rb +0 -0
- data/spec/unit/util/tag_set_spec.rb +2 -2
- data/spec/unit/util/tagging_spec.rb +59 -0
- data/spec/unit/util/user_attr_spec.rb +0 -0
- data/spec/unit/util/warnings_spec.rb +0 -0
- data/spec/unit/util/windows/adsi_spec.rb +196 -60
- data/spec/unit/util/windows/api_types_spec.rb +42 -0
- data/spec/unit/util/windows/eventlog_spec.rb +123 -0
- data/spec/unit/util/windows/file_spec.rb +89 -0
- data/spec/unit/util/windows/root_certs_spec.rb +0 -0
- data/spec/unit/util/windows/security_descriptor_spec.rb +3 -3
- data/spec/unit/util/windows/sid_spec.rb +76 -24
- data/spec/unit/util/yaml_spec.rb +13 -1
- data/spec/unit/util_spec.rb +456 -17
- data/spec/unit/version_spec.rb +19 -0
- data/spec/watchr.rb +0 -0
- data/tasks/benchmark.rake +3 -3
- data/tasks/cfpropertylist.rake +15 -0
- data/tasks/generate_ast_model.rake +78 -0
- metadata +3474 -3068
- checksums.yaml +0 -7
- data/bin/extlookup2hiera +0 -56
- data/ext/emacs/puppet-mode-init.el +0 -6
- data/ext/emacs/puppet-mode.el +0 -433
- data/ext/puppet-nm-dispatcher +0 -13
- data/ext/puppetlisten/puppetlisten.rb +0 -77
- data/ext/puppetlisten/puppetrun.rb +0 -38
- data/ext/systemd/puppetmaster.service +0 -11
- data/ext/vim/README +0 -3
- data/ext/vim/ftdetect/puppet.vim +0 -2
- data/ext/vim/ftplugin/puppet.vim +0 -94
- data/ext/vim/indent/puppet.vim +0 -76
- data/ext/vim/syntax/puppet.vim +0 -115
- data/lib/puppet/application/file.rb +0 -4
- data/lib/puppet/application/inspect.rb +0 -179
- data/lib/puppet/application/resource_type.rb +0 -7
- data/lib/puppet/data_providers/data_adapter.rb +0 -91
- data/lib/puppet/data_providers/data_function_support.rb +0 -45
- data/lib/puppet/data_providers/function_env_data_provider.rb +0 -28
- data/lib/puppet/data_providers/function_module_data_provider.rb +0 -39
- data/lib/puppet/data_providers.rb +0 -31
- data/lib/puppet/face/file/download.rb +0 -56
- data/lib/puppet/face/file/store.rb +0 -21
- data/lib/puppet/face/file.rb +0 -47
- data/lib/puppet/face/resource_type.rb +0 -84
- data/lib/puppet/feature/cfacter.rb +0 -14
- data/lib/puppet/feature/external_facts.rb +0 -5
- data/lib/puppet/indirector/catalog/static_compiler.rb +0 -213
- data/lib/puppet/indirector/resource_type/parser.rb +0 -101
- data/lib/puppet/indirector/resource_type/rest.rb +0 -7
- data/lib/puppet/indirector/resource_type.rb +0 -5
- data/lib/puppet/parser/yaml_trimmer.rb +0 -7
- data/lib/puppet/plugins/binding_schemes.rb +0 -140
- data/lib/puppet/plugins/data_providers.rb +0 -90
- data/lib/puppet/pops/binder/binder.rb +0 -394
- data/lib/puppet/pops/binder/binder_issues.rb +0 -122
- data/lib/puppet/pops/binder/bindings_checker.rb +0 -197
- data/lib/puppet/pops/binder/bindings_composer.rb +0 -177
- data/lib/puppet/pops/binder/bindings_factory.rb +0 -809
- data/lib/puppet/pops/binder/bindings_label_provider.rb +0 -43
- data/lib/puppet/pops/binder/bindings_loader.rb +0 -83
- data/lib/puppet/pops/binder/bindings_model.rb +0 -68
- data/lib/puppet/pops/binder/bindings_model_dumper.rb +0 -215
- data/lib/puppet/pops/binder/bindings_model_meta.rb +0 -215
- data/lib/puppet/pops/binder/bindings_validator_factory.rb +0 -28
- data/lib/puppet/pops/binder/config/binder_config.rb +0 -107
- data/lib/puppet/pops/binder/config/binder_config_checker.rb +0 -142
- data/lib/puppet/pops/binder/config/diagnostic_producer.rb +0 -32
- data/lib/puppet/pops/binder/config/issues.rb +0 -90
- data/lib/puppet/pops/binder/injector.rb +0 -766
- data/lib/puppet/pops/binder/injector_entry.rb +0 -57
- data/lib/puppet/pops/binder/key_factory.rb +0 -67
- data/lib/puppet/pops/binder/producers.rb +0 -826
- data/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb +0 -34
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +0 -84
- data/lib/puppet/pops/binder/scheme_handler/symbolic_scheme.rb +0 -53
- data/lib/puppet/pops/binder/system_bindings.rb +0 -60
- data/lib/puppet/pops/containment.rb +0 -104
- data/lib/puppet/pops/evaluator/callable_mismatch_describer.rb +0 -175
- data/lib/puppet/pops/model/model.rb +0 -114
- data/lib/puppet/pops/model/model_meta.rb +0 -582
- data/lib/puppet/pops/types/types_meta.rb +0 -223
- data/lib/puppet/resource/type_collection_helper.rb +0 -7
- data/lib/puppet/vendor/load_plist.rb +0 -1
- data/lib/puppet/vendor/load_rgen.rb +0 -2
- data/lib/puppet/vendor/plist/CHANGELOG +0 -82
- data/lib/puppet/vendor/plist/MIT-LICENSE +0 -21
- data/lib/puppet/vendor/plist/PUPPET_README.md +0 -6
- data/lib/puppet/vendor/plist/README +0 -36
- data/lib/puppet/vendor/plist/Rakefile +0 -144
- data/lib/puppet/vendor/plist/docs/USAGE +0 -104
- data/lib/puppet/vendor/plist/docs/jamis-template.rb +0 -591
- data/lib/puppet/vendor/plist/lib/plist/generator.rb +0 -224
- data/lib/puppet/vendor/plist/lib/plist/parser.rb +0 -225
- data/lib/puppet/vendor/plist/lib/plist.rb +0 -22
- data/lib/puppet/vendor/plist/test/assets/AlbumData.xml +0 -203
- data/lib/puppet/vendor/plist/test/assets/Cookies.plist +0 -104
- data/lib/puppet/vendor/plist/test/assets/commented.plist +0 -9
- data/lib/puppet/vendor/plist/test/assets/example_data.bin +0 -0
- data/lib/puppet/vendor/plist/test/assets/example_data.jpg +0 -0
- data/lib/puppet/vendor/plist/test/assets/example_data.plist +0 -259
- data/lib/puppet/vendor/plist/test/assets/test_data_elements.plist +0 -24
- data/lib/puppet/vendor/plist/test/assets/test_empty_key.plist +0 -13
- data/lib/puppet/vendor/plist/test/test_data_elements.rb +0 -115
- data/lib/puppet/vendor/plist/test/test_generator.rb +0 -59
- data/lib/puppet/vendor/plist/test/test_generator_basic_types.rb +0 -58
- data/lib/puppet/vendor/plist/test/test_generator_collections.rb +0 -82
- data/lib/puppet/vendor/plist/test/test_parser.rb +0 -90
- data/lib/puppet/vendor/rgen/CHANGELOG +0 -197
- data/lib/puppet/vendor/rgen/MIT-LICENSE +0 -20
- data/lib/puppet/vendor/rgen/PUPPET_README.md +0 -6
- data/lib/puppet/vendor/rgen/README.rdoc +0 -78
- data/lib/puppet/vendor/rgen/Rakefile +0 -41
- data/lib/puppet/vendor/rgen/TODO +0 -41
- data/lib/puppet/vendor/rgen/anounce.txt +0 -61
- data/lib/puppet/vendor/rgen/design_rationale.txt +0 -71
- data/lib/puppet/vendor/rgen/lib/ea_support/ea_support.rb +0 -54
- data/lib/puppet/vendor/rgen/lib/ea_support/id_store.rb +0 -32
- data/lib/puppet/vendor/rgen/lib/ea_support/uml13_ea_metamodel.rb +0 -562
- data/lib/puppet/vendor/rgen/lib/ea_support/uml13_ea_metamodel_ext.rb +0 -45
- data/lib/puppet/vendor/rgen/lib/ea_support/uml13_ea_metamodel_generator.rb +0 -43
- data/lib/puppet/vendor/rgen/lib/ea_support/uml13_ea_to_uml13.rb +0 -103
- data/lib/puppet/vendor/rgen/lib/ea_support/uml13_to_uml13_ea.rb +0 -89
- data/lib/puppet/vendor/rgen/lib/metamodels/uml13_metamodel.rb +0 -559
- data/lib/puppet/vendor/rgen/lib/metamodels/uml13_metamodel_ext.rb +0 -26
- data/lib/puppet/vendor/rgen/lib/mmgen/metamodel_generator.rb +0 -20
- data/lib/puppet/vendor/rgen/lib/mmgen/mm_ext/ecore_mmgen_ext.rb +0 -91
- data/lib/puppet/vendor/rgen/lib/mmgen/mmgen.rb +0 -28
- data/lib/puppet/vendor/rgen/lib/mmgen/templates/annotations.tpl +0 -37
- data/lib/puppet/vendor/rgen/lib/mmgen/templates/metamodel_generator.tpl +0 -172
- data/lib/puppet/vendor/rgen/lib/rgen/array_extensions.rb +0 -45
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ecore.rb +0 -218
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ecore_builder_methods.rb +0 -81
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ecore_ext.rb +0 -69
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ecore_interface.rb +0 -47
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ecore_to_ruby.rb +0 -167
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ruby_to_ecore.rb +0 -91
- data/lib/puppet/vendor/rgen/lib/rgen/environment.rb +0 -129
- data/lib/puppet/vendor/rgen/lib/rgen/fragment/dump_file_cache.rb +0 -63
- data/lib/puppet/vendor/rgen/lib/rgen/fragment/fragmented_model.rb +0 -140
- data/lib/puppet/vendor/rgen/lib/rgen/fragment/model_fragment.rb +0 -289
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/abstract_instantiator.rb +0 -66
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/abstract_xml_instantiator.rb +0 -66
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/default_xml_instantiator.rb +0 -117
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/ecore_xml_instantiator.rb +0 -169
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/json_instantiator.rb +0 -126
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/json_parser.rb +0 -331
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/json_parser.y +0 -94
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/nodebased_xml_instantiator.rb +0 -137
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/qualified_name_resolver.rb +0 -97
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/reference_resolver.rb +0 -128
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/resolution_helper.rb +0 -47
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/xmi11_instantiator.rb +0 -168
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/builder_extensions.rb +0 -556
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/builder_runtime.rb +0 -174
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/constant_order_helper.rb +0 -89
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/data_types.rb +0 -77
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/intermediate/annotation.rb +0 -30
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/intermediate/feature.rb +0 -168
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/mm_multiple.rb +0 -23
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/module_extension.rb +0 -42
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder.rb +0 -224
- data/lib/puppet/vendor/rgen/lib/rgen/model_builder/builder_context.rb +0 -334
- data/lib/puppet/vendor/rgen/lib/rgen/model_builder/model_serializer.rb +0 -225
- data/lib/puppet/vendor/rgen/lib/rgen/model_builder/reference_resolver.rb +0 -156
- data/lib/puppet/vendor/rgen/lib/rgen/model_builder.rb +0 -32
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/json_serializer.rb +0 -121
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/opposite_reference_filter.rb +0 -18
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/qualified_name_provider.rb +0 -47
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/xmi11_serializer.rb +0 -116
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/xmi20_serializer.rb +0 -71
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/xml_serializer.rb +0 -98
- data/lib/puppet/vendor/rgen/lib/rgen/template_language/directory_template_container.rb +0 -83
- data/lib/puppet/vendor/rgen/lib/rgen/template_language/output_handler.rb +0 -87
- data/lib/puppet/vendor/rgen/lib/rgen/template_language/template_container.rb +0 -234
- data/lib/puppet/vendor/rgen/lib/rgen/template_language/template_helper.rb +0 -26
- data/lib/puppet/vendor/rgen/lib/rgen/template_language.rb +0 -297
- data/lib/puppet/vendor/rgen/lib/rgen/transformer.rb +0 -475
- data/lib/puppet/vendor/rgen/lib/rgen/util/auto_class_creator.rb +0 -61
- data/lib/puppet/vendor/rgen/lib/rgen/util/cached_glob.rb +0 -67
- data/lib/puppet/vendor/rgen/lib/rgen/util/file_cache_map.rb +0 -124
- data/lib/puppet/vendor/rgen/lib/rgen/util/file_change_detector.rb +0 -84
- data/lib/puppet/vendor/rgen/lib/rgen/util/method_delegation.rb +0 -114
- data/lib/puppet/vendor/rgen/lib/rgen/util/model_comparator.rb +0 -68
- data/lib/puppet/vendor/rgen/lib/rgen/util/model_comparator_base.rb +0 -142
- data/lib/puppet/vendor/rgen/lib/rgen/util/model_dumper.rb +0 -29
- data/lib/puppet/vendor/rgen/lib/rgen/util/name_helper.rb +0 -42
- data/lib/puppet/vendor/rgen/lib/rgen/util/pattern_matcher.rb +0 -329
- data/lib/puppet/vendor/rgen/lib/transformers/ecore_to_uml13.rb +0 -79
- data/lib/puppet/vendor/rgen/lib/transformers/uml13_to_ecore.rb +0 -127
- data/lib/puppet/vendor/rgen/test/array_extensions_test.rb +0 -64
- data/lib/puppet/vendor/rgen/test/ea_instantiator_test.rb +0 -35
- data/lib/puppet/vendor/rgen/test/ea_serializer_test.rb +0 -23
- data/lib/puppet/vendor/rgen/test/ecore_self_test.rb +0 -54
- data/lib/puppet/vendor/rgen/test/environment_test.rb +0 -90
- data/lib/puppet/vendor/rgen/test/json_test.rb +0 -171
- data/lib/puppet/vendor/rgen/test/metamodel_builder_test.rb +0 -1482
- data/lib/puppet/vendor/rgen/test/metamodel_from_ecore_test.rb +0 -57
- data/lib/puppet/vendor/rgen/test/metamodel_order_test.rb +0 -131
- data/lib/puppet/vendor/rgen/test/metamodel_roundtrip_test/TestModel.rb +0 -70
- data/lib/puppet/vendor/rgen/test/metamodel_roundtrip_test/houseMetamodel.ecore +0 -42
- data/lib/puppet/vendor/rgen/test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb +0 -44
- data/lib/puppet/vendor/rgen/test/metamodel_roundtrip_test/using_builtin_types.ecore +0 -9
- data/lib/puppet/vendor/rgen/test/metamodel_roundtrip_test.rb +0 -98
- data/lib/puppet/vendor/rgen/test/method_delegation_test.rb +0 -178
- data/lib/puppet/vendor/rgen/test/model_builder/builder_context_test.rb +0 -59
- data/lib/puppet/vendor/rgen/test/model_builder/builder_test.rb +0 -242
- data/lib/puppet/vendor/rgen/test/model_builder/ecore_original.rb +0 -163
- data/lib/puppet/vendor/rgen/test/model_builder/ecore_original_regenerated.rb +0 -163
- data/lib/puppet/vendor/rgen/test/model_builder/reference_resolver_test.rb +0 -156
- data/lib/puppet/vendor/rgen/test/model_builder/serializer_test.rb +0 -94
- data/lib/puppet/vendor/rgen/test/model_builder/statemachine_metamodel.rb +0 -42
- data/lib/puppet/vendor/rgen/test/model_builder/test_model/statemachine1.rb +0 -23
- data/lib/puppet/vendor/rgen/test/model_builder_test.rb +0 -6
- data/lib/puppet/vendor/rgen/test/model_fragment_test.rb +0 -30
- data/lib/puppet/vendor/rgen/test/output_handler_test.rb +0 -58
- data/lib/puppet/vendor/rgen/test/qualified_name_provider_test.rb +0 -48
- data/lib/puppet/vendor/rgen/test/qualified_name_resolver_test.rb +0 -102
- data/lib/puppet/vendor/rgen/test/reference_resolver_test.rb +0 -117
- data/lib/puppet/vendor/rgen/test/rgen_test.rb +0 -26
- data/lib/puppet/vendor/rgen/test/template_language_test/expected_result1.txt +0 -29
- data/lib/puppet/vendor/rgen/test/template_language_test/expected_result2.txt +0 -9
- data/lib/puppet/vendor/rgen/test/template_language_test/expected_result3.txt +0 -4
- data/lib/puppet/vendor/rgen/test/template_language_test/indentStringTestDefaultIndent.out +0 -1
- data/lib/puppet/vendor/rgen/test/template_language_test/indentStringTestTabIndent.out +0 -1
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/callback_indent_test/a.tpl +0 -12
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/callback_indent_test/b.tpl +0 -5
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/code/array.tpl +0 -11
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/content/author.tpl +0 -7
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/content/chapter.tpl +0 -5
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/define_local_test/local.tpl +0 -8
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/define_local_test/test.tpl +0 -8
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/evaluate_test/test.tpl +0 -7
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/indent_string_test.tpl +0 -12
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/index/c/cmod.tpl +0 -1
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/index/chapter.tpl +0 -3
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_backslash_r_test.tpl +0 -5
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_indent_test/no_indent.tpl +0 -3
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_indent_test/sub1/no_indent.tpl +0 -3
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_indent_test/test.tpl +0 -24
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_indent_test/test2.tpl +0 -13
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_indent_test/test3.tpl +0 -10
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/null_context_test.tpl +0 -17
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/root.tpl +0 -31
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/template_resolution_test/sub1/sub1.tpl +0 -3
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/template_resolution_test/sub1.tpl +0 -9
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/template_resolution_test/test.tpl +0 -4
- data/lib/puppet/vendor/rgen/test/template_language_test/testout.txt +0 -29
- data/lib/puppet/vendor/rgen/test/template_language_test.rb +0 -163
- data/lib/puppet/vendor/rgen/test/testmodel/class_model_checker.rb +0 -119
- data/lib/puppet/vendor/rgen/test/testmodel/ea_testmodel.eap +0 -0
- data/lib/puppet/vendor/rgen/test/testmodel/ea_testmodel.xml +0 -1029
- data/lib/puppet/vendor/rgen/test/testmodel/ea_testmodel_partial.xml +0 -317
- data/lib/puppet/vendor/rgen/test/testmodel/ecore_model_checker.rb +0 -101
- data/lib/puppet/vendor/rgen/test/testmodel/manual_testmodel.xml +0 -22
- data/lib/puppet/vendor/rgen/test/testmodel/object_model_checker.rb +0 -67
- data/lib/puppet/vendor/rgen/test/transformer_test.rb +0 -254
- data/lib/puppet/vendor/rgen/test/util/file_cache_map_test.rb +0 -99
- data/lib/puppet/vendor/rgen/test/util/pattern_matcher_test.rb +0 -97
- data/lib/puppet/vendor/rgen/test/util_test.rb +0 -5
- data/lib/puppet/vendor/rgen/test/xml_instantiator_test/simple_ecore_model_checker.rb +0 -94
- data/lib/puppet/vendor/rgen/test/xml_instantiator_test/simple_xmi_ecore_instantiator.rb +0 -53
- data/lib/puppet/vendor/rgen/test/xml_instantiator_test/simple_xmi_metamodel.rb +0 -49
- data/lib/puppet/vendor/rgen/test/xml_instantiator_test/simple_xmi_to_ecore.rb +0 -75
- data/lib/puppet/vendor/rgen/test/xml_instantiator_test.rb +0 -160
- data/lib/puppet/vendor/rgen_patch.rb +0 -132
- data/lib/puppet/vendor/semantic/Gemfile +0 -20
- data/lib/puppet/vendor/semantic/PUPPET_README.md +0 -6
- data/lib/puppet/vendor/semantic/Rakefile +0 -69
- data/lib/puppet/vendor/semantic/lib/semantic/version.rb +0 -168
- data/lib/puppet/vendor/semantic/lib/semantic/version_range.rb +0 -424
- data/lib/puppet/vendor/semantic/spec/spec_helper.rb +0 -24
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_node_spec.rb +0 -141
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_spec.rb +0 -162
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/module_release_spec.rb +0 -143
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/source_spec.rb +0 -5
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/unsatisfiable_graph_spec.rb +0 -44
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency_spec.rb +0 -383
- data/lib/puppet/vendor/semantic/spec/unit/semantic/version_range_spec.rb +0 -307
- data/lib/puppet/vendor/semantic/spec/unit/semantic/version_spec.rb +0 -608
- data/lib/semver.rb +0 -123
- data/man/man8/extlookup2hiera.8 +0 -10
- data/man/man8/puppet-file.8 +0 -189
- data/man/man8/puppet-resource_type.8 +0 -188
- data/spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/bindings/abc/default.rb +0 -9
- data/spec/fixtures/unit/data_providers/environments/sample/manifests/site.pp +0 -6
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet/bindings/dataprovider/default.rb +0 -54
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_env_data.rb +0 -31
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_module_data.rb +0 -32
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/manifests/init.pp +0 -5
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/abc/lib/puppet/bindings/abc/default.rb +0 -9
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/bad_data/lib/puppet/bindings/bad_data/default.rb +0 -9
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/bad_data/manifests/init.pp +0 -3
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/bca/lib/puppet/bindings/bca/default.rb +0 -9
- data/spec/integration/data_binding.rb +0 -104
- data/spec/integration/parser/functions/require_spec.rb +0 -43
- data/spec/integration/provider/package_spec.rb +0 -33
- data/spec/unit/application/inspect_spec.rb +0 -287
- data/spec/unit/data_providers/sample_data_provider_spec.rb +0 -52
- data/spec/unit/face/file_spec.rb +0 -10
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +0 -237
- data/spec/unit/indirector/resource_type/parser_spec.rb +0 -254
- data/spec/unit/indirector/resource_type/rest_spec.rb +0 -14
- data/spec/unit/parser/functions/defined_spec.rb +0 -120
- data/spec/unit/parser/functions/include_spec.rb +0 -55
- data/spec/unit/parser/functions/require_spec.rb +0 -68
- data/spec/unit/pops/binder/binder_spec.rb +0 -43
- data/spec/unit/pops/binder/bindings_checker_spec.rb +0 -155
- data/spec/unit/pops/binder/bindings_composer_spec.rb +0 -64
- data/spec/unit/pops/binder/bindings_validator_factory_spec.rb +0 -18
- data/spec/unit/pops/binder/config/binder_config_spec.rb +0 -42
- data/spec/unit/pops/binder/injector_spec.rb +0 -768
- data/spec/unit/pops/parser/rgen_sanitycheck_spec.rb +0 -23
- data/spec/unit/resource/type_collection_helper_spec.rb +0 -24
- data/spec/unit/semver_spec.rb +0 -305
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/environment.conf +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/lib/puppet/functions/environment/data.rb +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/abc/lib/puppet/functions/abc/data.rb +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/abc/manifests/init.pp +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/bca/lib/puppet/functions/bca/data.rb +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/bca/manifests/init.pp +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/no_provider/manifests/init.pp +0 -0
- /data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/{usee → modules/usee}/lib/puppet/functions/usee/callee.rb +0 -0
- /data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/{user → modules/user}/lib/puppet/functions/user/caller.rb +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
module Puppet::Pops
|
|
2
|
+
module Types
|
|
1
3
|
# The TypeCalculator can answer questions about puppet types.
|
|
2
4
|
#
|
|
3
5
|
# The Puppet type system is primarily based on sub-classing. When asking the type calculator to infer types from Ruby in general, it
|
|
@@ -41,8 +43,8 @@
|
|
|
41
43
|
#
|
|
42
44
|
# Creation of Type instances
|
|
43
45
|
# --------------------------
|
|
44
|
-
# Instance of the classes in the {
|
|
45
|
-
# to use the {
|
|
46
|
+
# Instance of the classes in the {Types type model} are used to denote a specific type. It is most convenient
|
|
47
|
+
# to use the {TypeFactory} when creating instances.
|
|
46
48
|
#
|
|
47
49
|
# @note
|
|
48
50
|
# In general, new instances of the wanted type should be created as they are assigned to models using containment, and a
|
|
@@ -82,9 +84,9 @@
|
|
|
82
84
|
# no instances present in the first place. If however the classes are not present, the type
|
|
83
85
|
# calculator will fall back and state that the two types at least have Any in common.
|
|
84
86
|
#
|
|
85
|
-
# @see
|
|
86
|
-
# @see
|
|
87
|
-
# @see
|
|
87
|
+
# @see TypeFactory for how to create instances of types
|
|
88
|
+
# @see TypeParser how to construct a type instance from a String
|
|
89
|
+
# @see Types for details about the type model
|
|
88
90
|
#
|
|
89
91
|
# Using the Type Calculator
|
|
90
92
|
# -----
|
|
@@ -96,9 +98,7 @@
|
|
|
96
98
|
#
|
|
97
99
|
# @api public
|
|
98
100
|
#
|
|
99
|
-
class
|
|
100
|
-
|
|
101
|
-
Types = Puppet::Pops::Types
|
|
101
|
+
class TypeCalculator
|
|
102
102
|
|
|
103
103
|
# @api public
|
|
104
104
|
def self.assignable?(t1, t2)
|
|
@@ -106,8 +106,8 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
# Answers, does the given callable accept the arguments given in args (an array or a tuple)
|
|
109
|
-
# @param callable [
|
|
110
|
-
# @param args [
|
|
109
|
+
# @param callable [PCallableType] - the callable
|
|
110
|
+
# @param args [PArrayType, PTupleType] args optionally including a lambda callable at the end
|
|
111
111
|
# @return [Boolan] true if the callable accepts the arguments
|
|
112
112
|
#
|
|
113
113
|
# @api public
|
|
@@ -115,24 +115,14 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
115
115
|
singleton.callable?(callable, args)
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
-
# Produces a String representation of the given type.
|
|
119
|
-
# @param t [Puppet::Pops::Types::PAnyType] the type to produce a string form
|
|
120
|
-
# @return [String] the type in string form
|
|
121
|
-
#
|
|
122
|
-
# @api public
|
|
123
|
-
#
|
|
124
|
-
def self.string(t)
|
|
125
|
-
singleton.string(t)
|
|
126
|
-
end
|
|
127
|
-
|
|
128
118
|
# @api public
|
|
129
119
|
def self.infer(o)
|
|
130
120
|
singleton.infer(o)
|
|
131
121
|
end
|
|
132
122
|
|
|
133
123
|
# @api public
|
|
134
|
-
def self.generalize
|
|
135
|
-
singleton.generalize
|
|
124
|
+
def self.generalize(o)
|
|
125
|
+
singleton.generalize(o)
|
|
136
126
|
end
|
|
137
127
|
|
|
138
128
|
# @api public
|
|
@@ -141,118 +131,22 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
141
131
|
end
|
|
142
132
|
|
|
143
133
|
# @api public
|
|
144
|
-
def self.
|
|
145
|
-
singleton.
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
# @api public
|
|
149
|
-
def self.enumerable(t)
|
|
150
|
-
singleton.enumerable(t)
|
|
134
|
+
def self.iterable(t)
|
|
135
|
+
singleton.iterable(t)
|
|
151
136
|
end
|
|
152
137
|
|
|
138
|
+
# @return [TypeCalculator] the singleton instance
|
|
139
|
+
#
|
|
153
140
|
# @api private
|
|
154
|
-
def self.singleton
|
|
141
|
+
def self.singleton
|
|
155
142
|
@tc_instance ||= new
|
|
156
143
|
end
|
|
157
144
|
|
|
158
145
|
# @api public
|
|
159
146
|
#
|
|
160
147
|
def initialize
|
|
161
|
-
@@
|
|
162
|
-
@@
|
|
163
|
-
@@infer_set_visitor ||= Puppet::Pops::Visitor.new(nil,"infer_set",0,0)
|
|
164
|
-
@@instance_of_visitor ||= Puppet::Pops::Visitor.new(nil,"instance_of",1,1)
|
|
165
|
-
@@string_visitor ||= Puppet::Pops::Visitor.new(nil,"string",0,0)
|
|
166
|
-
@@inspect_visitor ||= Puppet::Pops::Visitor.new(nil,"debug_string",0,0)
|
|
167
|
-
@@enumerable_visitor ||= Puppet::Pops::Visitor.new(nil,"enumerable",0,0)
|
|
168
|
-
@@extract_visitor ||= Puppet::Pops::Visitor.new(nil,"extract",0,0)
|
|
169
|
-
@@generalize_visitor ||= Puppet::Pops::Visitor.new(nil,"generalize",0,0)
|
|
170
|
-
@@callable_visitor ||= Puppet::Pops::Visitor.new(nil,"callable",1,1)
|
|
171
|
-
|
|
172
|
-
da = Types::PArrayType.new()
|
|
173
|
-
da.element_type = Types::PDataType.new()
|
|
174
|
-
@data_array = da
|
|
175
|
-
|
|
176
|
-
h = Types::PHashType.new()
|
|
177
|
-
h.element_type = Types::PDataType.new()
|
|
178
|
-
h.key_type = Types::PScalarType.new()
|
|
179
|
-
@data_hash = h
|
|
180
|
-
|
|
181
|
-
@data_t = Types::PDataType.new()
|
|
182
|
-
@scalar_t = Types::PScalarType.new()
|
|
183
|
-
@numeric_t = Types::PNumericType.new()
|
|
184
|
-
@t = Types::PAnyType.new()
|
|
185
|
-
|
|
186
|
-
# Data accepts a Tuple that has 0-infinity Data compatible entries (e.g. a Tuple equivalent to Array).
|
|
187
|
-
data_tuple = Types::PTupleType.new()
|
|
188
|
-
data_tuple.addTypes(Types::PDataType.new())
|
|
189
|
-
data_tuple.size_type = Types::PIntegerType.new()
|
|
190
|
-
data_tuple.size_type.from = 0
|
|
191
|
-
data_tuple.size_type.to = nil # infinity
|
|
192
|
-
@data_tuple_t = data_tuple
|
|
193
|
-
|
|
194
|
-
# Variant type compatible with Data
|
|
195
|
-
data_variant = Types::PVariantType.new()
|
|
196
|
-
data_variant.addTypes(@data_hash.copy)
|
|
197
|
-
data_variant.addTypes(@data_array.copy)
|
|
198
|
-
data_variant.addTypes(Types::PScalarType.new)
|
|
199
|
-
data_variant.addTypes(Types::PUndefType.new)
|
|
200
|
-
data_variant.addTypes(@data_tuple_t.copy)
|
|
201
|
-
@data_variant_t = data_variant
|
|
202
|
-
|
|
203
|
-
collection_default_size = Types::PIntegerType.new()
|
|
204
|
-
collection_default_size.from = 0
|
|
205
|
-
collection_default_size.to = nil # infinity
|
|
206
|
-
@collection_default_size_t = collection_default_size
|
|
207
|
-
|
|
208
|
-
non_empty_string = Types::PStringType.new
|
|
209
|
-
non_empty_string.size_type = Types::PIntegerType.new()
|
|
210
|
-
non_empty_string.size_type.from = 1
|
|
211
|
-
non_empty_string.size_type.to = nil # infinity
|
|
212
|
-
@non_empty_string_t = non_empty_string
|
|
213
|
-
|
|
214
|
-
@nil_t = Types::PUndefType.new
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
# Convenience method to get a data type for comparisons
|
|
218
|
-
# @api private the returned value may not be contained in another element
|
|
219
|
-
#
|
|
220
|
-
def data
|
|
221
|
-
@data_t
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
# Convenience method to get a variant compatible with the Data type.
|
|
225
|
-
# @api private the returned value may not be contained in another element
|
|
226
|
-
#
|
|
227
|
-
def data_variant
|
|
228
|
-
@data_variant_t
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
def self.data_variant
|
|
232
|
-
singleton.data_variant
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
# Answers the question 'is it possible to inject an instance of the given class'
|
|
236
|
-
# A class is injectable if it has a special *assisted inject* class method called `inject` taking
|
|
237
|
-
# an injector and a scope as argument, or if it has a zero args `initialize` method.
|
|
238
|
-
#
|
|
239
|
-
# @param klazz [Class, PRuntimeType] the class/type to check if it is injectable
|
|
240
|
-
# @return [Class, nil] the injectable Class, or nil if not injectable
|
|
241
|
-
# @api public
|
|
242
|
-
#
|
|
243
|
-
def injectable_class(klazz)
|
|
244
|
-
# Handle case when we get a PType instead of a class
|
|
245
|
-
if klazz.is_a?(Types::PRuntimeType)
|
|
246
|
-
klazz = Puppet::Pops::Types::ClassLoader.provide(klazz)
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
# data types can not be injected (check again, it is not safe to assume that given RubyRuntime klazz arg was ok)
|
|
250
|
-
return false unless type(klazz).is_a?(Types::PRuntimeType)
|
|
251
|
-
if (klazz.respond_to?(:inject) && klazz.method(:inject).arity() == -4) || klazz.instance_method(:initialize).arity() == 0
|
|
252
|
-
klazz
|
|
253
|
-
else
|
|
254
|
-
nil
|
|
255
|
-
end
|
|
148
|
+
@@infer_visitor ||= Visitor.new(nil, 'infer',0,0)
|
|
149
|
+
@@extract_visitor ||= Visitor.new(nil, 'extract',0,0)
|
|
256
150
|
end
|
|
257
151
|
|
|
258
152
|
# Answers 'can an instance of type t2 be assigned to a variable of type t'.
|
|
@@ -261,40 +155,33 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
261
155
|
# @api public
|
|
262
156
|
#
|
|
263
157
|
def assignable?(t, t2)
|
|
264
|
-
if t.is_a?(
|
|
158
|
+
if t.is_a?(Module)
|
|
265
159
|
t = type(t)
|
|
266
160
|
end
|
|
267
|
-
|
|
268
|
-
if t2.is_a?(Class)
|
|
269
|
-
t2 = type(t2)
|
|
270
|
-
end
|
|
271
|
-
# Unit can be assigned to anything
|
|
272
|
-
return true if t2.class == Types::PUnitType
|
|
273
|
-
|
|
274
|
-
if t2.class == Types::PVariantType
|
|
275
|
-
# Assignable if all contained types are assignable
|
|
276
|
-
t2.types.all? { |vt| @@assignable_visitor.visit_this_1(self, t, vt) }
|
|
277
|
-
else
|
|
278
|
-
@@assignable_visitor.visit_this_1(self, t, t2)
|
|
279
|
-
end
|
|
161
|
+
t.is_a?(PAnyType) ? t.assignable?(t2) : false
|
|
280
162
|
end
|
|
281
163
|
|
|
282
|
-
# Returns an
|
|
164
|
+
# Returns an iterable if the t represents something that can be iterated
|
|
283
165
|
def enumerable(t)
|
|
284
|
-
|
|
166
|
+
Puppet.deprecation_warning('TypeCalculator.enumerable is deprecated. Use iterable')
|
|
167
|
+
iterable(t)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Returns an iterable if the t represents something that can be iterated
|
|
171
|
+
def iterable(t)
|
|
172
|
+
# Create an iterable on the type if possible
|
|
173
|
+
Iterable.on(t)
|
|
285
174
|
end
|
|
286
175
|
|
|
287
176
|
# Answers, does the given callable accept the arguments given in args (an array or a tuple)
|
|
288
177
|
#
|
|
289
178
|
def callable?(callable, args)
|
|
290
|
-
|
|
291
|
-
# Note that polymorphism is for the args type, the callable is always a callable
|
|
292
|
-
@@callable_visitor.visit_this_1(self, args, callable)
|
|
179
|
+
callable.is_a?(PAnyType) && callable.callable?(args)
|
|
293
180
|
end
|
|
294
181
|
|
|
295
182
|
# Answers if the two given types describe the same type
|
|
296
183
|
def equals(left, right)
|
|
297
|
-
return false unless left.is_a?(
|
|
184
|
+
return false unless left.is_a?(PAnyType) && right.is_a?(PAnyType)
|
|
298
185
|
# Types compare per class only - an extra test must be made if the are mutually assignable
|
|
299
186
|
# to find all types that represent the same type of instance
|
|
300
187
|
#
|
|
@@ -302,77 +189,46 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
302
189
|
end
|
|
303
190
|
|
|
304
191
|
# Answers 'what is the Puppet Type corresponding to the given Ruby class'
|
|
305
|
-
# @param c [
|
|
192
|
+
# @param c [Module] the class for which a puppet type is wanted
|
|
306
193
|
# @api public
|
|
307
194
|
#
|
|
308
195
|
def type(c)
|
|
309
|
-
raise ArgumentError,
|
|
196
|
+
raise ArgumentError, 'Argument must be a Module' unless c.is_a? Module
|
|
310
197
|
|
|
311
198
|
# Can't use a visitor here since we don't have an instance of the class
|
|
312
199
|
case
|
|
313
200
|
when c <= Integer
|
|
314
|
-
type =
|
|
201
|
+
type = PIntegerType::DEFAULT
|
|
315
202
|
when c == Float
|
|
316
|
-
type =
|
|
203
|
+
type = PFloatType::DEFAULT
|
|
317
204
|
when c == Numeric
|
|
318
|
-
type =
|
|
205
|
+
type = PNumericType::DEFAULT
|
|
319
206
|
when c == String
|
|
320
|
-
type =
|
|
207
|
+
type = PStringType::DEFAULT
|
|
321
208
|
when c == Regexp
|
|
322
|
-
type =
|
|
209
|
+
type = PRegexpType::DEFAULT
|
|
323
210
|
when c == NilClass
|
|
324
|
-
type =
|
|
211
|
+
type = PUndefType::DEFAULT
|
|
325
212
|
when c == FalseClass, c == TrueClass
|
|
326
|
-
type =
|
|
213
|
+
type = PBooleanType::DEFAULT
|
|
327
214
|
when c == Class
|
|
328
|
-
type =
|
|
215
|
+
type = PType::DEFAULT
|
|
329
216
|
when c == Array
|
|
330
|
-
# Assume array of
|
|
331
|
-
type =
|
|
332
|
-
type.element_type = Types::PDataType.new()
|
|
217
|
+
# Assume array of any
|
|
218
|
+
type = PArrayType::DEFAULT
|
|
333
219
|
when c == Hash
|
|
334
|
-
# Assume hash
|
|
335
|
-
type =
|
|
336
|
-
|
|
337
|
-
type
|
|
338
|
-
else
|
|
339
|
-
type = Types::PRuntimeType.new(:runtime => :ruby, :runtime_type_name => c.name)
|
|
220
|
+
# Assume hash of any
|
|
221
|
+
type = PHashType::DEFAULT
|
|
222
|
+
else
|
|
223
|
+
type = PRuntimeType.new(:ruby, c.name)
|
|
340
224
|
end
|
|
341
225
|
type
|
|
342
226
|
end
|
|
343
227
|
|
|
344
|
-
# Generalizes value specific types. The
|
|
228
|
+
# Generalizes value specific types. The generalized type is returned.
|
|
345
229
|
# @api public
|
|
346
|
-
def generalize
|
|
347
|
-
|
|
348
|
-
o.eAllContents.each { |x| @@generalize_visitor.visit_this_0(self, x) }
|
|
349
|
-
o
|
|
350
|
-
end
|
|
351
|
-
|
|
352
|
-
def generalize_Object(o)
|
|
353
|
-
# do nothing, there is nothing to change for most types
|
|
354
|
-
end
|
|
355
|
-
|
|
356
|
-
def generalize_PStringType(o)
|
|
357
|
-
o.values = []
|
|
358
|
-
o.size_type = nil
|
|
359
|
-
[]
|
|
360
|
-
end
|
|
361
|
-
|
|
362
|
-
def generalize_PCollectionType(o)
|
|
363
|
-
# erase the size constraint from Array and Hash (if one exists, it is transformed to -Infinity - + Infinity, which is
|
|
364
|
-
# not desirable.
|
|
365
|
-
o.size_type = nil
|
|
366
|
-
end
|
|
367
|
-
|
|
368
|
-
def generalize_PFloatType(o)
|
|
369
|
-
o.to = nil
|
|
370
|
-
o.from = nil
|
|
371
|
-
end
|
|
372
|
-
|
|
373
|
-
def generalize_PIntegerType(o)
|
|
374
|
-
o.to = nil
|
|
375
|
-
o.from = nil
|
|
230
|
+
def generalize(o)
|
|
231
|
+
o.is_a?(PAnyType) ? o.generalize : o
|
|
376
232
|
end
|
|
377
233
|
|
|
378
234
|
# Answers 'what is the single common Puppet Type describing o', or if o is an Array or Hash, what is the
|
|
@@ -380,135 +236,71 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
380
236
|
# @api public
|
|
381
237
|
#
|
|
382
238
|
def infer(o)
|
|
383
|
-
|
|
239
|
+
# Optimize the most common cases into direct calls.
|
|
240
|
+
# Explicit if/elsif/else is faster than case
|
|
241
|
+
if o.is_a?(String)
|
|
242
|
+
infer_String(o)
|
|
243
|
+
elsif o.is_a?(Integer) # need subclasses for Ruby < 2.4
|
|
244
|
+
infer_Integer(o)
|
|
245
|
+
elsif o.is_a?(Array)
|
|
246
|
+
infer_Array(o)
|
|
247
|
+
elsif o.is_a?(Hash)
|
|
248
|
+
infer_Hash(o)
|
|
249
|
+
elsif o.is_a?(Evaluator::PuppetProc)
|
|
250
|
+
infer_PuppetProc(o)
|
|
251
|
+
else
|
|
252
|
+
@@infer_visitor.visit_this_0(self, o)
|
|
253
|
+
end
|
|
384
254
|
end
|
|
385
255
|
|
|
386
256
|
def infer_generic(o)
|
|
387
|
-
|
|
388
|
-
result
|
|
257
|
+
generalize(infer(o))
|
|
389
258
|
end
|
|
390
259
|
|
|
391
260
|
# Answers 'what is the set of Puppet Types of o'
|
|
392
261
|
# @api public
|
|
393
262
|
#
|
|
394
263
|
def infer_set(o)
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
# Undef is Undef and Any, but nothing else when checking instance?
|
|
404
|
-
return false if (o.nil?) && t.class != Types::PAnyType
|
|
405
|
-
assignable?(t, infer(o))
|
|
406
|
-
end
|
|
407
|
-
|
|
408
|
-
# Anything is an instance of Unit
|
|
409
|
-
# @api private
|
|
410
|
-
def instance_of_PUnitType(t, o)
|
|
411
|
-
true
|
|
412
|
-
end
|
|
413
|
-
|
|
414
|
-
def instance_of_PArrayType(t, o)
|
|
415
|
-
return false unless o.is_a?(Array)
|
|
416
|
-
return false unless o.all? {|element| instance_of(t.element_type, element) }
|
|
417
|
-
size_t = t.size_type || @collection_default_size_t
|
|
418
|
-
# optimize by calling directly
|
|
419
|
-
return instance_of_PIntegerType(size_t, o.size)
|
|
420
|
-
end
|
|
421
|
-
|
|
422
|
-
# @api private
|
|
423
|
-
def instance_of_PIntegerType(t, o)
|
|
424
|
-
return false unless o.is_a?(Integer)
|
|
425
|
-
x = t.from
|
|
426
|
-
x = -Float::INFINITY if x.nil? || x == :default
|
|
427
|
-
y = t.to
|
|
428
|
-
y = Float::INFINITY if y.nil? || y == :default
|
|
429
|
-
return x < y ? x <= o && y >= o : y <= o && x >= o
|
|
430
|
-
end
|
|
431
|
-
|
|
432
|
-
# @api private
|
|
433
|
-
def instance_of_PStringType(t, o)
|
|
434
|
-
return false unless o.is_a?(String)
|
|
435
|
-
# true if size compliant
|
|
436
|
-
size_t = t.size_type || @collection_default_size_t
|
|
437
|
-
instance_of_PIntegerType(size_t, o.size)
|
|
438
|
-
end
|
|
439
|
-
|
|
440
|
-
def instance_of_PTupleType(t, o)
|
|
441
|
-
return false unless o.is_a?(Array)
|
|
442
|
-
# compute the tuple's min/max size, and check if that size matches
|
|
443
|
-
size_t = t.size_type || Puppet::Pops::Types::TypeFactory.range(*t.size_range)
|
|
444
|
-
|
|
445
|
-
return false unless instance_of_PIntegerType(size_t, o.size)
|
|
446
|
-
o.each_with_index do |element, index|
|
|
447
|
-
return false unless instance_of(t.types[index] || t.types[-1], element)
|
|
264
|
+
if o.instance_of?(Array)
|
|
265
|
+
infer_set_Array(o)
|
|
266
|
+
elsif o.instance_of?(Hash)
|
|
267
|
+
infer_set_Hash(o)
|
|
268
|
+
elsif o.instance_of?(SemanticPuppet::Version)
|
|
269
|
+
infer_set_Version(o)
|
|
270
|
+
else
|
|
271
|
+
infer(o)
|
|
448
272
|
end
|
|
449
|
-
true
|
|
450
|
-
end
|
|
451
|
-
|
|
452
|
-
def instance_of_PStructType(t, o)
|
|
453
|
-
return false unless o.is_a?(Hash)
|
|
454
|
-
h = t.hashed_elements
|
|
455
|
-
# all keys must be present and have a value (even if nil/undef)
|
|
456
|
-
(o.keys - h.keys).empty? && h.all? { |k,v| instance_of(v, o[k]) }
|
|
457
|
-
end
|
|
458
|
-
|
|
459
|
-
def instance_of_PHashType(t, o)
|
|
460
|
-
return false unless o.is_a?(Hash)
|
|
461
|
-
key_t = t.key_type
|
|
462
|
-
element_t = t.element_type
|
|
463
|
-
return false unless o.keys.all? {|key| instance_of(key_t, key) } && o.values.all? {|value| instance_of(element_t, value) }
|
|
464
|
-
size_t = t.size_type || @collection_default_size_t
|
|
465
|
-
# optimize by calling directly
|
|
466
|
-
return instance_of_PIntegerType(size_t, o.size)
|
|
467
|
-
end
|
|
468
|
-
|
|
469
|
-
def instance_of_PDataType(t, o)
|
|
470
|
-
instance_of(@data_variant_t, o)
|
|
471
|
-
end
|
|
472
|
-
|
|
473
|
-
def instance_of_PUndefType(t, o)
|
|
474
|
-
o.nil? || o == :undef
|
|
475
|
-
end
|
|
476
|
-
|
|
477
|
-
def instance_of_POptionalType(t, o)
|
|
478
|
-
instance_of_PUndefType(t, o) || instance_of(t.optional_type, o)
|
|
479
|
-
end
|
|
480
|
-
|
|
481
|
-
def instance_of_PVariantType(t, o)
|
|
482
|
-
# instance of variant if o is instance? of any of variant's types
|
|
483
|
-
t.types.any? { |option_t| instance_of(option_t, o) }
|
|
484
273
|
end
|
|
485
274
|
|
|
486
275
|
# Answers 'is o an instance of type t'
|
|
487
276
|
# @api public
|
|
488
277
|
#
|
|
489
278
|
def self.instance?(t, o)
|
|
490
|
-
singleton.
|
|
279
|
+
singleton.instance?(t,o)
|
|
491
280
|
end
|
|
492
281
|
|
|
493
282
|
# Answers 'is o an instance of type t'
|
|
494
283
|
# @api public
|
|
495
284
|
#
|
|
496
285
|
def instance?(t, o)
|
|
497
|
-
|
|
286
|
+
if t.is_a?(Module)
|
|
287
|
+
t = type(t)
|
|
288
|
+
end
|
|
289
|
+
t.is_a?(PAnyType) ? t.instance?(o) : false
|
|
498
290
|
end
|
|
499
291
|
|
|
500
292
|
# Answers if t is a puppet type
|
|
501
293
|
# @api public
|
|
502
294
|
#
|
|
503
295
|
def is_ptype?(t)
|
|
504
|
-
|
|
296
|
+
t.is_a?(PAnyType)
|
|
505
297
|
end
|
|
506
298
|
|
|
507
299
|
# Answers if t represents the puppet type PUndefType
|
|
508
300
|
# @api public
|
|
509
301
|
#
|
|
510
302
|
def is_pnil?(t)
|
|
511
|
-
|
|
303
|
+
t.nil? || t.is_a?(PUndefType)
|
|
512
304
|
end
|
|
513
305
|
|
|
514
306
|
# Answers, 'What is the common type of t1 and t2?'
|
|
@@ -529,9 +321,9 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
529
321
|
end
|
|
530
322
|
|
|
531
323
|
# If either side is Unit, it is the other type
|
|
532
|
-
if t1.is_a?(
|
|
324
|
+
if t1.is_a?(PUnitType)
|
|
533
325
|
return t2
|
|
534
|
-
elsif t2.is_a?(
|
|
326
|
+
elsif t2.is_a?(PUnitType)
|
|
535
327
|
return t1
|
|
536
328
|
end
|
|
537
329
|
|
|
@@ -543,132 +335,121 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
543
335
|
end
|
|
544
336
|
|
|
545
337
|
# when both are arrays, return an array with common element type
|
|
546
|
-
if t1.is_a?(
|
|
547
|
-
|
|
548
|
-
type.element_type = common_type(t1.element_type, t2.element_type)
|
|
549
|
-
return type
|
|
338
|
+
if t1.is_a?(PArrayType) && t2.is_a?(PArrayType)
|
|
339
|
+
return PArrayType.new(common_type(t1.element_type, t2.element_type))
|
|
550
340
|
end
|
|
551
341
|
|
|
552
342
|
# when both are hashes, return a hash with common key- and element type
|
|
553
|
-
if t1.is_a?(
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
return type
|
|
343
|
+
if t1.is_a?(PHashType) && t2.is_a?(PHashType)
|
|
344
|
+
key_type = common_type(t1.key_type, t2.key_type)
|
|
345
|
+
value_type = common_type(t1.value_type, t2.value_type)
|
|
346
|
+
return PHashType.new(key_type, value_type)
|
|
558
347
|
end
|
|
559
348
|
|
|
560
349
|
# when both are host-classes, reduce to PHostClass[] (since one was not assignable to the other)
|
|
561
|
-
if t1.is_a?(
|
|
562
|
-
return
|
|
350
|
+
if t1.is_a?(PHostClassType) && t2.is_a?(PHostClassType)
|
|
351
|
+
return PHostClassType::DEFAULT
|
|
563
352
|
end
|
|
564
353
|
|
|
565
354
|
# when both are resources, reduce to Resource[T] or Resource[] (since one was not assignable to the other)
|
|
566
|
-
if t1.is_a?(
|
|
567
|
-
result = Types::PResourceType.new()
|
|
355
|
+
if t1.is_a?(PResourceType) && t2.is_a?(PResourceType)
|
|
568
356
|
# only Resource[] unless the type name is the same
|
|
569
|
-
|
|
570
|
-
# the cross assignability test above has already determined that they do not have the same type and title
|
|
571
|
-
return result
|
|
357
|
+
return t1.type_name == t2.type_name ? PResourceType.new(t1.type_name, nil) : PResourceType::DEFAULT
|
|
572
358
|
end
|
|
573
359
|
|
|
574
360
|
# Integers have range, expand the range to the common range
|
|
575
|
-
if t1.is_a?(
|
|
576
|
-
|
|
577
|
-
t2range = from_to_ordered(t2.from, t2.to)
|
|
578
|
-
t = Types::PIntegerType.new()
|
|
579
|
-
from = [t1range[0], t2range[0]].min
|
|
580
|
-
to = [t1range[1], t2range[1]].max
|
|
581
|
-
t.from = from unless from == Float::INFINITY
|
|
582
|
-
t.to = to unless to == Float::INFINITY
|
|
583
|
-
return t
|
|
361
|
+
if t1.is_a?(PIntegerType) && t2.is_a?(PIntegerType)
|
|
362
|
+
return PIntegerType.new([t1.numeric_from, t2.numeric_from].min, [t1.numeric_to, t2.numeric_to].max)
|
|
584
363
|
end
|
|
585
364
|
|
|
586
365
|
# Floats have range, expand the range to the common range
|
|
587
|
-
if t1.is_a?(
|
|
588
|
-
|
|
589
|
-
t2range = from_to_ordered(t2.from, t2.to)
|
|
590
|
-
t = Types::PFloatType.new()
|
|
591
|
-
from = [t1range[0], t2range[0]].min
|
|
592
|
-
to = [t1range[1], t2range[1]].max
|
|
593
|
-
t.from = from unless from == Float::INFINITY
|
|
594
|
-
t.to = to unless to == Float::INFINITY
|
|
595
|
-
return t
|
|
366
|
+
if t1.is_a?(PFloatType) && t2.is_a?(PFloatType)
|
|
367
|
+
return PFloatType.new([t1.numeric_from, t2.numeric_from].min, [t1.numeric_to, t2.numeric_to].max)
|
|
596
368
|
end
|
|
597
369
|
|
|
598
|
-
if t1.is_a?(
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
370
|
+
if t1.is_a?(PStringType) && (t2.is_a?(PStringType) || t2.is_a?(PEnumType))
|
|
371
|
+
if(t2.is_a?(PEnumType))
|
|
372
|
+
return t1.value.nil? ? PEnumType::DEFAULT : PEnumType.new(t2.values | [t1.value])
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
if t1.size_type.nil? || t2.size_type.nil?
|
|
376
|
+
return t1.value.nil? || t2.value.nil? ? PStringType::DEFAULT : PEnumType.new([t1.value, t2.value])
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
return PStringType.new(common_type(t1.size_type, t2.size_type))
|
|
602
380
|
end
|
|
603
381
|
|
|
604
|
-
if t1.is_a?(
|
|
605
|
-
|
|
606
|
-
# must make copies since patterns are contained types, not data-types
|
|
607
|
-
t.patterns = (t1.patterns | t2.patterns).map(&:copy)
|
|
608
|
-
return t
|
|
382
|
+
if t1.is_a?(PPatternType) && t2.is_a?(PPatternType)
|
|
383
|
+
return PPatternType.new(t1.patterns | t2.patterns)
|
|
609
384
|
end
|
|
610
385
|
|
|
611
|
-
if t1.is_a?(
|
|
386
|
+
if t1.is_a?(PEnumType) && (t2.is_a?(PStringType) || t2.is_a?(PEnumType))
|
|
612
387
|
# The common type is one that complies with either set
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
388
|
+
if t2.is_a?(PEnumType)
|
|
389
|
+
return PEnumType.new(t1.values | t2.values)
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
return t2.value.nil? ? PEnumType::DEFAULT : PEnumType.new(t1.values | [t2.value])
|
|
616
393
|
end
|
|
617
394
|
|
|
618
|
-
if t1.is_a?(
|
|
395
|
+
if t1.is_a?(PVariantType) && t2.is_a?(PVariantType)
|
|
619
396
|
# The common type is one that complies with either set
|
|
620
|
-
|
|
621
|
-
t.types = (t1.types | t2.types).map(&:copy)
|
|
622
|
-
return t
|
|
397
|
+
return PVariantType.maybe_create(t1.types | t2.types)
|
|
623
398
|
end
|
|
624
399
|
|
|
625
|
-
if t1.is_a?(
|
|
400
|
+
if t1.is_a?(PRegexpType) && t2.is_a?(PRegexpType)
|
|
626
401
|
# if they were identical, the general rule would return a parameterized regexp
|
|
627
402
|
# since they were not, the result is a generic regexp type
|
|
628
|
-
return
|
|
403
|
+
return PRegexpType::DEFAULT
|
|
629
404
|
end
|
|
630
405
|
|
|
631
|
-
if t1.is_a?(
|
|
406
|
+
if t1.is_a?(PCallableType) && t2.is_a?(PCallableType)
|
|
632
407
|
# They do not have the same signature, and one is not assignable to the other,
|
|
633
408
|
# what remains is the most general form of Callable
|
|
634
|
-
return
|
|
409
|
+
return PCallableType::DEFAULT
|
|
635
410
|
end
|
|
636
411
|
|
|
637
412
|
# Common abstract types, from most specific to most general
|
|
638
413
|
if common_numeric?(t1, t2)
|
|
639
|
-
return
|
|
414
|
+
return PNumericType::DEFAULT
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
if common_scalar_data?(t1, t2)
|
|
418
|
+
return PScalarDataType::DEFAULT
|
|
640
419
|
end
|
|
641
420
|
|
|
642
421
|
if common_scalar?(t1, t2)
|
|
643
|
-
return
|
|
422
|
+
return PScalarType::DEFAULT
|
|
644
423
|
end
|
|
645
424
|
|
|
646
425
|
if common_data?(t1,t2)
|
|
647
|
-
return
|
|
426
|
+
return TypeFactory.data
|
|
648
427
|
end
|
|
649
428
|
|
|
650
429
|
# Meta types Type[Integer] + Type[String] => Type[Data]
|
|
651
|
-
if t1.is_a?(
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
430
|
+
if t1.is_a?(PType) && t2.is_a?(PType)
|
|
431
|
+
return PType.new(common_type(t1.type, t2.type))
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
if common_rich_data?(t1,t2)
|
|
435
|
+
return TypeFactory.rich_data
|
|
655
436
|
end
|
|
656
437
|
|
|
657
438
|
# If both are Runtime types
|
|
658
|
-
if t1.is_a?(
|
|
439
|
+
if t1.is_a?(PRuntimeType) && t2.is_a?(PRuntimeType)
|
|
659
440
|
if t1.runtime == t2.runtime && t1.runtime_type_name == t2.runtime_type_name
|
|
660
441
|
return t1
|
|
661
442
|
end
|
|
662
443
|
# finding the common super class requires that names are resolved to class
|
|
663
444
|
# NOTE: This only supports runtime type of :ruby
|
|
664
|
-
c1 =
|
|
665
|
-
c2 =
|
|
445
|
+
c1 = ClassLoader.provide_from_type(t1)
|
|
446
|
+
c2 = ClassLoader.provide_from_type(t2)
|
|
666
447
|
if c1 && c2
|
|
667
448
|
c2_superclasses = superclasses(c2)
|
|
668
449
|
superclasses(c1).each do|c1_super|
|
|
669
450
|
c2_superclasses.each do |c2_super|
|
|
670
451
|
if c1_super == c2_super
|
|
671
|
-
return
|
|
452
|
+
return PRuntimeType.new(:ruby, c1_super.name)
|
|
672
453
|
end
|
|
673
454
|
end
|
|
674
455
|
end
|
|
@@ -676,9 +457,7 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
676
457
|
end
|
|
677
458
|
|
|
678
459
|
# They better both be Any type, or the wrong thing was asked and nil is returned
|
|
679
|
-
|
|
680
|
-
return Types::PAnyType.new()
|
|
681
|
-
end
|
|
460
|
+
t1.is_a?(PAnyType) && t2.is_a?(PAnyType) ? PAnyType::DEFAULT : nil
|
|
682
461
|
end
|
|
683
462
|
|
|
684
463
|
# Produces the superclasses of the given class, including the class
|
|
@@ -691,21 +470,6 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
691
470
|
result
|
|
692
471
|
end
|
|
693
472
|
|
|
694
|
-
# Produces a string representing the type
|
|
695
|
-
# @api public
|
|
696
|
-
#
|
|
697
|
-
def string(t)
|
|
698
|
-
@@string_visitor.visit_this_0(self, t)
|
|
699
|
-
end
|
|
700
|
-
|
|
701
|
-
# Produces a debug string representing the type (possibly with more information that the regular string format)
|
|
702
|
-
# @api public
|
|
703
|
-
#
|
|
704
|
-
def debug_string(t)
|
|
705
|
-
@@inspect_visitor.visit_this_0(self, t)
|
|
706
|
-
end
|
|
707
|
-
|
|
708
|
-
|
|
709
473
|
# Reduces an enumerable of types to a single common type.
|
|
710
474
|
# @api public
|
|
711
475
|
#
|
|
@@ -717,19 +481,24 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
717
481
|
# @api public
|
|
718
482
|
#
|
|
719
483
|
def infer_and_reduce_type(enumerable)
|
|
720
|
-
reduce_type(enumerable.
|
|
484
|
+
reduce_type(enumerable.map {|o| infer(o) })
|
|
721
485
|
end
|
|
722
486
|
|
|
723
|
-
# The type of all
|
|
487
|
+
# The type of all modules is PType
|
|
724
488
|
# @api private
|
|
725
489
|
#
|
|
726
|
-
def
|
|
727
|
-
|
|
490
|
+
def infer_Module(o)
|
|
491
|
+
PType::new(PRuntimeType.new(:ruby, o.name))
|
|
728
492
|
end
|
|
729
493
|
|
|
730
494
|
# @api private
|
|
731
495
|
def infer_Closure(o)
|
|
732
|
-
o.type
|
|
496
|
+
o.type
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
# @api private
|
|
500
|
+
def infer_Iterator(o)
|
|
501
|
+
PIteratorType.new(o.element_type)
|
|
733
502
|
end
|
|
734
503
|
|
|
735
504
|
# @api private
|
|
@@ -739,16 +508,21 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
739
508
|
|
|
740
509
|
# @api private
|
|
741
510
|
def infer_Object(o)
|
|
742
|
-
|
|
511
|
+
if o.is_a?(PuppetObject)
|
|
512
|
+
o._pcore_type
|
|
513
|
+
else
|
|
514
|
+
name = o.class.name
|
|
515
|
+
ir = Loaders.implementation_registry
|
|
516
|
+
type = ir.nil? ? nil : ir.type_for_module(name)
|
|
517
|
+
type.nil? ? PRuntimeType.new(:ruby, name) : type
|
|
518
|
+
end
|
|
743
519
|
end
|
|
744
520
|
|
|
745
521
|
# The type of all types is PType
|
|
746
522
|
# @api private
|
|
747
523
|
#
|
|
748
524
|
def infer_PAnyType(o)
|
|
749
|
-
|
|
750
|
-
type.type = o.copy
|
|
751
|
-
type
|
|
525
|
+
PType.new(o)
|
|
752
526
|
end
|
|
753
527
|
|
|
754
528
|
# The type of all types is PType
|
|
@@ -756,45 +530,32 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
756
530
|
# @api private
|
|
757
531
|
#
|
|
758
532
|
def infer_PType(o)
|
|
759
|
-
|
|
760
|
-
type.type = o.copy
|
|
761
|
-
type
|
|
533
|
+
PType.new(o)
|
|
762
534
|
end
|
|
763
535
|
|
|
764
536
|
# @api private
|
|
765
537
|
def infer_String(o)
|
|
766
|
-
|
|
767
|
-
t.addValues(o)
|
|
768
|
-
t.size_type = size_as_type(o)
|
|
769
|
-
t
|
|
538
|
+
PStringType.new(o)
|
|
770
539
|
end
|
|
771
540
|
|
|
772
541
|
# @api private
|
|
773
542
|
def infer_Float(o)
|
|
774
|
-
|
|
775
|
-
t.from = o
|
|
776
|
-
t.to = o
|
|
777
|
-
t
|
|
543
|
+
PFloatType.new(o, o)
|
|
778
544
|
end
|
|
779
545
|
|
|
780
546
|
# @api private
|
|
781
547
|
def infer_Integer(o)
|
|
782
|
-
|
|
783
|
-
t.from = o
|
|
784
|
-
t.to = o
|
|
785
|
-
t
|
|
548
|
+
PIntegerType.new(o, o)
|
|
786
549
|
end
|
|
787
550
|
|
|
788
551
|
# @api private
|
|
789
552
|
def infer_Regexp(o)
|
|
790
|
-
|
|
791
|
-
t.pattern = o.source
|
|
792
|
-
t
|
|
553
|
+
PRegexpType.new(o.source)
|
|
793
554
|
end
|
|
794
555
|
|
|
795
556
|
# @api private
|
|
796
557
|
def infer_NilClass(o)
|
|
797
|
-
|
|
558
|
+
PUndefType::DEFAULT
|
|
798
559
|
end
|
|
799
560
|
|
|
800
561
|
# @api private
|
|
@@ -806,16 +567,15 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
806
567
|
case p[0]
|
|
807
568
|
when :rest
|
|
808
569
|
max = :default
|
|
809
|
-
break
|
|
570
|
+
break PAnyType::DEFAULT
|
|
810
571
|
when :req
|
|
811
572
|
min += 1
|
|
812
573
|
end
|
|
813
574
|
max += 1
|
|
814
|
-
|
|
575
|
+
PAnyType::DEFAULT
|
|
815
576
|
end
|
|
816
|
-
mapped_types
|
|
817
|
-
|
|
818
|
-
Types::TypeFactory.callable(*mapped_types)
|
|
577
|
+
param_types = Types::PTupleType.new(mapped_types, Types::PIntegerType.new(min, max))
|
|
578
|
+
Types::PCallableType.new(param_types)
|
|
819
579
|
end
|
|
820
580
|
|
|
821
581
|
# @api private
|
|
@@ -828,72 +588,96 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
828
588
|
def infer_Symbol(o)
|
|
829
589
|
case o
|
|
830
590
|
when :default
|
|
831
|
-
|
|
591
|
+
PDefaultType::DEFAULT
|
|
592
|
+
when :undef
|
|
593
|
+
PUndefType::DEFAULT
|
|
832
594
|
else
|
|
833
595
|
infer_Object(o)
|
|
834
596
|
end
|
|
835
597
|
end
|
|
836
598
|
|
|
599
|
+
# @api private
|
|
600
|
+
def infer_Sensitive(o)
|
|
601
|
+
PSensitiveType.new(infer(o.unwrap))
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
# @api private
|
|
605
|
+
def infer_Timespan(o)
|
|
606
|
+
PTimespanType.new(o, o)
|
|
607
|
+
end
|
|
608
|
+
|
|
609
|
+
# @api private
|
|
610
|
+
def infer_Timestamp(o)
|
|
611
|
+
PTimestampType.new(o, o)
|
|
612
|
+
end
|
|
613
|
+
|
|
837
614
|
# @api private
|
|
838
615
|
def infer_TrueClass(o)
|
|
839
|
-
|
|
616
|
+
PBooleanType::DEFAULT
|
|
840
617
|
end
|
|
841
618
|
|
|
842
619
|
# @api private
|
|
843
620
|
def infer_FalseClass(o)
|
|
844
|
-
|
|
621
|
+
PBooleanType::DEFAULT
|
|
845
622
|
end
|
|
846
623
|
|
|
847
624
|
# @api private
|
|
848
625
|
# A Puppet::Parser::Resource, or Puppet::Resource
|
|
849
626
|
#
|
|
850
627
|
def infer_Resource(o)
|
|
851
|
-
t = Types::PResourceType.new()
|
|
852
|
-
t.type_name = o.type.to_s.downcase
|
|
853
628
|
# Only Puppet::Resource can have a title that is a symbol :undef, a PResource cannot.
|
|
854
629
|
# A mapping must be made to empty string. A nil value will result in an error later
|
|
855
630
|
title = o.title
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
type.type = t
|
|
859
|
-
type
|
|
631
|
+
title = '' if :undef == title
|
|
632
|
+
PType.new(PResourceType.new(o.type.to_s, title))
|
|
860
633
|
end
|
|
861
634
|
|
|
862
635
|
# @api private
|
|
863
636
|
def infer_Array(o)
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
637
|
+
if o.instance_of?(Array)
|
|
638
|
+
if o.empty?
|
|
639
|
+
PArrayType::EMPTY
|
|
640
|
+
else
|
|
641
|
+
PArrayType.new(infer_and_reduce_type(o), size_as_type(o))
|
|
642
|
+
end
|
|
868
643
|
else
|
|
869
|
-
|
|
644
|
+
infer_Object(o)
|
|
870
645
|
end
|
|
871
|
-
|
|
872
|
-
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
# @api private
|
|
649
|
+
def infer_Binary(o)
|
|
650
|
+
PBinaryType::DEFAULT
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
# @api private
|
|
654
|
+
def infer_Version(o)
|
|
655
|
+
PSemVerType::DEFAULT
|
|
656
|
+
end
|
|
657
|
+
|
|
658
|
+
# @api private
|
|
659
|
+
def infer_VersionRange(o)
|
|
660
|
+
PSemVerRangeType::DEFAULT
|
|
873
661
|
end
|
|
874
662
|
|
|
875
663
|
# @api private
|
|
876
664
|
def infer_Hash(o)
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
665
|
+
if o.instance_of?(Hash)
|
|
666
|
+
if o.empty?
|
|
667
|
+
PHashType::EMPTY
|
|
668
|
+
else
|
|
669
|
+
ktype = infer_and_reduce_type(o.keys)
|
|
670
|
+
etype = infer_and_reduce_type(o.values)
|
|
671
|
+
PHashType.new(ktype, etype, size_as_type(o))
|
|
672
|
+
end
|
|
881
673
|
else
|
|
882
|
-
|
|
883
|
-
etype = infer_and_reduce_type(o.values())
|
|
674
|
+
infer_Object(o)
|
|
884
675
|
end
|
|
885
|
-
type.key_type = ktype
|
|
886
|
-
type.element_type = etype
|
|
887
|
-
type.size_type = size_as_type(o)
|
|
888
|
-
type
|
|
889
676
|
end
|
|
890
677
|
|
|
891
678
|
def size_as_type(collection)
|
|
892
679
|
size = collection.size
|
|
893
|
-
|
|
894
|
-
t.from = size
|
|
895
|
-
t.to = size
|
|
896
|
-
t
|
|
680
|
+
PIntegerType.new(size, size)
|
|
897
681
|
end
|
|
898
682
|
|
|
899
683
|
# Common case for everything that intrinsically only has a single type
|
|
@@ -903,103 +687,37 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
903
687
|
|
|
904
688
|
def infer_set_Array(o)
|
|
905
689
|
if o.empty?
|
|
906
|
-
|
|
907
|
-
type.element_type = Types::PUndefType.new()
|
|
908
|
-
type.size_type = size_as_type(o)
|
|
690
|
+
PArrayType::EMPTY
|
|
909
691
|
else
|
|
910
|
-
|
|
911
|
-
type.types = o.map() {|x| infer_set(x) }
|
|
692
|
+
PTupleType.new(o.map {|x| infer_set(x) })
|
|
912
693
|
end
|
|
913
|
-
type
|
|
914
694
|
end
|
|
915
695
|
|
|
916
696
|
def infer_set_Hash(o)
|
|
917
697
|
if o.empty?
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
type.size_type = size_as_type(o)
|
|
698
|
+
PHashType::EMPTY
|
|
699
|
+
elsif o.keys.all? {|k| PStringType::NON_EMPTY.instance?(k) }
|
|
700
|
+
PStructType.new(o.each_pair.map { |k,v| PStructElement.new(PStringType.new(k), infer_set(v)) })
|
|
922
701
|
else
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
ktype.types = o.keys.map {|k| infer_set(k) }
|
|
927
|
-
etype = Types::PVariantType.new
|
|
928
|
-
etype.types = o.values.map {|e| infer_set(e) }
|
|
929
|
-
type.key_type = unwrap_single_variant(ktype)
|
|
930
|
-
type.element_type = unwrap_single_variant(etype)
|
|
931
|
-
type.size_type = size_as_type(o)
|
|
932
|
-
else
|
|
933
|
-
elements = []
|
|
934
|
-
o.each_pair do |k,v|
|
|
935
|
-
element = Types::PStructElement.new
|
|
936
|
-
element.name = k
|
|
937
|
-
element.type = infer_set(v)
|
|
938
|
-
elements << element
|
|
939
|
-
end
|
|
940
|
-
type = Types::PStructType.new
|
|
941
|
-
type.elements = elements
|
|
942
|
-
end
|
|
702
|
+
ktype = PVariantType.maybe_create(o.keys.map {|k| infer_set(k) })
|
|
703
|
+
etype = PVariantType.maybe_create(o.values.map {|e| infer_set(e) })
|
|
704
|
+
PHashType.new(unwrap_single_variant(ktype), unwrap_single_variant(etype), size_as_type(o))
|
|
943
705
|
end
|
|
944
|
-
|
|
706
|
+
end
|
|
707
|
+
|
|
708
|
+
# @api private
|
|
709
|
+
def infer_set_Version(o)
|
|
710
|
+
PSemVerType.new([SemanticPuppet::VersionRange.new(o, o)])
|
|
945
711
|
end
|
|
946
712
|
|
|
947
713
|
def unwrap_single_variant(possible_variant)
|
|
948
|
-
if possible_variant.is_a?(
|
|
714
|
+
if possible_variant.is_a?(PVariantType) && possible_variant.types.size == 1
|
|
949
715
|
possible_variant.types[0]
|
|
950
716
|
else
|
|
951
717
|
possible_variant
|
|
952
718
|
end
|
|
953
719
|
end
|
|
954
720
|
|
|
955
|
-
# False in general type calculator
|
|
956
|
-
# @api private
|
|
957
|
-
def assignable_Object(t, t2)
|
|
958
|
-
false
|
|
959
|
-
end
|
|
960
|
-
|
|
961
|
-
# @api private
|
|
962
|
-
def assignable_PAnyType(t, t2)
|
|
963
|
-
t2.is_a?(Types::PAnyType)
|
|
964
|
-
end
|
|
965
|
-
|
|
966
|
-
# @api private
|
|
967
|
-
def assignable_PUndefType(t, t2)
|
|
968
|
-
# Only undef/nil is assignable to nil type
|
|
969
|
-
t2.is_a?(Types::PUndefType)
|
|
970
|
-
end
|
|
971
|
-
|
|
972
|
-
# Anything is assignable to a Unit type
|
|
973
|
-
# @api private
|
|
974
|
-
def assignable_PUnitType(t, t2)
|
|
975
|
-
true
|
|
976
|
-
end
|
|
977
|
-
|
|
978
|
-
# @api private
|
|
979
|
-
def assignable_PDefaultType(t, t2)
|
|
980
|
-
# Only default is assignable to default type
|
|
981
|
-
t2.is_a?(Types::PDefaultType)
|
|
982
|
-
end
|
|
983
|
-
|
|
984
|
-
# @api private
|
|
985
|
-
def assignable_PScalarType(t, t2)
|
|
986
|
-
t2.is_a?(Types::PScalarType)
|
|
987
|
-
end
|
|
988
|
-
|
|
989
|
-
# @api private
|
|
990
|
-
def assignable_PNumericType(t, t2)
|
|
991
|
-
t2.is_a?(Types::PNumericType)
|
|
992
|
-
end
|
|
993
|
-
|
|
994
|
-
# @api private
|
|
995
|
-
def assignable_PIntegerType(t, t2)
|
|
996
|
-
return false unless t2.is_a?(Types::PIntegerType)
|
|
997
|
-
trange = from_to_ordered(t.from, t.to)
|
|
998
|
-
t2range = from_to_ordered(t2.from, t2.to)
|
|
999
|
-
# If t2 min and max are within the range of t
|
|
1000
|
-
trange[0] <= t2range[0] && trange[1] >= t2range[1]
|
|
1001
|
-
end
|
|
1002
|
-
|
|
1003
721
|
# Transform int range to a size constraint
|
|
1004
722
|
# if range == nil the constraint is 1,1
|
|
1005
723
|
# if range.from == nil min size = 1
|
|
@@ -1010,114 +728,13 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
1010
728
|
from = range.from
|
|
1011
729
|
to = range.to
|
|
1012
730
|
x = from.nil? ? 1 : from
|
|
1013
|
-
y = to.nil? ?
|
|
1014
|
-
|
|
1015
|
-
[x, y]
|
|
1016
|
-
else
|
|
1017
|
-
[y, x]
|
|
1018
|
-
end
|
|
1019
|
-
end
|
|
1020
|
-
|
|
1021
|
-
# @api private
|
|
1022
|
-
def from_to_ordered(from, to)
|
|
1023
|
-
x = (from.nil? || from == :default) ? -Float::INFINITY : from
|
|
1024
|
-
y = (to.nil? || to == :default) ? Float::INFINITY : to
|
|
1025
|
-
if x < y
|
|
1026
|
-
[x, y]
|
|
1027
|
-
else
|
|
1028
|
-
[y, x]
|
|
1029
|
-
end
|
|
1030
|
-
end
|
|
1031
|
-
|
|
1032
|
-
# @api private
|
|
1033
|
-
def assignable_PVariantType(t, t2)
|
|
1034
|
-
# Data is a specific variant
|
|
1035
|
-
t2 = @data_variant_t if t2.is_a?(Types::PDataType)
|
|
1036
|
-
if t2.is_a?(Types::PVariantType)
|
|
1037
|
-
# A variant is assignable if all of its options are assignable to one of this type's options
|
|
1038
|
-
return true if t == t2
|
|
1039
|
-
t2.types.all? do |other|
|
|
1040
|
-
# if the other is a Variant, all of its options, but be assignable to one of this type's options
|
|
1041
|
-
other = other.is_a?(Types::PDataType) ? @data_variant_t : other
|
|
1042
|
-
if other.is_a?(Types::PVariantType)
|
|
1043
|
-
assignable?(t, other)
|
|
1044
|
-
else
|
|
1045
|
-
t.types.any? {|option_t| assignable?(option_t, other) }
|
|
1046
|
-
end
|
|
1047
|
-
end
|
|
1048
|
-
else
|
|
1049
|
-
# A variant is assignable if t2 is assignable to any of its types
|
|
1050
|
-
t.types.any? { |option_t| assignable?(option_t, t2) }
|
|
1051
|
-
end
|
|
1052
|
-
end
|
|
1053
|
-
|
|
1054
|
-
# Catch all not callable combinations
|
|
1055
|
-
def callable_Object(o, callable_t)
|
|
1056
|
-
false
|
|
1057
|
-
end
|
|
1058
|
-
|
|
1059
|
-
def callable_PTupleType(args_tuple, callable_t)
|
|
1060
|
-
if args_tuple.size_type
|
|
1061
|
-
raise ArgumentError, "Callable tuple may not have a size constraint when used as args"
|
|
1062
|
-
end
|
|
1063
|
-
|
|
1064
|
-
params_tuple = callable_t.param_types
|
|
1065
|
-
param_block_t = callable_t.block_type
|
|
1066
|
-
arg_types = args_tuple.types
|
|
1067
|
-
arg_block_t = arg_types.last()
|
|
1068
|
-
if self.class.is_kind_of_callable?(arg_block_t)
|
|
1069
|
-
# Can't pass a block to a callable that doesn't accept one
|
|
1070
|
-
return false if param_block_t.nil?
|
|
1071
|
-
|
|
1072
|
-
# Check that the block is of the right tyṕe
|
|
1073
|
-
return false unless assignable?(param_block_t, arg_block_t)
|
|
1074
|
-
|
|
1075
|
-
# Check other arguments
|
|
1076
|
-
arg_count = arg_types.size - 1
|
|
1077
|
-
params_size_t = params_tuple.size_type || Types::TypeFactory.range(*params_tuple.size_range)
|
|
1078
|
-
return false unless assignable?(params_size_t, Types::TypeFactory.range(arg_count, arg_count))
|
|
1079
|
-
|
|
1080
|
-
ctypes = params_tuple.types
|
|
1081
|
-
args_assignable = false
|
|
1082
|
-
arg_count.times do |index|
|
|
1083
|
-
return false unless assignable?((ctypes[index] || ctypes[-1]), arg_types[index])
|
|
1084
|
-
end
|
|
1085
|
-
return true
|
|
1086
|
-
end
|
|
1087
|
-
|
|
1088
|
-
# Check that tuple is assignable and that the block (if declared) is optional
|
|
1089
|
-
assignable?(params_tuple, args_tuple) && (param_block_t.nil? || assignable?(param_block_t, @nil_t))
|
|
731
|
+
y = to.nil? ? TheInfinity : to
|
|
732
|
+
[x, y]
|
|
1090
733
|
end
|
|
1091
734
|
|
|
1092
735
|
# @api private
|
|
1093
736
|
def self.is_kind_of_callable?(t, optional = true)
|
|
1094
|
-
|
|
1095
|
-
when Types::PCallableType
|
|
1096
|
-
true
|
|
1097
|
-
when Types::POptionalType
|
|
1098
|
-
optional && is_kind_of_callable?(t.optional_type, optional)
|
|
1099
|
-
when Types::PVariantType
|
|
1100
|
-
t.types.all? {|t2| is_kind_of_callable?(t2, optional) }
|
|
1101
|
-
else
|
|
1102
|
-
false
|
|
1103
|
-
end
|
|
1104
|
-
end
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
def callable_PArrayType(args_array, callable_t)
|
|
1108
|
-
return false unless assignable?(callable_t.param_types, args_array)
|
|
1109
|
-
# does not support calling with a block, but have to check that callable is ok with missing block
|
|
1110
|
-
assignable?(callable_t.block_type || @nil_t, @nil_t)
|
|
1111
|
-
end
|
|
1112
|
-
|
|
1113
|
-
def callable_PUndefType(nil_t, callable_t)
|
|
1114
|
-
# if callable_t is Optional (or indeed PUndefType), this means that 'missing callable' is accepted
|
|
1115
|
-
assignable?(callable_t, nil_t)
|
|
1116
|
-
end
|
|
1117
|
-
|
|
1118
|
-
def callable_PCallableType(given_callable_t, required_callable_t)
|
|
1119
|
-
# If the required callable is euqal or more specific than the given, the given is callable
|
|
1120
|
-
assignable?(required_callable_t, given_callable_t)
|
|
737
|
+
t.is_a?(PAnyType) && t.kind_of_callable?(optional)
|
|
1121
738
|
end
|
|
1122
739
|
|
|
1123
740
|
def max(a,b)
|
|
@@ -1128,41 +745,6 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
1128
745
|
a <= b ? a : b
|
|
1129
746
|
end
|
|
1130
747
|
|
|
1131
|
-
def assignable_PTupleType(t, t2)
|
|
1132
|
-
return true if t == t2 || t.types.empty? && (t2.is_a?(Types::PArrayType))
|
|
1133
|
-
size_t = t.size_type || Puppet::Pops::Types::TypeFactory.range(*t.size_range)
|
|
1134
|
-
|
|
1135
|
-
if t2.is_a?(Types::PTupleType)
|
|
1136
|
-
size_t2 = t2.size_type || Puppet::Pops::Types::TypeFactory.range(*t2.size_range)
|
|
1137
|
-
|
|
1138
|
-
# not assignable if the number of types in t2 is outside number of types in t1
|
|
1139
|
-
if assignable?(size_t, size_t2)
|
|
1140
|
-
t2.types.size.times do |index|
|
|
1141
|
-
return false unless assignable?((t.types[index] || t.types[-1]), t2.types[index])
|
|
1142
|
-
end
|
|
1143
|
-
return true
|
|
1144
|
-
else
|
|
1145
|
-
return false
|
|
1146
|
-
end
|
|
1147
|
-
elsif t2.is_a?(Types::PArrayType)
|
|
1148
|
-
t2_entry = t2.element_type
|
|
1149
|
-
|
|
1150
|
-
# Array of anything can not be assigned (unless tuple is tuple of anything) - this case
|
|
1151
|
-
# was handled at the top of this method.
|
|
1152
|
-
#
|
|
1153
|
-
return false if t2_entry.nil?
|
|
1154
|
-
size_t = t.size_type || Puppet::Pops::Types::TypeFactory.range(*t.size_range)
|
|
1155
|
-
size_t2 = t2.size_type || @collection_default_size_t
|
|
1156
|
-
return false unless assignable?(size_t, size_t2)
|
|
1157
|
-
min(t.types.size, size_t2.range()[1]).times do |index|
|
|
1158
|
-
return false unless assignable?((t.types[index] || t.types[-1]), t2_entry)
|
|
1159
|
-
end
|
|
1160
|
-
true
|
|
1161
|
-
else
|
|
1162
|
-
false
|
|
1163
|
-
end
|
|
1164
|
-
end
|
|
1165
|
-
|
|
1166
748
|
# Produces the tuple entry at the given index given a tuple type, its from/to constraints on the last
|
|
1167
749
|
# type, and an index.
|
|
1168
750
|
# Produces nil if the index is out of bounds
|
|
@@ -1182,564 +764,6 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
1182
764
|
end
|
|
1183
765
|
end
|
|
1184
766
|
|
|
1185
|
-
# @api private
|
|
1186
|
-
#
|
|
1187
|
-
def assignable_PStructType(t, t2)
|
|
1188
|
-
if t2.is_a?(Types::PStructType)
|
|
1189
|
-
h = t.hashed_elements
|
|
1190
|
-
h2 = t2.hashed_elements
|
|
1191
|
-
(h2.keys - h.keys).empty? && h.all? {|k, v| v2 = h2[k]; assignable?(v, v2.nil? ? @nil_t : v2) }
|
|
1192
|
-
elsif t2.is_a?(Types::PHashType)
|
|
1193
|
-
size_t2 = t2.size_type || @collection_default_size_t
|
|
1194
|
-
size_t = Types::PIntegerType.new
|
|
1195
|
-
elements = t.elements
|
|
1196
|
-
size_t.from = elements.count {|e| !assignable?(e.type, @nil_t) }
|
|
1197
|
-
size_t.to = elements.size
|
|
1198
|
-
# compatible size
|
|
1199
|
-
# hash key type must be string of min 1 size
|
|
1200
|
-
# hash value t must be assignable to each key
|
|
1201
|
-
element_type = t2.element_type
|
|
1202
|
-
assignable_PIntegerType(size_t, size_t2) &&
|
|
1203
|
-
(size_t2.to == 0 || assignable?(@non_empty_string_t, t2.key_type)) &&
|
|
1204
|
-
elements.all? {|e| assignable?(e.type, element_type) }
|
|
1205
|
-
else
|
|
1206
|
-
false
|
|
1207
|
-
end
|
|
1208
|
-
end
|
|
1209
|
-
|
|
1210
|
-
# @api private
|
|
1211
|
-
def assignable_POptionalType(t, t2)
|
|
1212
|
-
return true if t2.is_a?(Types::PUndefType)
|
|
1213
|
-
if t2.is_a?(Types::POptionalType)
|
|
1214
|
-
assignable?(t.optional_type, t2.optional_type)
|
|
1215
|
-
else
|
|
1216
|
-
assignable?(t.optional_type, t2)
|
|
1217
|
-
end
|
|
1218
|
-
end
|
|
1219
|
-
|
|
1220
|
-
# @api private
|
|
1221
|
-
def assignable_PEnumType(t, t2)
|
|
1222
|
-
return true if t == t2
|
|
1223
|
-
if t.values.empty?
|
|
1224
|
-
return true if t2.is_a?(Types::PStringType) || t2.is_a?(Types::PEnumType) || t2.is_a?(Types::PPatternType)
|
|
1225
|
-
end
|
|
1226
|
-
case t2
|
|
1227
|
-
when Types::PStringType
|
|
1228
|
-
# if the set of strings are all found in the set of enums
|
|
1229
|
-
!t2.values.empty?() && t2.values.all? { |s| t.values.any? { |e| e == s }}
|
|
1230
|
-
when Types::PVariantType
|
|
1231
|
-
t2.types.all? {|variant_t| assignable_PEnumType(t, variant_t) }
|
|
1232
|
-
when Types::PEnumType
|
|
1233
|
-
# empty means any enum
|
|
1234
|
-
return true if t.values.empty?
|
|
1235
|
-
!t2.values.empty? && t2.values.all? { |s| t.values.any? {|e| e == s }}
|
|
1236
|
-
else
|
|
1237
|
-
false
|
|
1238
|
-
end
|
|
1239
|
-
end
|
|
1240
|
-
|
|
1241
|
-
# @api private
|
|
1242
|
-
def assignable_PStringType(t, t2)
|
|
1243
|
-
if t.values.empty?
|
|
1244
|
-
# A general string is assignable by any other string or pattern restricted string
|
|
1245
|
-
# if the string has a size constraint it does not match since there is no reasonable way
|
|
1246
|
-
# to compute the min/max length a pattern will match. For enum, it is possible to test that
|
|
1247
|
-
# each enumerator value is within range
|
|
1248
|
-
size_t = t.size_type || @collection_default_size_t
|
|
1249
|
-
case t2
|
|
1250
|
-
when Types::PStringType
|
|
1251
|
-
# true if size compliant
|
|
1252
|
-
size_t2 = t2.size_type || @collection_default_size_t
|
|
1253
|
-
assignable_PIntegerType(size_t, size_t2)
|
|
1254
|
-
|
|
1255
|
-
when Types::PPatternType
|
|
1256
|
-
# true if size constraint is at least 0 to +Infinity (which is the same as the default)
|
|
1257
|
-
assignable_PIntegerType(size_t, @collection_default_size_t)
|
|
1258
|
-
|
|
1259
|
-
when Types::PEnumType
|
|
1260
|
-
if t2.values && !t2.values.empty?
|
|
1261
|
-
# true if all enum values are within range
|
|
1262
|
-
min, max = t2.values.map(&:size).minmax
|
|
1263
|
-
trange = from_to_ordered(size_t.from, size_t.to)
|
|
1264
|
-
t2range = [min, max]
|
|
1265
|
-
# If t2 min and max are within the range of t
|
|
1266
|
-
trange[0] <= t2range[0] && trange[1] >= t2range[1]
|
|
1267
|
-
else
|
|
1268
|
-
# enum represents all enums, and thus all strings, a sized constrained string can thus not
|
|
1269
|
-
# be assigned any enum (unless it is max size).
|
|
1270
|
-
assignable_PIntegerType(size_t, @collection_default_size_t)
|
|
1271
|
-
end
|
|
1272
|
-
else
|
|
1273
|
-
# no other type matches string
|
|
1274
|
-
false
|
|
1275
|
-
end
|
|
1276
|
-
elsif t2.is_a?(Types::PStringType)
|
|
1277
|
-
# A specific string acts as a set of strings - must have exactly the same strings
|
|
1278
|
-
# In this case, size does not matter since the definition is very precise anyway
|
|
1279
|
-
Set.new(t.values) == Set.new(t2.values)
|
|
1280
|
-
else
|
|
1281
|
-
# All others are false, since no other type describes the same set of specific strings
|
|
1282
|
-
false
|
|
1283
|
-
end
|
|
1284
|
-
end
|
|
1285
|
-
|
|
1286
|
-
# @api private
|
|
1287
|
-
def assignable_PPatternType(t, t2)
|
|
1288
|
-
return true if t == t2
|
|
1289
|
-
case t2
|
|
1290
|
-
when Types::PStringType, Types::PEnumType
|
|
1291
|
-
values = t2.values
|
|
1292
|
-
when Types::PVariantType
|
|
1293
|
-
return t2.types.all? {|variant_t| assignable_PPatternType(t, variant_t) }
|
|
1294
|
-
when Types::PPatternType
|
|
1295
|
-
return t.patterns.empty? ? true : false
|
|
1296
|
-
else
|
|
1297
|
-
return false
|
|
1298
|
-
end
|
|
1299
|
-
|
|
1300
|
-
if t2.values.empty?
|
|
1301
|
-
# Strings / Enums (unknown which ones) cannot all match a pattern, but if there is no pattern it is ok
|
|
1302
|
-
# (There should really always be a pattern, but better safe than sorry).
|
|
1303
|
-
return t.patterns.empty? ? true : false
|
|
1304
|
-
end
|
|
1305
|
-
# all strings in String/Enum type must match one of the patterns in Pattern type,
|
|
1306
|
-
# or Pattern represents all Patterns == all Strings
|
|
1307
|
-
regexps = t.patterns.map {|p| p.regexp }
|
|
1308
|
-
regexps.empty? || t2.values.all? { |v| regexps.any? {|re| re.match(v) } }
|
|
1309
|
-
end
|
|
1310
|
-
|
|
1311
|
-
# @api private
|
|
1312
|
-
def assignable_PFloatType(t, t2)
|
|
1313
|
-
return false unless t2.is_a?(Types::PFloatType)
|
|
1314
|
-
trange = from_to_ordered(t.from, t.to)
|
|
1315
|
-
t2range = from_to_ordered(t2.from, t2.to)
|
|
1316
|
-
# If t2 min and max are within the range of t
|
|
1317
|
-
trange[0] <= t2range[0] && trange[1] >= t2range[1]
|
|
1318
|
-
end
|
|
1319
|
-
|
|
1320
|
-
# @api private
|
|
1321
|
-
def assignable_PBooleanType(t, t2)
|
|
1322
|
-
t2.is_a?(Types::PBooleanType)
|
|
1323
|
-
end
|
|
1324
|
-
|
|
1325
|
-
# @api private
|
|
1326
|
-
def assignable_PRegexpType(t, t2)
|
|
1327
|
-
t2.is_a?(Types::PRegexpType) && (t.pattern.nil? || t.pattern == t2.pattern)
|
|
1328
|
-
end
|
|
1329
|
-
|
|
1330
|
-
# @api private
|
|
1331
|
-
def assignable_PCallableType(t, t2)
|
|
1332
|
-
return false unless t2.is_a?(Types::PCallableType)
|
|
1333
|
-
# nil param_types means, any other Callable is assignable
|
|
1334
|
-
return true if t.param_types.nil?
|
|
1335
|
-
|
|
1336
|
-
# NOTE: these tests are made in reverse as it is calling the callable that is constrained
|
|
1337
|
-
# (it's lower bound), not its upper bound
|
|
1338
|
-
return false unless assignable?(t2.param_types, t.param_types)
|
|
1339
|
-
# names are ignored, they are just information
|
|
1340
|
-
# Blocks must be compatible
|
|
1341
|
-
this_block_t = t.block_type || @nil_t
|
|
1342
|
-
that_block_t = t2.block_type || @nil_t
|
|
1343
|
-
assignable?(that_block_t, this_block_t)
|
|
1344
|
-
|
|
1345
|
-
end
|
|
1346
|
-
|
|
1347
|
-
# @api private
|
|
1348
|
-
def assignable_PCollectionType(t, t2)
|
|
1349
|
-
size_t = t.size_type || @collection_default_size_t
|
|
1350
|
-
case t2
|
|
1351
|
-
when Types::PCollectionType
|
|
1352
|
-
size_t2 = t2.size_type || @collection_default_size_t
|
|
1353
|
-
assignable_PIntegerType(size_t, size_t2)
|
|
1354
|
-
when Types::PTupleType
|
|
1355
|
-
# compute the tuple's min/max size, and check if that size matches
|
|
1356
|
-
from, to = size_range(t2.size_type)
|
|
1357
|
-
t2s = Types::PIntegerType.new()
|
|
1358
|
-
t2s.from = t2.types.size - 1 + from
|
|
1359
|
-
t2s.to = t2.types.size - 1 + to
|
|
1360
|
-
assignable_PIntegerType(size_t, t2s)
|
|
1361
|
-
when Types::PStructType
|
|
1362
|
-
from = to = t2.elements.size
|
|
1363
|
-
t2s = Types::PIntegerType.new()
|
|
1364
|
-
t2s.from = from
|
|
1365
|
-
t2s.to = to
|
|
1366
|
-
assignable_PIntegerType(size_t, t2s)
|
|
1367
|
-
else
|
|
1368
|
-
false
|
|
1369
|
-
end
|
|
1370
|
-
end
|
|
1371
|
-
|
|
1372
|
-
# @api private
|
|
1373
|
-
def assignable_PType(t, t2)
|
|
1374
|
-
return false unless t2.is_a?(Types::PType)
|
|
1375
|
-
return true if t.type.nil? # wide enough to handle all types
|
|
1376
|
-
return false if t2.type.nil? # wider than t
|
|
1377
|
-
assignable?(t.type, t2.type)
|
|
1378
|
-
end
|
|
1379
|
-
|
|
1380
|
-
# Array is assignable if t2 is an Array and t2's element type is assignable, or if t2 is a Tuple
|
|
1381
|
-
# @api private
|
|
1382
|
-
def assignable_PArrayType(t, t2)
|
|
1383
|
-
if t2.is_a?(Types::PArrayType)
|
|
1384
|
-
return false unless assignable?(t.element_type, t2.element_type)
|
|
1385
|
-
assignable_PCollectionType(t, t2)
|
|
1386
|
-
|
|
1387
|
-
elsif t2.is_a?(Types::PTupleType)
|
|
1388
|
-
return false unless t2.types.all? {|t2_element| assignable?(t.element_type, t2_element) }
|
|
1389
|
-
t2_regular = t2.types[0..-2]
|
|
1390
|
-
t2_ranged = t2.types[-1]
|
|
1391
|
-
t2_from, t2_to = size_range(t2.size_type)
|
|
1392
|
-
t2_required = t2_regular.size + t2_from
|
|
1393
|
-
|
|
1394
|
-
t_entry = t.element_type
|
|
1395
|
-
|
|
1396
|
-
# Tuple of anything can not be assigned (unless array is tuple of anything) - this case
|
|
1397
|
-
# was handled at the top of this method.
|
|
1398
|
-
#
|
|
1399
|
-
return false if t_entry.nil?
|
|
1400
|
-
|
|
1401
|
-
# array type may be size constrained
|
|
1402
|
-
size_t = t.size_type || @collection_default_size_t
|
|
1403
|
-
min, max = size_t.range
|
|
1404
|
-
# Tuple with fewer min entries can not be assigned
|
|
1405
|
-
return false if t2_required < min
|
|
1406
|
-
# Tuple with more optionally available entries can not be assigned
|
|
1407
|
-
return false if t2_regular.size + t2_to > max
|
|
1408
|
-
# each tuple type must be assignable to the element type
|
|
1409
|
-
t2_required.times do |index|
|
|
1410
|
-
t2_entry = tuple_entry_at(t2, t2_from, t2_to, index)
|
|
1411
|
-
return false unless assignable?(t_entry, t2_entry)
|
|
1412
|
-
end
|
|
1413
|
-
# ... and so must the last, possibly optional (ranged) type
|
|
1414
|
-
return assignable?(t_entry, t2_ranged)
|
|
1415
|
-
else
|
|
1416
|
-
false
|
|
1417
|
-
end
|
|
1418
|
-
end
|
|
1419
|
-
|
|
1420
|
-
# Hash is assignable if t2 is a Hash and t2's key and element types are assignable
|
|
1421
|
-
# @api private
|
|
1422
|
-
def assignable_PHashType(t, t2)
|
|
1423
|
-
case t2
|
|
1424
|
-
when Types::PHashType
|
|
1425
|
-
return true if (t.size_type.nil? || t.size_type.from == 0) && t2.is_the_empty_hash?
|
|
1426
|
-
return false unless assignable?(t.key_type, t2.key_type) && assignable?(t.element_type, t2.element_type)
|
|
1427
|
-
assignable_PCollectionType(t, t2)
|
|
1428
|
-
when Types::PStructType
|
|
1429
|
-
# hash must accept String as key type
|
|
1430
|
-
# hash must accept all value types
|
|
1431
|
-
# hash must accept the size of the struct
|
|
1432
|
-
size_t = t.size_type || @collection_default_size_t
|
|
1433
|
-
min, max = size_t.range
|
|
1434
|
-
struct_size = t2.elements.size
|
|
1435
|
-
key_type = t.key_type
|
|
1436
|
-
element_type = t.element_type
|
|
1437
|
-
( struct_size >= min && struct_size <= max &&
|
|
1438
|
-
t2.elements.all? {|e| instance_of(key_type, e.name) && assignable?(element_type, e.type) })
|
|
1439
|
-
else
|
|
1440
|
-
false
|
|
1441
|
-
end
|
|
1442
|
-
end
|
|
1443
|
-
|
|
1444
|
-
# @api private
|
|
1445
|
-
def assignable_PCatalogEntryType(t1, t2)
|
|
1446
|
-
t2.is_a?(Types::PCatalogEntryType)
|
|
1447
|
-
end
|
|
1448
|
-
|
|
1449
|
-
# @api private
|
|
1450
|
-
def assignable_PHostClassType(t1, t2)
|
|
1451
|
-
return false unless t2.is_a?(Types::PHostClassType)
|
|
1452
|
-
# Class = Class[name}, Class[name] != Class
|
|
1453
|
-
return true if t1.class_name.nil?
|
|
1454
|
-
# Class[name] = Class[name]
|
|
1455
|
-
return t1.class_name == t2.class_name
|
|
1456
|
-
end
|
|
1457
|
-
|
|
1458
|
-
# @api private
|
|
1459
|
-
def assignable_PResourceType(t1, t2)
|
|
1460
|
-
return false unless t2.is_a?(Types::PResourceType)
|
|
1461
|
-
return true if t1.type_name.nil?
|
|
1462
|
-
return false if t1.type_name != t2.type_name
|
|
1463
|
-
return true if t1.title.nil?
|
|
1464
|
-
return t1.title == t2.title
|
|
1465
|
-
end
|
|
1466
|
-
|
|
1467
|
-
# Data is assignable by other Data and by Array[Data] and Hash[Scalar, Data]
|
|
1468
|
-
# @api private
|
|
1469
|
-
def assignable_PDataType(t, t2)
|
|
1470
|
-
t2.is_a?(Types::PDataType) || assignable?(@data_variant_t, t2)
|
|
1471
|
-
end
|
|
1472
|
-
|
|
1473
|
-
# Assignable if t2's has the same runtime and the runtime name resolves to
|
|
1474
|
-
# a class that is the same or subclass of t1's resolved runtime type name
|
|
1475
|
-
# @api private
|
|
1476
|
-
def assignable_PRuntimeType(t1, t2)
|
|
1477
|
-
return false unless t2.is_a?(Types::PRuntimeType)
|
|
1478
|
-
return false unless t1.runtime == t2.runtime
|
|
1479
|
-
return true if t1.runtime_type_name.nil? # t1 is wider
|
|
1480
|
-
return false if t2.runtime_type_name.nil? # t1 not nil, so t2 can not be wider
|
|
1481
|
-
|
|
1482
|
-
# NOTE: This only supports Ruby, must change when/if the set of runtimes is expanded
|
|
1483
|
-
c1 = class_from_string(t1.runtime_type_name)
|
|
1484
|
-
c2 = class_from_string(t2.runtime_type_name)
|
|
1485
|
-
return false unless c1.is_a?(Class) && c2.is_a?(Class)
|
|
1486
|
-
!!(c2 <= c1)
|
|
1487
|
-
end
|
|
1488
|
-
|
|
1489
|
-
# @api private
|
|
1490
|
-
def debug_string_Object(t)
|
|
1491
|
-
string(t)
|
|
1492
|
-
end
|
|
1493
|
-
|
|
1494
|
-
# @api private
|
|
1495
|
-
def string_PType(t)
|
|
1496
|
-
if t.type.nil?
|
|
1497
|
-
"Type"
|
|
1498
|
-
else
|
|
1499
|
-
"Type[#{string(t.type)}]"
|
|
1500
|
-
end
|
|
1501
|
-
end
|
|
1502
|
-
|
|
1503
|
-
# @api private
|
|
1504
|
-
def string_NilClass(t) ; '?' ; end
|
|
1505
|
-
|
|
1506
|
-
# @api private
|
|
1507
|
-
def string_String(t) ; t ; end
|
|
1508
|
-
|
|
1509
|
-
# @api private
|
|
1510
|
-
def string_Symbol(t) ; t.to_s ; end
|
|
1511
|
-
|
|
1512
|
-
def string_PAnyType(t) ; "Any" ; end
|
|
1513
|
-
|
|
1514
|
-
# @api private
|
|
1515
|
-
def string_PUndefType(t) ; 'Undef' ; end
|
|
1516
|
-
|
|
1517
|
-
# @api private
|
|
1518
|
-
def string_PDefaultType(t) ; 'Default' ; end
|
|
1519
|
-
|
|
1520
|
-
# @api private
|
|
1521
|
-
def string_PBooleanType(t) ; "Boolean" ; end
|
|
1522
|
-
|
|
1523
|
-
# @api private
|
|
1524
|
-
def string_PScalarType(t) ; "Scalar" ; end
|
|
1525
|
-
|
|
1526
|
-
# @api private
|
|
1527
|
-
def string_PDataType(t) ; "Data" ; end
|
|
1528
|
-
|
|
1529
|
-
# @api private
|
|
1530
|
-
def string_PNumericType(t) ; "Numeric" ; end
|
|
1531
|
-
|
|
1532
|
-
# @api private
|
|
1533
|
-
def string_PIntegerType(t)
|
|
1534
|
-
range = range_array_part(t)
|
|
1535
|
-
unless range.empty?
|
|
1536
|
-
"Integer[#{range.join(', ')}]"
|
|
1537
|
-
else
|
|
1538
|
-
"Integer"
|
|
1539
|
-
end
|
|
1540
|
-
end
|
|
1541
|
-
|
|
1542
|
-
# Produces a string from an Integer range type that is used inside other type strings
|
|
1543
|
-
# @api private
|
|
1544
|
-
def range_array_part(t)
|
|
1545
|
-
return [] if t.nil? || (t.from.nil? && t.to.nil?)
|
|
1546
|
-
[t.from.nil? ? 'default' : t.from , t.to.nil? ? 'default' : t.to ]
|
|
1547
|
-
end
|
|
1548
|
-
|
|
1549
|
-
# @api private
|
|
1550
|
-
def string_PFloatType(t)
|
|
1551
|
-
range = range_array_part(t)
|
|
1552
|
-
unless range.empty?
|
|
1553
|
-
"Float[#{range.join(', ')}]"
|
|
1554
|
-
else
|
|
1555
|
-
"Float"
|
|
1556
|
-
end
|
|
1557
|
-
end
|
|
1558
|
-
|
|
1559
|
-
# @api private
|
|
1560
|
-
def string_PRegexpType(t)
|
|
1561
|
-
t.pattern.nil? ? "Regexp" : "Regexp[#{t.regexp.inspect}]"
|
|
1562
|
-
end
|
|
1563
|
-
|
|
1564
|
-
# @api private
|
|
1565
|
-
def string_PStringType(t)
|
|
1566
|
-
# skip values in regular output - see debug_string
|
|
1567
|
-
range = range_array_part(t.size_type)
|
|
1568
|
-
unless range.empty?
|
|
1569
|
-
"String[#{range.join(', ')}]"
|
|
1570
|
-
else
|
|
1571
|
-
"String"
|
|
1572
|
-
end
|
|
1573
|
-
end
|
|
1574
|
-
|
|
1575
|
-
# @api private
|
|
1576
|
-
def debug_string_PStringType(t)
|
|
1577
|
-
range = range_array_part(t.size_type)
|
|
1578
|
-
range_part = range.empty? ? '' : '[' << range.join(' ,') << '], '
|
|
1579
|
-
"String[" << range_part << (t.values.map {|s| "'#{s}'" }).join(', ') << ']'
|
|
1580
|
-
end
|
|
1581
|
-
|
|
1582
|
-
# @api private
|
|
1583
|
-
def string_PEnumType(t)
|
|
1584
|
-
return "Enum" if t.values.empty?
|
|
1585
|
-
"Enum[" << t.values.map {|s| "'#{s}'" }.join(', ') << ']'
|
|
1586
|
-
end
|
|
1587
|
-
|
|
1588
|
-
# @api private
|
|
1589
|
-
def string_PVariantType(t)
|
|
1590
|
-
return "Variant" if t.types.empty?
|
|
1591
|
-
"Variant[" << t.types.map {|t2| string(t2) }.join(', ') << ']'
|
|
1592
|
-
end
|
|
1593
|
-
|
|
1594
|
-
# @api private
|
|
1595
|
-
def string_PTupleType(t)
|
|
1596
|
-
range = range_array_part(t.size_type)
|
|
1597
|
-
return "Tuple" if t.types.empty?
|
|
1598
|
-
s = "Tuple[" << t.types.map {|t2| string(t2) }.join(', ')
|
|
1599
|
-
unless range.empty?
|
|
1600
|
-
s << ", " << range.join(', ')
|
|
1601
|
-
end
|
|
1602
|
-
s << "]"
|
|
1603
|
-
s
|
|
1604
|
-
end
|
|
1605
|
-
|
|
1606
|
-
# @api private
|
|
1607
|
-
def string_PCallableType(t)
|
|
1608
|
-
# generic
|
|
1609
|
-
return "Callable" if t.param_types.nil?
|
|
1610
|
-
|
|
1611
|
-
if t.param_types.types.empty?
|
|
1612
|
-
range = [0, 0]
|
|
1613
|
-
else
|
|
1614
|
-
range = range_array_part(t.param_types.size_type)
|
|
1615
|
-
end
|
|
1616
|
-
# translate to string, and skip Unit types
|
|
1617
|
-
types = t.param_types.types.map {|t2| string(t2) unless t2.class == Types::PUnitType }.compact
|
|
1618
|
-
|
|
1619
|
-
s = "Callable[" << types.join(', ')
|
|
1620
|
-
unless range.empty?
|
|
1621
|
-
(s << ', ') unless types.empty?
|
|
1622
|
-
s << range.join(', ')
|
|
1623
|
-
end
|
|
1624
|
-
# Add block T last (after min, max) if present)
|
|
1625
|
-
#
|
|
1626
|
-
unless t.block_type.nil?
|
|
1627
|
-
(s << ', ') unless types.empty? && range.empty?
|
|
1628
|
-
s << string(t.block_type)
|
|
1629
|
-
end
|
|
1630
|
-
s << "]"
|
|
1631
|
-
s
|
|
1632
|
-
end
|
|
1633
|
-
|
|
1634
|
-
# @api private
|
|
1635
|
-
def string_PStructType(t)
|
|
1636
|
-
return "Struct" if t.elements.empty?
|
|
1637
|
-
"Struct[{" << t.elements.map {|element| string(element) }.join(', ') << "}]"
|
|
1638
|
-
end
|
|
1639
|
-
|
|
1640
|
-
def string_PStructElement(t)
|
|
1641
|
-
"'#{t.name}'=>#{string(t.type)}"
|
|
1642
|
-
end
|
|
1643
|
-
|
|
1644
|
-
# @api private
|
|
1645
|
-
def string_PPatternType(t)
|
|
1646
|
-
return "Pattern" if t.patterns.empty?
|
|
1647
|
-
"Pattern[" << t.patterns.map {|s| "#{s.regexp.inspect}" }.join(', ') << ']'
|
|
1648
|
-
end
|
|
1649
|
-
|
|
1650
|
-
# @api private
|
|
1651
|
-
def string_PCollectionType(t)
|
|
1652
|
-
range = range_array_part(t.size_type)
|
|
1653
|
-
unless range.empty?
|
|
1654
|
-
"Collection[#{range.join(', ')}]"
|
|
1655
|
-
else
|
|
1656
|
-
"Collection"
|
|
1657
|
-
end
|
|
1658
|
-
end
|
|
1659
|
-
|
|
1660
|
-
# @api private
|
|
1661
|
-
def string_PUnitType(t)
|
|
1662
|
-
"Unit"
|
|
1663
|
-
end
|
|
1664
|
-
|
|
1665
|
-
# @api private
|
|
1666
|
-
def string_PRuntimeType(t) ; "Runtime[#{string(t.runtime)}, #{string(t.runtime_type_name)}]" ; end
|
|
1667
|
-
|
|
1668
|
-
# @api private
|
|
1669
|
-
def string_PArrayType(t)
|
|
1670
|
-
parts = [string(t.element_type)] + range_array_part(t.size_type)
|
|
1671
|
-
"Array[#{parts.join(', ')}]"
|
|
1672
|
-
end
|
|
1673
|
-
|
|
1674
|
-
# @api private
|
|
1675
|
-
def string_PHashType(t)
|
|
1676
|
-
parts = [string(t.key_type), string(t.element_type)] + range_array_part(t.size_type)
|
|
1677
|
-
"Hash[#{parts.join(', ')}]"
|
|
1678
|
-
end
|
|
1679
|
-
|
|
1680
|
-
# @api private
|
|
1681
|
-
def string_PCatalogEntryType(t)
|
|
1682
|
-
"CatalogEntry"
|
|
1683
|
-
end
|
|
1684
|
-
|
|
1685
|
-
# @api private
|
|
1686
|
-
def string_PHostClassType(t)
|
|
1687
|
-
if t.class_name
|
|
1688
|
-
"Class[#{t.class_name}]"
|
|
1689
|
-
else
|
|
1690
|
-
"Class"
|
|
1691
|
-
end
|
|
1692
|
-
end
|
|
1693
|
-
|
|
1694
|
-
# @api private
|
|
1695
|
-
def string_PResourceType(t)
|
|
1696
|
-
if t.type_name
|
|
1697
|
-
if t.title
|
|
1698
|
-
"#{capitalize_segments(t.type_name)}['#{t.title}']"
|
|
1699
|
-
else
|
|
1700
|
-
capitalize_segments(t.type_name)
|
|
1701
|
-
end
|
|
1702
|
-
else
|
|
1703
|
-
"Resource"
|
|
1704
|
-
end
|
|
1705
|
-
end
|
|
1706
|
-
|
|
1707
|
-
def string_POptionalType(t)
|
|
1708
|
-
if t.optional_type.nil?
|
|
1709
|
-
"Optional"
|
|
1710
|
-
else
|
|
1711
|
-
"Optional[#{string(t.optional_type)}]"
|
|
1712
|
-
end
|
|
1713
|
-
end
|
|
1714
|
-
|
|
1715
|
-
# Catches all non enumerable types
|
|
1716
|
-
# @api private
|
|
1717
|
-
def enumerable_Object(o)
|
|
1718
|
-
nil
|
|
1719
|
-
end
|
|
1720
|
-
|
|
1721
|
-
# @api private
|
|
1722
|
-
def enumerable_PIntegerType(t)
|
|
1723
|
-
# Not enumerable if representing an infinite range
|
|
1724
|
-
return nil if t.size == Float::INFINITY
|
|
1725
|
-
t
|
|
1726
|
-
end
|
|
1727
|
-
|
|
1728
|
-
def self.copy_as_tuple(t)
|
|
1729
|
-
case t
|
|
1730
|
-
when Types::PTupleType
|
|
1731
|
-
t.copy
|
|
1732
|
-
when Types::PArrayType
|
|
1733
|
-
# transform array to tuple
|
|
1734
|
-
result = Types::PTupleType.new
|
|
1735
|
-
result.addTypes(t.element_type.copy)
|
|
1736
|
-
result.size_type = t.size_type.nil? ? nil : t.size_type.copy
|
|
1737
|
-
result
|
|
1738
|
-
else
|
|
1739
|
-
raise ArgumentError, "Internal Error: Only Array and Tuple can be given to copy_as_tuple"
|
|
1740
|
-
end
|
|
1741
|
-
end
|
|
1742
|
-
|
|
1743
767
|
# Debugging to_s to reduce the amount of output
|
|
1744
768
|
def to_s
|
|
1745
769
|
'[a TypeCalculator]'
|
|
@@ -1747,32 +771,28 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
1747
771
|
|
|
1748
772
|
private
|
|
1749
773
|
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
s.split(NAME_SEGMENT_SEPARATOR).map(&:capitalize).join(NAME_SEGMENT_SEPARATOR)
|
|
774
|
+
def common_rich_data?(t1, t2)
|
|
775
|
+
d = TypeFactory.rich_data
|
|
776
|
+
d.assignable?(t1) && d.assignable?(t2)
|
|
1754
777
|
end
|
|
1755
778
|
|
|
1756
|
-
def
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
memo.const_get(name_segment)
|
|
1760
|
-
end
|
|
1761
|
-
rescue NameError
|
|
1762
|
-
return nil
|
|
1763
|
-
end
|
|
779
|
+
def common_data?(t1, t2)
|
|
780
|
+
d = TypeFactory.data
|
|
781
|
+
d.assignable?(t1) && d.assignable?(t2)
|
|
1764
782
|
end
|
|
1765
783
|
|
|
1766
|
-
def
|
|
1767
|
-
assignable?(
|
|
784
|
+
def common_scalar_data?(t1, t2)
|
|
785
|
+
PScalarDataType::DEFAULT.assignable?(t1) && PScalarDataType::DEFAULT.assignable?(t2)
|
|
1768
786
|
end
|
|
1769
787
|
|
|
1770
788
|
def common_scalar?(t1, t2)
|
|
1771
|
-
assignable?(
|
|
789
|
+
PScalarType::DEFAULT.assignable?(t1) && PScalarType::DEFAULT.assignable?(t2)
|
|
1772
790
|
end
|
|
1773
791
|
|
|
1774
792
|
def common_numeric?(t1, t2)
|
|
1775
|
-
assignable?(
|
|
793
|
+
PNumericType::DEFAULT.assignable?(t1) && PNumericType::DEFAULT.assignable?(t2)
|
|
1776
794
|
end
|
|
1777
795
|
|
|
1778
796
|
end
|
|
797
|
+
end
|
|
798
|
+
end
|