puppet 4.8.2-x86-mingw32 → 4.9.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +15 -0
- data/CONTRIBUTING.md +25 -1
- data/Gemfile +6 -0
- data/Rakefile +1 -0
- data/ext/project_data.yaml +5 -1
- data/ext/windows/service/daemon.rb +2 -1
- data/install.rb +43 -6
- data/lib/hiera/puppet_function.rb +15 -17
- data/lib/hiera/scope.rb +12 -14
- data/lib/puppet.rb +52 -0
- data/lib/puppet/application/face_base.rb +4 -0
- data/lib/puppet/application/lookup.rb +4 -2
- data/lib/puppet/application/resource.rb +1 -1
- data/lib/puppet/data_providers.rb +6 -3
- data/lib/puppet/data_providers/data_adapter.rb +6 -0
- data/lib/puppet/data_providers/data_function_support.rb +7 -0
- data/lib/puppet/data_providers/function_env_data_provider.rb +7 -0
- data/lib/puppet/data_providers/function_module_data_provider.rb +6 -0
- data/lib/puppet/data_providers/hiera_config.rb +31 -10
- data/lib/puppet/data_providers/hiera_env_data_provider.rb +6 -0
- data/lib/puppet/data_providers/hiera_interpolate.rb +2 -1
- data/lib/puppet/data_providers/hiera_module_data_provider.rb +6 -0
- data/lib/puppet/data_providers/hiera_support.rb +6 -0
- data/lib/puppet/data_providers/json_data_provider_factory.rb +12 -0
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +12 -0
- data/lib/puppet/defaults.rb +25 -4
- data/lib/puppet/face/ca.rb +2 -0
- data/lib/puppet/face/certificate_request.rb +2 -0
- data/lib/puppet/face/certificate_revocation_list.rb +2 -0
- data/lib/puppet/face/file.rb +3 -0
- data/lib/puppet/face/help.rb +19 -17
- data/lib/puppet/face/help/face.erb +3 -0
- data/lib/puppet/face/key.rb +1 -0
- data/lib/puppet/face/man.rb +4 -2
- data/lib/puppet/face/module/generate.rb +1 -1
- data/lib/puppet/face/status.rb +2 -0
- data/lib/puppet/feature/base.rb +9 -2
- data/lib/puppet/feature/hocon.rb +3 -0
- data/lib/puppet/file_system.rb +15 -3
- data/lib/puppet/file_system/windows.rb +8 -0
- data/lib/puppet/forge.rb +6 -6
- data/lib/puppet/forge/repository.rb +1 -2
- data/lib/puppet/functions/binary_file.rb +4 -10
- data/lib/puppet/functions/hiera_array.rb +1 -1
- data/lib/puppet/functions/hiera_include.rb +1 -1
- data/lib/puppet/functions/hocon_data.rb +24 -0
- data/lib/puppet/functions/json_data.rb +18 -0
- data/lib/puppet/functions/yaml_data.rb +21 -0
- data/lib/puppet/generate/type.rb +1 -1
- data/lib/puppet/graph/simple_graph.rb +4 -2
- data/lib/puppet/indirector/file_bucket_file/file.rb +10 -2
- data/lib/puppet/indirector/request.rb +5 -1
- data/lib/puppet/interface.rb +14 -2
- data/lib/puppet/interface/face_collection.rb +1 -1
- data/lib/puppet/module.rb +14 -2
- data/lib/puppet/module_tool.rb +4 -4
- data/lib/puppet/module_tool/applications/builder.rb +3 -2
- data/lib/puppet/module_tool/applications/installer.rb +14 -14
- data/lib/puppet/module_tool/applications/upgrader.rb +13 -13
- data/lib/puppet/module_tool/installed_modules.rb +7 -7
- data/lib/puppet/module_tool/local_tarball.rb +3 -3
- data/lib/puppet/module_tool/metadata.rb +1 -1
- data/lib/puppet/network/http/connection.rb +2 -0
- data/lib/puppet/network/http/webrick.rb +2 -1
- data/lib/puppet/parser/functions/hiera.rb +14 -0
- data/lib/puppet/parser/functions/hiera_array.rb +14 -0
- data/lib/puppet/parser/functions/hiera_hash.rb +14 -0
- data/lib/puppet/parser/functions/hiera_include.rb +14 -0
- data/lib/puppet/parser/scope.rb +14 -20
- data/lib/puppet/plugins/data_providers.rb +2 -0
- data/lib/puppet/plugins/data_providers/data_provider.rb +108 -17
- data/lib/puppet/plugins/data_providers/registry.rb +2 -36
- data/lib/puppet/pops.rb +6 -9
- data/lib/puppet/pops/adaptable.rb +0 -3
- data/lib/puppet/pops/binder/producers.rb +3 -3
- data/lib/puppet/pops/evaluator/access_operator.rb +4 -4
- data/lib/puppet/pops/evaluator/closure.rb +1 -1
- data/lib/puppet/pops/evaluator/compare_operator.rb +4 -4
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
- data/lib/puppet/pops/issues.rb +4 -0
- data/lib/puppet/pops/label_provider.rb +14 -0
- data/lib/puppet/pops/loader/loader_paths.rb +3 -1
- data/lib/puppet/pops/loader/module_loaders.rb +21 -7
- data/lib/puppet/pops/loader/typed_name.rb +0 -2
- data/lib/puppet/pops/loaders.rb +31 -12
- data/lib/puppet/pops/lookup.rb +4 -3
- data/lib/puppet/pops/lookup/configured_data_provider.rb +87 -0
- data/lib/puppet/pops/lookup/context.rb +121 -71
- data/lib/puppet/pops/lookup/data_adapter.rb +27 -0
- data/lib/puppet/pops/lookup/data_dig_function_provider.rb +55 -0
- data/lib/puppet/pops/lookup/data_hash_function_provider.rb +111 -0
- data/lib/puppet/pops/lookup/data_provider.rb +102 -0
- data/lib/puppet/pops/lookup/environment_data_provider.rb +27 -0
- data/lib/puppet/pops/lookup/explainer.rb +122 -82
- data/lib/puppet/pops/lookup/function_provider.rb +82 -0
- data/lib/puppet/pops/lookup/global_data_provider.rb +49 -0
- data/lib/puppet/pops/lookup/hiera_config.rb +601 -0
- data/lib/puppet/pops/lookup/interpolation.rb +56 -35
- data/lib/puppet/pops/lookup/invocation.rb +179 -101
- data/lib/puppet/pops/lookup/location_resolver.rb +72 -0
- data/lib/puppet/pops/lookup/lookup_adapter.rb +451 -0
- data/lib/puppet/pops/lookup/lookup_key.rb +99 -0
- data/lib/puppet/pops/lookup/lookup_key_function_provider.rb +119 -0
- data/lib/puppet/pops/lookup/module_data_provider.rb +58 -0
- data/lib/puppet/pops/lookup/sub_lookup.rb +8 -4
- data/lib/puppet/pops/merge_strategy.rb +120 -39
- data/lib/puppet/pops/parser/egrammar.ra +2 -0
- data/lib/puppet/pops/parser/eparser.rb +816 -808
- data/lib/puppet/pops/parser/locator.rb +3 -3
- data/lib/puppet/pops/parser/slurp_support.rb +4 -3
- data/lib/puppet/pops/pcore.rb +21 -12
- data/lib/puppet/pops/serialization/abstract_reader.rb +17 -7
- data/lib/puppet/pops/serialization/abstract_writer.rb +27 -12
- data/lib/puppet/pops/serialization/deserializer.rb +17 -4
- data/lib/puppet/pops/serialization/extension.rb +37 -8
- data/lib/puppet/pops/serialization/object.rb +14 -6
- data/lib/puppet/pops/serialization/rgen.rb +2 -1
- data/lib/puppet/pops/serialization/serializer.rb +30 -7
- data/lib/puppet/pops/types/implementation_registry.rb +1 -1
- data/lib/puppet/pops/types/p_object_type.rb +55 -12
- data/lib/puppet/pops/types/p_sem_ver_range_type.rb +27 -27
- data/lib/puppet/pops/types/p_sem_ver_type.rb +12 -12
- data/lib/puppet/pops/types/p_timespan_type.rb +6 -6
- data/lib/puppet/pops/types/p_timestamp_type.rb +2 -2
- data/lib/puppet/pops/types/p_type_set_type.rb +7 -16
- data/lib/puppet/pops/types/recursion_guard.rb +64 -20
- data/lib/puppet/pops/types/ruby_generator.rb +10 -0
- data/lib/puppet/pops/types/type_calculator.rb +23 -13
- data/lib/puppet/pops/types/type_factory.rb +20 -9
- data/lib/puppet/pops/types/type_formatter.rb +37 -17
- data/lib/puppet/pops/types/type_mismatch_describer.rb +7 -6
- data/lib/puppet/pops/types/type_parser.rb +6 -0
- data/lib/puppet/pops/types/types.rb +225 -132
- data/lib/puppet/pops/validation.rb +1 -1
- data/lib/puppet/pops/validation/checker4_0.rb +12 -2
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
- data/lib/puppet/pops/visitor.rb +4 -3
- data/lib/puppet/provider/mcx/mcxcontent.rb +2 -1
- data/lib/puppet/provider/nameservice.rb +15 -0
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/dnf.rb +1 -1
- data/lib/puppet/provider/package/pkg.rb +1 -1
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/pkgng.rb +1 -1
- data/lib/puppet/provider/package/rpm.rb +2 -2
- data/lib/puppet/provider/service/smf.rb +3 -3
- data/lib/puppet/provider/service/systemd.rb +5 -1
- data/lib/puppet/provider/user/directoryservice.rb +1 -0
- data/lib/puppet/provider/user/user_role_add.rb +15 -0
- data/lib/puppet/provider/yumrepo/inifile.rb +2 -2
- data/lib/puppet/provider/zone/solaris.rb +4 -1
- data/lib/puppet/reference/indirection.rb +1 -1
- data/lib/puppet/resource.rb +2 -3
- data/lib/puppet/resource/catalog.rb +12 -4
- data/lib/puppet/resource/type.rb +3 -3
- data/lib/puppet/settings.rb +1 -1
- data/lib/puppet/settings/config_file.rb +2 -1
- data/lib/puppet/settings/directory_setting.rb +6 -0
- data/lib/puppet/settings/environment_conf.rb +6 -2
- data/lib/puppet/settings/file_or_directory_setting.rb +6 -0
- data/lib/puppet/settings/file_setting.rb +10 -0
- data/lib/puppet/ssl/certificate_authority.rb +13 -2
- data/lib/puppet/ssl/host.rb +23 -1
- data/lib/puppet/transaction/additional_resource_generator.rb +7 -0
- data/lib/puppet/type/user.rb +16 -3
- data/lib/puppet/util.rb +1 -0
- data/lib/puppet/util/execution.rb +3 -3
- data/lib/puppet/util/filetype.rb +11 -5
- data/lib/puppet/util/logging.rb +2 -1
- data/lib/puppet/util/network_device/config.rb +1 -1
- data/lib/puppet/util/plist.rb +6 -0
- data/lib/puppet/util/profiler/aggregate.rb +1 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +2 -2
- data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +2 -1
- data/lib/puppet/util/windows/adsi.rb +15 -12
- data/lib/puppet/vendor/load_semantic_puppet.rb +1 -0
- data/lib/puppet/vendor/pathspec/lib/pathspec.rb +2 -1
- data/lib/puppet/vendor/require_vendored.rb +0 -1
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +17 -0
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency.rb +7 -7
- 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_puppet/lib/semantic_puppet/dependency/module_release.rb +58 -0
- 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_puppet/lib/semantic_puppet/gem_version.rb +3 -0
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/locales/config.yaml +21 -0
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/version.rb +48 -21
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/version_range.rb +15 -17
- data/lib/puppet/version.rb +1 -1
- data/lib/semver.rb +19 -12
- data/locales/config.yaml +29 -0
- data/locales/puppet.pot +79 -0
- data/man/man5/puppet.conf.5 +1 -1
- data/spec/fixtures/unit/application/environments/puppet_func_provider/functions/{data.pp → environment/data.pp} +0 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/two/data/common.yaml +1 -1
- data/spec/fixtures/unit/data_providers/environments/sample/modules/backend/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/backend/lib/puppet/bindings/backend/default.rb +9 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/backend/lib/puppet_x/backend/special_data_provider_factory.rb +23 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/backend/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/backend/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_env_data.rb +1 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/manifests/init.pp +1 -1
- 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 → 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/bindings/abc/default.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/bad_data/lib/puppet/bindings/bad_data/default.rb +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/bad_data/lib/puppet/functions/bad_data/data.rb +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/bad_data/manifests/init.pp +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/bca/lib/puppet/bindings/bca/default.rb +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/empty_json/data/empty.json +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_json/hiera.yaml +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_json/manifests/init.pp +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_json/metadata.json +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_key_json/data/empty_key.json +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_key_json/hiera.yaml +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_key_json/manifests/init.pp +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_key_json/metadata.json +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_key_yaml/data/empty_key.yaml +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_key_yaml/hiera.yaml +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_key_yaml/manifests/init.pp +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_key_yaml/metadata.json +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_yaml/data/empty.yaml +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_yaml/hiera.yaml +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_yaml/manifests/init.pp +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/empty_yaml/metadata.json +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/hieraprovider/data/first.json +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/hieraprovider/hiera.yaml +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/hieraprovider/manifests/init.pp +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/hieraprovider/metadata.json +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/meta/lib/puppet/functions/meta/data.rb +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/meta/manifests/init.pp +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/meta/metadata.json +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/metawcp/lib/puppet/bindings/metawcp/default.rb +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/metawcp/lib/puppet_x/thallgren/sample_module_data.rb +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/metawcp/manifests/init.pp +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/metawcp/metadata.json +0 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/no_provider/manifests/init.pp +0 -0
- data/spec/integration/application/apply_spec.rb +88 -2
- data/spec/integration/application/lookup_spec.rb +155 -0
- data/spec/integration/data_binding_spec.rb +5 -5
- data/spec/integration/defaults_spec.rb +13 -0
- data/spec/integration/environments/default_manifest_spec.rb +16 -16
- data/spec/integration/environments/setting_hooks_spec.rb +1 -1
- data/spec/integration/test/test_helper_spec.rb +6 -2
- data/spec/integration/transaction_spec.rb +74 -0
- data/spec/integration/util/execution_spec.rb +8 -0
- 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/unindent.rb +2 -2
- data/spec/unit/application/face_base_spec.rb +16 -0
- data/spec/unit/application/lookup_spec.rb +262 -227
- data/spec/unit/data_providers/{sample_data_provider_spec.rb → custom_data_provider_spec.rb} +14 -16
- data/spec/unit/data_providers/function_data_provider_spec.rb +2 -2
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +60 -97
- data/spec/unit/defaults_spec.rb +1 -1
- data/spec/unit/face/ca_spec.rb +10 -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/file_spec.rb +4 -0
- data/spec/unit/face/help_spec.rb +17 -0
- data/spec/unit/face/key_spec.rb +10 -0
- data/spec/unit/face/status_spec.rb +10 -0
- data/spec/unit/file_system_spec.rb +143 -6
- data/spec/unit/functions/binary_file_spec.rb +1 -1
- data/spec/unit/functions/hiera_spec.rb +257 -47
- data/spec/unit/functions/lookup_fixture_spec.rb +693 -0
- data/spec/unit/functions/lookup_spec.rb +1319 -608
- data/spec/unit/functions/new_spec.rb +3 -3
- data/spec/unit/graph/rb_tree_map_spec.rb +1 -1
- data/spec/unit/graph/simple_graph_spec.rb +1 -1
- data/spec/unit/hiera/scope_spec.rb +4 -4
- data/spec/unit/indirector/request_spec.rb +9 -0
- data/spec/unit/interface_spec.rb +27 -0
- data/spec/unit/man_spec.rb +1 -1
- data/spec/unit/module_spec.rb +1 -1
- data/spec/unit/module_tool/applications/builder_spec.rb +16 -1
- data/spec/unit/module_tool/applications/installer_spec.rb +1 -1
- data/spec/unit/module_tool/applications/upgrader_spec.rb +1 -1
- data/spec/unit/module_tool/installed_modules_spec.rb +6 -6
- data/spec/unit/module_tool_spec.rb +3 -3
- data/spec/unit/network/http/connection_spec.rb +10 -0
- data/spec/unit/network/http/webrick_spec.rb +1 -1
- data/spec/unit/pops/evaluator/access_ops_spec.rb +2 -2
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +9 -9
- data/spec/unit/pops/loaders/environment_loader_spec.rb +172 -0
- data/spec/unit/pops/lookup/context_spec.rb +45 -16
- data/spec/unit/pops/lookup/interpolation_spec.rb +28 -20
- data/spec/unit/pops/lookup/lookup_spec.rb +197 -0
- data/spec/unit/pops/merge_strategy_spec.rb +18 -0
- data/spec/unit/pops/parser/lexer2_spec.rb +16 -1
- data/spec/unit/pops/parser/parse_site_spec.rb +4 -0
- data/spec/unit/pops/serialization/packer_spec.rb +4 -23
- data/spec/unit/pops/serialization/serialization_spec.rb +32 -8
- data/spec/unit/pops/types/p_object_type_spec.rb +68 -3
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +4 -4
- data/spec/unit/pops/types/p_type_set_type_spec.rb +31 -2
- data/spec/unit/pops/types/type_acceptor_spec.rb +18 -17
- data/spec/unit/pops/types/type_calculator_spec.rb +39 -40
- data/spec/unit/pops/types/type_factory_spec.rb +3 -3
- data/spec/unit/pops/types/type_formatter_spec.rb +7 -3
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +13 -2
- data/spec/unit/pops/types/types_spec.rb +25 -2
- data/spec/unit/pops/validator/validator_spec.rb +60 -4
- data/spec/unit/provider/nameservice_spec.rb +42 -0
- data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
- data/spec/unit/provider/package/pkg_spec.rb +22 -0
- data/spec/unit/provider/package/pkgng_spec.rb +12 -0
- data/spec/unit/provider/package/rpm_spec.rb +8 -8
- data/spec/unit/provider/service/smf_spec.rb +13 -11
- data/spec/unit/provider/service/systemd_spec.rb +8 -1
- data/spec/unit/provider/user/useradd_spec.rb +1 -0
- data/spec/unit/puppet_spec.rb +14 -0
- data/spec/unit/resource/catalog_spec.rb +15 -9
- data/spec/unit/resource_spec.rb +20 -17
- data/spec/unit/semver_spec.rb +14 -0
- data/spec/unit/ssl/certificate_authority_spec.rb +12 -1
- data/spec/unit/transaction/additional_resource_generator_spec.rb +11 -0
- data/spec/unit/type/user_spec.rb +32 -6
- data/spec/unit/util/filetype_spec.rb +3 -3
- data/spec/unit/util/yaml_spec.rb +1 -1
- data/spec/unit/util_spec.rb +10 -2
- data/tasks/i18n.rake +20 -0
- metadata +2661 -2607
- data/lib/puppet/data_providers/lookup_adapter.rb +0 -254
- data/lib/puppet/vendor/load_semantic.rb +0 -1
- 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.rb +0 -7
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb +0 -60
- 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/spec/fixtures/unit/data_providers/environments/sample/manifests/site.pp +0 -6
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'semantic/dependency/unsatisfiable_graph'
|
3
|
-
|
4
|
-
describe Semantic::Dependency::UnsatisfiableGraph do
|
5
|
-
|
6
|
-
let(:modules) { %w[ foo bar baz ] }
|
7
|
-
let(:graph) { double('Graph', :modules => modules) }
|
8
|
-
let(:instance) { described_class.new(graph) }
|
9
|
-
|
10
|
-
subject { instance }
|
11
|
-
|
12
|
-
describe '#message' do
|
13
|
-
subject { instance.message }
|
14
|
-
|
15
|
-
it { should match /#{instance.send(:sentence_from_list, modules)}/ }
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#sentence_from_list' do
|
19
|
-
|
20
|
-
subject { instance.send(:sentence_from_list, modules) }
|
21
|
-
|
22
|
-
context 'with a list of one item' do
|
23
|
-
let(:modules) { %w[ foo ] }
|
24
|
-
it { should eql 'foo' }
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'with a list of two items' do
|
28
|
-
let(:modules) { %w[ foo bar ] }
|
29
|
-
it { should eql 'foo and bar' }
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'with a list of three items' do
|
33
|
-
let(:modules) { %w[ foo bar baz ] }
|
34
|
-
it { should eql 'foo, bar, and baz' }
|
35
|
-
end
|
36
|
-
|
37
|
-
context 'with a list of more than three items' do
|
38
|
-
let(:modules) { %w[ foo bar baz quux ] }
|
39
|
-
it { should eql 'foo, bar, baz, and quux' }
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
@@ -1,383 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'semantic/dependency'
|
3
|
-
|
4
|
-
describe Semantic::Dependency do
|
5
|
-
def create_release(source, name, version, deps = {})
|
6
|
-
Semantic::Dependency::ModuleRelease.new(
|
7
|
-
source,
|
8
|
-
name,
|
9
|
-
Semantic::Version.parse(version),
|
10
|
-
Hash[deps.map { |k, v| [k, Semantic::VersionRange.parse(v) ] }]
|
11
|
-
)
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '.sources' do
|
15
|
-
it 'defaults to an empty list' do
|
16
|
-
expect(subject.sources).to be_empty
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'is frozen' do
|
20
|
-
expect(subject.sources).to be_frozen
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'can be modified by using #add_source' do
|
24
|
-
subject.add_source(Semantic::Dependency::Source.new)
|
25
|
-
expect(subject.sources).to_not be_empty
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'can be emptied by using #clear_sources' do
|
29
|
-
subject.add_source(Semantic::Dependency::Source.new)
|
30
|
-
subject.clear_sources
|
31
|
-
expect(subject.sources).to be_empty
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '.query' do
|
36
|
-
context 'without sources' do
|
37
|
-
it 'returns an unsatisfied ModuleRelease' do
|
38
|
-
expect(subject.query('module_name' => '1.0.0')).to_not be_satisfied
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'with one source' do
|
43
|
-
let(:source) { double('Source') }
|
44
|
-
|
45
|
-
before { Semantic::Dependency.add_source(source) }
|
46
|
-
|
47
|
-
it 'queries the source for release information' do
|
48
|
-
source.should_receive(:fetch).with('module_name').and_return([])
|
49
|
-
|
50
|
-
Semantic::Dependency.query('module_name' => '1.0.0')
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'queries the source for each dependency' do
|
54
|
-
source.should_receive(:fetch).with('module_name').and_return([
|
55
|
-
create_release(source, 'module_name', '1.0.0', 'bar' => '1.0.0')
|
56
|
-
])
|
57
|
-
source.should_receive(:fetch).with('bar').and_return([])
|
58
|
-
|
59
|
-
Semantic::Dependency.query('module_name' => '1.0.0')
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'queries the source for each dependency only once' do
|
63
|
-
source.should_receive(:fetch).with('module_name').and_return([
|
64
|
-
create_release(
|
65
|
-
source,
|
66
|
-
'module_name',
|
67
|
-
'1.0.0',
|
68
|
-
'bar' => '1.0.0', 'baz' => '0.0.2'
|
69
|
-
)
|
70
|
-
])
|
71
|
-
source.should_receive(:fetch).with('bar').and_return([
|
72
|
-
create_release(source, 'bar', '1.0.0', 'baz' => '0.0.3')
|
73
|
-
])
|
74
|
-
source.should_receive(:fetch).with('baz').once.and_return([])
|
75
|
-
|
76
|
-
Semantic::Dependency.query('module_name' => '1.0.0')
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'returns a ModuleRelease with the requested dependencies' do
|
80
|
-
source.stub(:fetch).and_return([])
|
81
|
-
|
82
|
-
result = Semantic::Dependency.query('foo' => '1.0.0', 'bar' => '1.0.0')
|
83
|
-
expect(result.dependency_names).to match_array %w[ foo bar ]
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'populates the returned ModuleRelease with related dependencies' do
|
87
|
-
source.stub(:fetch).and_return(
|
88
|
-
[ foo = create_release(source, 'foo', '1.0.0', 'bar' => '1.0.0') ],
|
89
|
-
[ bar = create_release(source, 'bar', '1.0.0') ]
|
90
|
-
)
|
91
|
-
|
92
|
-
result = Semantic::Dependency.query('foo' => '1.0.0', 'bar' => '1.0.0')
|
93
|
-
expect(result.dependencies['foo']).to eql SortedSet.new([ foo ])
|
94
|
-
expect(result.dependencies['bar']).to eql SortedSet.new([ bar ])
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'populates all returned ModuleReleases with related dependencies' do
|
98
|
-
source.stub(:fetch).and_return(
|
99
|
-
[ foo = create_release(source, 'foo', '1.0.0', 'bar' => '1.0.0') ],
|
100
|
-
[ bar = create_release(source, 'bar', '1.0.0', 'baz' => '0.1.0') ],
|
101
|
-
[ baz = create_release(source, 'baz', '0.1.0', 'baz' => '1.0.0') ]
|
102
|
-
)
|
103
|
-
|
104
|
-
result = Semantic::Dependency.query('foo' => '1.0.0')
|
105
|
-
expect(result.dependencies['foo']).to eql SortedSet.new([ foo ])
|
106
|
-
expect(foo.dependencies['bar']).to eql SortedSet.new([ bar ])
|
107
|
-
expect(bar.dependencies['baz']).to eql SortedSet.new([ baz ])
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
context 'with multiple sources' do
|
112
|
-
let(:source1) { double('SourceOne') }
|
113
|
-
let(:source2) { double('SourceTwo') }
|
114
|
-
let(:source3) { double('SourceThree') }
|
115
|
-
|
116
|
-
before do
|
117
|
-
Semantic::Dependency.add_source(source1)
|
118
|
-
Semantic::Dependency.add_source(source2)
|
119
|
-
Semantic::Dependency.add_source(source3)
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'queries each source in turn' do
|
123
|
-
source1.should_receive(:fetch).with('module_name').and_return([])
|
124
|
-
source2.should_receive(:fetch).with('module_name').and_return([])
|
125
|
-
source3.should_receive(:fetch).with('module_name').and_return([])
|
126
|
-
|
127
|
-
Semantic::Dependency.query('module_name' => '1.0.0')
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'resolves all dependencies against all sources' do
|
131
|
-
source1.should_receive(:fetch).with('module_name').and_return([
|
132
|
-
create_release(source1, 'module_name', '1.0.0', 'bar' => '1.0.0')
|
133
|
-
])
|
134
|
-
source2.should_receive(:fetch).with('module_name').and_return([])
|
135
|
-
source3.should_receive(:fetch).with('module_name').and_return([])
|
136
|
-
|
137
|
-
source1.should_receive(:fetch).with('bar').and_return([])
|
138
|
-
source2.should_receive(:fetch).with('bar').and_return([])
|
139
|
-
source3.should_receive(:fetch).with('bar').and_return([])
|
140
|
-
|
141
|
-
Semantic::Dependency.query('module_name' => '1.0.0')
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
describe '.resolve' do
|
147
|
-
def add_source_modules(name, versions, deps = {})
|
148
|
-
versions = Array(versions)
|
149
|
-
releases = versions.map { |ver| create_release(source, name, ver, deps) }
|
150
|
-
source.stub(:fetch).with(name).and_return(modules[name].concat(releases))
|
151
|
-
end
|
152
|
-
|
153
|
-
def subject(specs)
|
154
|
-
graph = Semantic::Dependency.query(specs)
|
155
|
-
yield graph if block_given?
|
156
|
-
expect(graph.dependencies).to_not be_empty
|
157
|
-
result = Semantic::Dependency.resolve(graph)
|
158
|
-
expect(graph.dependencies).to_not be_empty
|
159
|
-
result.map { |rel| [ rel.name, rel.version.to_s ] }
|
160
|
-
end
|
161
|
-
|
162
|
-
let(:modules) { Hash.new { |h,k| h[k] = [] }}
|
163
|
-
let(:source) { double('Source', :priority => 0) }
|
164
|
-
|
165
|
-
before { Semantic::Dependency.add_source(source) }
|
166
|
-
|
167
|
-
context 'for a module without dependencies' do
|
168
|
-
def foo(range)
|
169
|
-
subject('foo' => range).map { |x| x.last }
|
170
|
-
end
|
171
|
-
|
172
|
-
it 'returns the greatest release matching the version range' do
|
173
|
-
add_source_modules('foo', %w[ 0.9.0 1.0.0 1.1.0 2.0.0 ])
|
174
|
-
|
175
|
-
expect(foo('1.x')).to eql %w[ 1.1.0 ]
|
176
|
-
end
|
177
|
-
|
178
|
-
context 'when the query includes both stable and prerelease versions' do
|
179
|
-
it 'returns the greatest stable release matching the range' do
|
180
|
-
add_source_modules('foo', %w[ 0.9.0 1.0.0 1.1.0 1.2.0-pre 2.0.0 ])
|
181
|
-
|
182
|
-
expect(foo('1.x')).to eql %w[ 1.1.0 ]
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
context 'when the query omits all stable versions' do
|
187
|
-
it 'returns the greatest prerelease version matching the range' do
|
188
|
-
add_source_modules('foo', %w[ 1.0.0 1.1.0-a 1.1.0-b 2.0.0 ])
|
189
|
-
|
190
|
-
expect(foo('1.1.x')).to eql %w[ 1.1.0-b ]
|
191
|
-
expect(foo('1.1.0-a')).to eql %w[ 1.1.0-a ]
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
context 'when the query omits all versions' do
|
196
|
-
it 'fails with an appropriate message' do
|
197
|
-
add_source_modules('foo', %w[ 1.0.0 1.1.0-a 1.1.0 ])
|
198
|
-
|
199
|
-
with_message = /Could not find satisfying releases/
|
200
|
-
expect { foo('2.x') }.to raise_exception with_message
|
201
|
-
expect { foo('2.x') }.to raise_exception /\bfoo\b/
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
context 'for a module with dependencies' do
|
207
|
-
def foo(range)
|
208
|
-
subject('foo' => range)
|
209
|
-
end
|
210
|
-
|
211
|
-
it 'returns the greatest releases matching the dependency range' do
|
212
|
-
add_source_modules('foo', '1.1.0', 'bar' => '1.x')
|
213
|
-
add_source_modules('bar', %w[ 0.9.0 1.0.0 1.1.0 1.2.0 2.0.0 ])
|
214
|
-
|
215
|
-
expect(foo('1.1.0')).to include %w[ foo 1.1.0 ], %w[ bar 1.2.0 ]
|
216
|
-
end
|
217
|
-
|
218
|
-
context 'when the dependency has both stable and prerelease versions' do
|
219
|
-
it 'returns the greatest stable release matching the range' do
|
220
|
-
add_source_modules('foo', '1.1.0', 'bar' => '1.x')
|
221
|
-
add_source_modules('bar', %w[ 0.9.0 1.0.0 1.1.0 1.2.0-pre 2.0.0 ])
|
222
|
-
|
223
|
-
expect(foo('1.1.0')).to include %w[ foo 1.1.0 ], %w[ bar 1.1.0 ]
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
context 'when the dependency has no stable versions' do
|
228
|
-
it 'returns the greatest prerelease version matching the range' do
|
229
|
-
add_source_modules('foo', '1.1.0', 'bar' => '1.1.x')
|
230
|
-
add_source_modules('foo', '1.1.1', 'bar' => '1.1.0-a')
|
231
|
-
add_source_modules('bar', %w[ 1.0.0 1.1.0-a 1.1.0-b 2.0.0 ])
|
232
|
-
|
233
|
-
expect(foo('1.1.0')).to include %w[ foo 1.1.0 ], %w[ bar 1.1.0-b ]
|
234
|
-
expect(foo('1.1.1')).to include %w[ foo 1.1.1 ], %w[ bar 1.1.0-a ]
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
context 'when the dependency cannot be satisfied' do
|
239
|
-
it 'fails with an appropriate message' do
|
240
|
-
add_source_modules('foo', %w[ 1.1.0 ], 'bar' => '1.x')
|
241
|
-
add_source_modules('bar', %w[ 0.0.1 0.1.0-a 0.1.0 ])
|
242
|
-
|
243
|
-
with_message = /Could not find satisfying releases/
|
244
|
-
expect { foo('1.1.0') }.to raise_exception with_message
|
245
|
-
expect { foo('1.1.0') }.to raise_exception /\bfoo\b/
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
context 'for a module with competing dependencies' do
|
251
|
-
def foo(range)
|
252
|
-
subject('foo' => range)
|
253
|
-
end
|
254
|
-
|
255
|
-
context 'that overlap' do
|
256
|
-
it 'returns the greatest release satisfying all dependencies' do
|
257
|
-
add_source_modules('foo', '1.1.0', 'bar' => '1.0.0', 'baz' => '1.0.0')
|
258
|
-
add_source_modules('bar', '1.0.0', 'quxx' => '1.x')
|
259
|
-
add_source_modules('baz', '1.0.0', 'quxx' => '1.1.x')
|
260
|
-
add_source_modules('quxx', %w[ 0.9.0 1.0.0 1.1.0 1.1.1 1.2.0 2.0.0 ])
|
261
|
-
|
262
|
-
expect(foo('1.1.0')).to_not include %w[ quxx 1.2.0 ]
|
263
|
-
expect(foo('1.1.0')).to include %w[ quxx 1.1.1 ]
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
context 'that do not overlap' do
|
268
|
-
it 'fails with an appropriate message' do
|
269
|
-
add_source_modules('foo','1.1.0', 'bar' => '1.0.0', 'baz' => '1.0.0')
|
270
|
-
add_source_modules('bar','1.0.0', 'quxx' => '1.x')
|
271
|
-
add_source_modules('baz','1.0.0', 'quxx' => '2.x')
|
272
|
-
add_source_modules('quxx', %w[ 0.9.0 1.0.0 1.1.0 1.1.1 1.2.0 2.0.0 ])
|
273
|
-
|
274
|
-
with_message = /Could not find satisfying releases/
|
275
|
-
expect { foo('1.1.0') }.to raise_exception with_message
|
276
|
-
expect { foo('1.1.0') }.to raise_exception /\bfoo\b/
|
277
|
-
end
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
context 'for a module with circular dependencies' do
|
282
|
-
def foo(range)
|
283
|
-
subject('foo' => range)
|
284
|
-
end
|
285
|
-
|
286
|
-
context 'that can be resolved' do
|
287
|
-
it 'terminates' do
|
288
|
-
add_source_modules('foo', '1.1.0', 'foo' => '1.x')
|
289
|
-
|
290
|
-
expect(foo('1.1.0')).to include %w[ foo 1.1.0 ]
|
291
|
-
end
|
292
|
-
end
|
293
|
-
|
294
|
-
context 'that cannot be resolved' do
|
295
|
-
it 'fails with an appropriate message' do
|
296
|
-
add_source_modules('foo', '1.1.0', 'foo' => '1.0.0')
|
297
|
-
|
298
|
-
with_message = /Could not find satisfying releases/
|
299
|
-
expect { foo('1.1.0') }.to raise_exception with_message
|
300
|
-
expect { foo('1.1.0') }.to raise_exception /\bfoo\b/
|
301
|
-
end
|
302
|
-
end
|
303
|
-
end
|
304
|
-
|
305
|
-
context 'for a module with dependencies' do
|
306
|
-
context 'that violate module constraints on the graph' do
|
307
|
-
def foo(range)
|
308
|
-
subject('foo' => range) do |graph|
|
309
|
-
graph.add_constraint('no downgrade', 'bar', '> 3.0.0') do |node|
|
310
|
-
Semantic::VersionRange.parse('> 3.0.0') === node.version
|
311
|
-
end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
context 'that can be resolved' do
|
316
|
-
it 'terminates' do
|
317
|
-
add_source_modules('foo', '1.1.0', 'bar' => '1.x')
|
318
|
-
add_source_modules('foo', '1.2.0', 'bar' => '>= 2.0.0')
|
319
|
-
add_source_modules('bar', '1.0.0')
|
320
|
-
add_source_modules('bar', '2.0.0', 'baz' => '>= 1.0.0')
|
321
|
-
add_source_modules('bar', '3.0.0')
|
322
|
-
add_source_modules('bar', '3.0.1')
|
323
|
-
add_source_modules('baz', '1.0.0')
|
324
|
-
|
325
|
-
expect(foo('1.x')).to include %w[ foo 1.2.0 ], %w[ bar 3.0.1 ]
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
|
-
context 'that cannot be resolved' do
|
330
|
-
it 'fails with an appropriate message' do
|
331
|
-
add_source_modules('foo', '1.1.0', 'bar' => '1.x')
|
332
|
-
add_source_modules('foo', '1.2.0', 'bar' => '2.x')
|
333
|
-
add_source_modules('bar', '1.0.0', 'baz' => '1.x')
|
334
|
-
add_source_modules('bar', '2.0.0', 'baz' => '1.x')
|
335
|
-
add_source_modules('baz', '1.0.0')
|
336
|
-
add_source_modules('baz', '3.0.0')
|
337
|
-
add_source_modules('baz', '3.0.1')
|
338
|
-
|
339
|
-
with_message = /Could not find satisfying releases/
|
340
|
-
expect { foo('1.x') }.to raise_exception with_message
|
341
|
-
expect { foo('1.x') }.to raise_exception /\bfoo\b/
|
342
|
-
end
|
343
|
-
end
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
|
-
context 'that violate graph constraints' do
|
348
|
-
def foo(range)
|
349
|
-
subject('foo' => range) do |graph|
|
350
|
-
graph.add_graph_constraint('uniqueness') do |nodes|
|
351
|
-
nodes.none? { |node| node.name =~ /z/ }
|
352
|
-
end
|
353
|
-
end
|
354
|
-
end
|
355
|
-
|
356
|
-
context 'that can be resolved' do
|
357
|
-
it 'terminates' do
|
358
|
-
add_source_modules('foo', '1.1.0', 'bar' => '1.x')
|
359
|
-
add_source_modules('foo', '1.2.0', 'bar' => '2.x')
|
360
|
-
add_source_modules('bar', '1.0.0')
|
361
|
-
add_source_modules('bar', '2.0.0', 'baz' => '1.0.0')
|
362
|
-
add_source_modules('baz', '1.0.0')
|
363
|
-
|
364
|
-
expect(foo('1.x')).to include %w[ foo 1.1.0 ], %w[ bar 1.0.0 ]
|
365
|
-
end
|
366
|
-
end
|
367
|
-
|
368
|
-
context 'that cannot be resolved' do
|
369
|
-
it 'fails with an appropriate message' do
|
370
|
-
add_source_modules('foo', '1.1.0', 'bar' => '1.x')
|
371
|
-
add_source_modules('foo', '1.2.0', 'bar' => '2.x')
|
372
|
-
add_source_modules('bar', '1.0.0', 'baz' => '1.0.0')
|
373
|
-
add_source_modules('bar', '2.0.0', 'baz' => '1.0.0')
|
374
|
-
add_source_modules('baz', '1.0.0')
|
375
|
-
|
376
|
-
with_message = /Could not find satisfying releases/
|
377
|
-
expect { foo('1.1.0') }.to raise_exception with_message
|
378
|
-
expect { foo('1.1.0') }.to raise_exception /\bfoo\b/
|
379
|
-
end
|
380
|
-
end
|
381
|
-
end
|
382
|
-
end
|
383
|
-
end
|
@@ -1,307 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'semantic/version'
|
3
|
-
|
4
|
-
describe Semantic::VersionRange do
|
5
|
-
|
6
|
-
describe '.parse' do
|
7
|
-
def self.test_range(range_list, str, includes, excludes)
|
8
|
-
Array(range_list).each do |expr|
|
9
|
-
example "#{expr.inspect} stringifies as #{str}" do
|
10
|
-
range = Semantic::VersionRange.parse(expr)
|
11
|
-
expect(range.to_s).to eql str
|
12
|
-
end
|
13
|
-
|
14
|
-
includes.each do |vstring|
|
15
|
-
example "#{expr.inspect} includes #{vstring}" do
|
16
|
-
range = Semantic::VersionRange.parse(expr)
|
17
|
-
expect(range).to include(Semantic::Version.parse(vstring))
|
18
|
-
end
|
19
|
-
|
20
|
-
example "parse(#{expr.inspect}).to_s includes #{vstring}" do
|
21
|
-
range = Semantic::VersionRange.parse(expr)
|
22
|
-
range = Semantic::VersionRange.parse(range.to_s)
|
23
|
-
expect(range).to include(Semantic::Version.parse(vstring))
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
excludes.each do |vstring|
|
28
|
-
example "#{expr.inspect} excludes #{vstring}" do
|
29
|
-
range = Semantic::VersionRange.parse(expr)
|
30
|
-
expect(range).to_not include(Semantic::Version.parse(vstring))
|
31
|
-
end
|
32
|
-
|
33
|
-
example "parse(#{expr.inspect}).to_s excludes #{vstring}" do
|
34
|
-
range = Semantic::VersionRange.parse(expr)
|
35
|
-
range = Semantic::VersionRange.parse(range.to_s)
|
36
|
-
expect(range).to_not include(Semantic::Version.parse(vstring))
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'loose version expressions' do
|
43
|
-
expressions = {
|
44
|
-
[ '1.2.3-alpha' ] => {
|
45
|
-
:to_str => '1.2.3-alpha',
|
46
|
-
:includes => [ '1.2.3-alpha' ],
|
47
|
-
:excludes => [ '1.2.3-999', '1.2.3-beta' ],
|
48
|
-
},
|
49
|
-
[ '1.2.3' ] => {
|
50
|
-
:to_str => '1.2.3',
|
51
|
-
:includes => [ '1.2.3-alpha', '1.2.3' ],
|
52
|
-
:excludes => [ '1.2.2', '1.2.4-alpha' ],
|
53
|
-
},
|
54
|
-
[ '1.2', '1.2.x', '1.2.X' ] => {
|
55
|
-
:to_str => '1.2.x',
|
56
|
-
:includes => [ '1.2.0-alpha', '1.2.0', '1.2.999' ],
|
57
|
-
:excludes => [ '1.1.999', '1.3.0-0' ],
|
58
|
-
},
|
59
|
-
[ '1', '1.x', '1.X' ] => {
|
60
|
-
:to_str => '1.x',
|
61
|
-
:includes => [ '1.0.0-alpha', '1.999.0' ],
|
62
|
-
:excludes => [ '0.999.999', '2.0.0-0' ],
|
63
|
-
},
|
64
|
-
}
|
65
|
-
|
66
|
-
expressions.each do |range, vs|
|
67
|
-
test_range(range, vs[:to_str], vs[:includes], vs[:excludes])
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'open-ended expressions' do
|
72
|
-
expressions = {
|
73
|
-
[ '>1.2.3', '> 1.2.3' ] => {
|
74
|
-
:to_str => '>=1.2.4',
|
75
|
-
:includes => [ '1.2.4-0', '999.0.0' ],
|
76
|
-
:excludes => [ '1.2.3' ],
|
77
|
-
},
|
78
|
-
[ '>1.2.3-alpha', '> 1.2.3-alpha' ] => {
|
79
|
-
:to_str => '>1.2.3-alpha',
|
80
|
-
:includes => [ '1.2.3-alpha.0', '1.2.3-alpha0', '999.0.0' ],
|
81
|
-
:excludes => [ '1.2.3-alpha' ],
|
82
|
-
},
|
83
|
-
|
84
|
-
[ '>=1.2.3', '>= 1.2.3' ] => {
|
85
|
-
:to_str => '>=1.2.3',
|
86
|
-
:includes => [ '1.2.3-0', '999.0.0' ],
|
87
|
-
:excludes => [ '1.2.2' ],
|
88
|
-
},
|
89
|
-
[ '>=1.2.3-alpha', '>= 1.2.3-alpha' ] => {
|
90
|
-
:to_str => '>=1.2.3-alpha',
|
91
|
-
:includes => [ '1.2.3-alpha', '1.2.3-alpha0', '999.0.0' ],
|
92
|
-
:excludes => [ '1.2.3-alph' ],
|
93
|
-
},
|
94
|
-
|
95
|
-
[ '<1.2.3', '< 1.2.3' ] => {
|
96
|
-
:to_str => '<1.2.3',
|
97
|
-
:includes => [ '0.0.0-0', '1.2.2' ],
|
98
|
-
:excludes => [ '1.2.3-0', '2.0.0' ],
|
99
|
-
},
|
100
|
-
[ '<1.2.3-alpha', '< 1.2.3-alpha' ] => {
|
101
|
-
:to_str => '<1.2.3-alpha',
|
102
|
-
:includes => [ '0.0.0-0', '1.2.3-alph' ],
|
103
|
-
:excludes => [ '1.2.3-alpha', '2.0.0' ],
|
104
|
-
},
|
105
|
-
|
106
|
-
[ '<=1.2.3', '<= 1.2.3' ] => {
|
107
|
-
:to_str => '<1.2.4',
|
108
|
-
:includes => [ '0.0.0-0', '1.2.3' ],
|
109
|
-
:excludes => [ '1.2.4-0' ],
|
110
|
-
},
|
111
|
-
[ '<=1.2.3-alpha', '<= 1.2.3-alpha' ] => {
|
112
|
-
:to_str => '<=1.2.3-alpha',
|
113
|
-
:includes => [ '0.0.0-0', '1.2.3-alpha' ],
|
114
|
-
:excludes => [ '1.2.3-alpha0', '1.2.3-alpha.0', '1.2.3-alpha'.next ],
|
115
|
-
},
|
116
|
-
}
|
117
|
-
|
118
|
-
expressions.each do |range, vs|
|
119
|
-
test_range(range, vs[:to_str], vs[:includes], vs[:excludes])
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
context '"reasonably close" expressions' do
|
124
|
-
expressions = {
|
125
|
-
[ '~ 1', '~1' ] => {
|
126
|
-
:to_str => '1.x',
|
127
|
-
:includes => [ '1.0.0-0', '1.999.999' ],
|
128
|
-
:excludes => [ '0.999.999', '2.0.0-0' ],
|
129
|
-
},
|
130
|
-
[ '~ 1.2', '~1.2' ] => {
|
131
|
-
:to_str => '1.2.x',
|
132
|
-
:includes => [ '1.2.0-0', '1.2.999' ],
|
133
|
-
:excludes => [ '1.1.999', '1.3.0-0' ],
|
134
|
-
},
|
135
|
-
[ '~ 1.2.3', '~1.2.3' ] => {
|
136
|
-
:to_str => '1.2.3',
|
137
|
-
:includes => [ '1.2.3-0', '1.2.3' ],
|
138
|
-
:excludes => [ '1.2.2', '1.2.4-0' ],
|
139
|
-
},
|
140
|
-
[ '~ 1.2.3-alpha', '~1.2.3-alpha' ] => {
|
141
|
-
:to_str => '>=1.2.3-alpha <1.2.4',
|
142
|
-
:includes => [ '1.2.3-alpha', '1.2.3' ],
|
143
|
-
:excludes => [ '1.2.3-alph', '1.2.4-0' ],
|
144
|
-
},
|
145
|
-
}
|
146
|
-
|
147
|
-
expressions.each do |range, vs|
|
148
|
-
test_range(range, vs[:to_str], vs[:includes], vs[:excludes])
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
context 'inclusive range expressions' do
|
153
|
-
expressions = {
|
154
|
-
'1.2.3 - 1.3.4' => {
|
155
|
-
:to_str => '>=1.2.3 <1.3.5',
|
156
|
-
:includes => [ '1.2.3-0', '1.3.4' ],
|
157
|
-
:excludes => [ '1.2.2', '1.3.5-0' ],
|
158
|
-
},
|
159
|
-
'1.2.3 - 1.3.4-alpha' => {
|
160
|
-
:to_str => '>=1.2.3 <=1.3.4-alpha',
|
161
|
-
:includes => [ '1.2.3-0', '1.3.4-alpha' ],
|
162
|
-
:excludes => [ '1.2.2', '1.3.4-alpha0', '1.3.5' ],
|
163
|
-
},
|
164
|
-
|
165
|
-
'1.2.3-alpha - 1.3.4' => {
|
166
|
-
:to_str => '>=1.2.3-alpha <1.3.5',
|
167
|
-
:includes => [ '1.2.3-alpha', '1.3.4' ],
|
168
|
-
:excludes => [ '1.2.3-alph', '1.3.5-0' ],
|
169
|
-
},
|
170
|
-
'1.2.3-alpha - 1.3.4-alpha' => {
|
171
|
-
:to_str => '>=1.2.3-alpha <=1.3.4-alpha',
|
172
|
-
:includes => [ '1.2.3-alpha', '1.3.4-alpha' ],
|
173
|
-
:excludes => [ '1.2.3-alph', '1.3.4-alpha0', '1.3.5' ],
|
174
|
-
},
|
175
|
-
}
|
176
|
-
|
177
|
-
expressions.each do |range, vs|
|
178
|
-
test_range(range, vs[:to_str], vs[:includes], vs[:excludes])
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
context 'unioned expressions' do
|
183
|
-
expressions = {
|
184
|
-
[ '1.2 <1.2.5' ] => {
|
185
|
-
:to_str => '>=1.2.0 <1.2.5',
|
186
|
-
:includes => [ '1.2.0-0', '1.2.4' ],
|
187
|
-
:excludes => [ '1.1.999', '1.2.5-0', '1.9.0' ],
|
188
|
-
},
|
189
|
-
[ '1 <=1.2.5' ] => {
|
190
|
-
:to_str => '>=1.0.0 <1.2.6',
|
191
|
-
:includes => [ '1.0.0-0', '1.2.5' ],
|
192
|
-
:excludes => [ '0.999.999', '1.2.6-0', '1.9.0' ],
|
193
|
-
},
|
194
|
-
[ '>1.0.0 >2.0.0 >=3.0.0 <5.0.0' ] => {
|
195
|
-
:to_str => '>=3.0.0 <5.0.0',
|
196
|
-
:includes => [ '3.0.0-0', '4.999.999' ],
|
197
|
-
:excludes => [ '2.999.999', '5.0.0-0' ],
|
198
|
-
},
|
199
|
-
[ '<1.0.0 >2.0.0' ] => {
|
200
|
-
:to_str => '<0.0.0',
|
201
|
-
:includes => [ ],
|
202
|
-
:excludes => [ '0.0.0-0' ],
|
203
|
-
},
|
204
|
-
}
|
205
|
-
|
206
|
-
expressions.each do |range, vs|
|
207
|
-
test_range(range, vs[:to_str], vs[:includes], vs[:excludes])
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
context 'invalid expressions' do
|
212
|
-
example 'raise an appropriate exception' do
|
213
|
-
ex = [ ArgumentError, 'Unparsable version range: "invalid"' ]
|
214
|
-
expect { Semantic::VersionRange.parse('invalid') }.to raise_error(*ex)
|
215
|
-
end
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
describe '#intersection' do
|
220
|
-
def self.v(num)
|
221
|
-
Semantic::Version.parse("#{num}.0.0")
|
222
|
-
end
|
223
|
-
|
224
|
-
def self.range(x, y, ex = false)
|
225
|
-
Semantic::VersionRange.new(v(x), v(y), ex)
|
226
|
-
end
|
227
|
-
|
228
|
-
EMPTY_RANGE = Semantic::VersionRange::EMPTY_RANGE
|
229
|
-
|
230
|
-
tests = {
|
231
|
-
# This falls entirely before the target range
|
232
|
-
range(1, 4) => [ EMPTY_RANGE ],
|
233
|
-
|
234
|
-
# This falls entirely after the target range
|
235
|
-
range(11, 15) => [ EMPTY_RANGE ],
|
236
|
-
|
237
|
-
# This overlaps the beginning of the target range
|
238
|
-
range(1, 6) => [ range(5, 6) ],
|
239
|
-
|
240
|
-
# This overlaps the end of the target range
|
241
|
-
range(9, 15) => [ range(9, 10), range(9, 10, true) ],
|
242
|
-
|
243
|
-
# This shares the first value of the target range
|
244
|
-
range(1, 5) => [ range(5, 5) ],
|
245
|
-
|
246
|
-
# This shares the last value of the target range
|
247
|
-
range(10, 15) => [ range(10, 10), EMPTY_RANGE ],
|
248
|
-
|
249
|
-
# This shares both values with the target range
|
250
|
-
range(5, 10) => [ range(5, 10), range(5, 10, true) ],
|
251
|
-
|
252
|
-
# This is a superset of the target range
|
253
|
-
range(4, 11) => [ range(5, 10), range(5, 10, true) ],
|
254
|
-
|
255
|
-
# This is a subset of the target range
|
256
|
-
range(6, 9) => [ range(6, 9) ],
|
257
|
-
|
258
|
-
# This shares the first value of the target range, but excludes it
|
259
|
-
range(1, 5, true) => [ EMPTY_RANGE ],
|
260
|
-
|
261
|
-
# This overlaps the beginning of the target range, with an excluded end
|
262
|
-
range(1, 7, true) => [ range(5, 7, true) ],
|
263
|
-
|
264
|
-
# This shares both values with the target range, and excludes the end
|
265
|
-
range(5, 10, true) => [ range(5, 10, true) ],
|
266
|
-
}
|
267
|
-
|
268
|
-
inclusive = range(5, 10)
|
269
|
-
context "between #{inclusive} &" do
|
270
|
-
tests.each do |subject, result|
|
271
|
-
result = result.first
|
272
|
-
|
273
|
-
example subject do
|
274
|
-
expect(inclusive & subject).to eql(result)
|
275
|
-
end
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
exclusive = range(5, 10, true)
|
280
|
-
context "between #{exclusive} &" do
|
281
|
-
tests.each do |subject, result|
|
282
|
-
result = result.last
|
283
|
-
|
284
|
-
example subject do
|
285
|
-
expect(exclusive & subject).to eql(result)
|
286
|
-
end
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
context 'is commutative' do
|
291
|
-
tests.each do |subject, _|
|
292
|
-
example "between #{inclusive} & #{subject}" do
|
293
|
-
expect(inclusive & subject).to eql(subject & inclusive)
|
294
|
-
end
|
295
|
-
example "between #{exclusive} & #{subject}" do
|
296
|
-
expect(exclusive & subject).to eql(subject & exclusive)
|
297
|
-
end
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
it 'cannot intersect with non-VersionRanges' do
|
302
|
-
msg = "value must be a Semantic::VersionRange"
|
303
|
-
expect { inclusive.intersection(1..2) }.to raise_error(msg)
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
end
|