puppet 3.5.1-x86-mingw32 → 3.6.0.rc1-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.
- data/CONTRIBUTING.md +5 -0
- data/Gemfile +17 -9
- data/README.md +1 -0
- data/conf/fileserver.conf +4 -3
- data/ext/README.environment +8 -0
- data/ext/build_defaults.yaml +1 -1
- data/ext/debian/control +2 -2
- data/ext/debian/puppet-common.dirs +4 -0
- data/ext/debian/rules +4 -0
- data/ext/emacs/puppet-mode-init.el +1 -1
- data/ext/emacs/puppet-mode.el +36 -17
- data/ext/redhat/client.init +3 -3
- data/ext/redhat/puppet.spec.erb +9 -0
- data/ext/systemd/puppet.service +3 -4
- data/ext/systemd/puppetmaster.service +1 -3
- data/install.rb +1 -1
- data/lib/puppet.rb +2 -1
- data/lib/puppet/agent.rb +1 -1
- data/lib/puppet/application.rb +17 -17
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/configurer.rb +4 -1
- data/lib/puppet/configurer/downloader.rb +13 -12
- data/lib/puppet/configurer/plugin_handler.rb +3 -3
- data/lib/puppet/context.rb +6 -1
- data/lib/puppet/defaults.rb +82 -12
- data/lib/puppet/environments.rb +169 -13
- data/lib/puppet/external/nagios/grammar.ry +2 -0
- data/lib/puppet/external/nagios/parser.rb +28 -19
- data/lib/puppet/face/config.rb +19 -6
- data/lib/puppet/face/module/generate.rb +209 -7
- data/lib/puppet/face/module/install.rb +17 -16
- data/lib/puppet/face/module/list.rb +83 -82
- data/lib/puppet/face/module/search.rb +1 -1
- data/lib/puppet/face/module/upgrade.rb +10 -9
- data/lib/puppet/face/parser.rb +3 -2
- data/lib/puppet/face/plugin.rb +8 -4
- data/lib/puppet/file_bucket/dipper.rb +6 -3
- data/lib/puppet/file_bucket/file.rb +4 -2
- data/lib/puppet/file_serving/metadata.rb +1 -1
- data/lib/puppet/file_system/memory_file.rb +27 -1
- data/lib/puppet/file_system/memory_impl.rb +15 -1
- data/lib/puppet/forge.rb +148 -52
- data/lib/puppet/forge/cache.rb +5 -1
- data/lib/puppet/forge/errors.rb +10 -0
- data/lib/puppet/forge/repository.rb +61 -26
- data/lib/puppet/functions.rb +548 -0
- data/lib/puppet/functions/assert_type.rb +42 -0
- data/lib/puppet/functions/import.rb +7 -0
- data/lib/puppet/indirector/facts/facter.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +3 -2
- data/lib/puppet/indirector/rest.rb +18 -0
- data/lib/puppet/loaders.rb +20 -0
- data/lib/puppet/module.rb +2 -2
- data/lib/puppet/module_tool.rb +40 -14
- data/lib/puppet/module_tool/applications.rb +0 -1
- data/lib/puppet/module_tool/applications/application.rb +35 -26
- data/lib/puppet/module_tool/applications/builder.rb +16 -6
- data/lib/puppet/module_tool/applications/checksummer.rb +25 -19
- data/lib/puppet/module_tool/applications/installer.rb +196 -35
- data/lib/puppet/module_tool/applications/searcher.rb +1 -0
- data/lib/puppet/module_tool/applications/uninstaller.rb +7 -1
- data/lib/puppet/module_tool/applications/unpacker.rb +57 -31
- data/lib/puppet/module_tool/applications/upgrader.rb +221 -65
- data/lib/puppet/module_tool/checksums.rb +5 -8
- data/lib/puppet/module_tool/errors/installer.rb +12 -44
- data/lib/puppet/module_tool/errors/shared.rb +84 -11
- data/lib/puppet/module_tool/errors/upgrader.rb +16 -45
- data/lib/puppet/module_tool/install_directory.rb +7 -6
- data/lib/puppet/module_tool/installed_modules.rb +92 -0
- data/lib/puppet/module_tool/local_tarball.rb +91 -0
- data/lib/puppet/module_tool/metadata.rb +119 -115
- data/lib/puppet/module_tool/modulefile.rb +9 -9
- data/lib/puppet/module_tool/shared_behaviors.rb +19 -7
- data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +79 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/Rakefile +18 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/metadata.json.erb +1 -0
- data/lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb +7 -0
- data/lib/puppet/module_tool/tar.rb +3 -7
- data/lib/puppet/module_tool/tar/gnu.rb +21 -9
- data/lib/puppet/module_tool/tar/mini.rb +2 -8
- data/lib/puppet/network/http/api/v1.rb +1 -1
- data/lib/puppet/network/http/api/v2/authorization.rb +4 -2
- data/lib/puppet/network/http/issues.rb +1 -0
- data/lib/puppet/network/http_pool.rb +15 -6
- data/lib/puppet/node/environment.rb +91 -20
- data/lib/puppet/parser/ast/pops_bridge.rb +44 -3
- data/lib/puppet/parser/collector.rb +1 -1
- data/lib/puppet/parser/compiler.rb +50 -7
- data/lib/puppet/parser/functions.rb +6 -0
- data/lib/puppet/parser/functions/generate.rb +1 -1
- data/lib/puppet/parser/resource.rb +1 -1
- data/lib/puppet/pops.rb +22 -1
- data/lib/puppet/pops/adapters.rb +8 -1
- data/lib/puppet/pops/binder/bindings_composer.rb +1 -1
- data/lib/puppet/pops/binder/bindings_factory.rb +1 -1
- data/lib/puppet/pops/binder/config/binder_config_checker.rb +1 -1
- data/lib/puppet/pops/binder/producers.rb +2 -2
- data/lib/puppet/pops/evaluator/access_operator.rb +65 -25
- data/lib/puppet/pops/evaluator/callable_signature.rb +101 -0
- data/lib/puppet/pops/evaluator/closure.rb +57 -2
- data/lib/puppet/pops/evaluator/compare_operator.rb +1 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +9 -11
- data/lib/puppet/pops/evaluator/runtime3_support.rb +72 -21
- data/lib/puppet/pops/functions/dispatch.rb +71 -0
- data/lib/puppet/pops/functions/dispatcher.rb +237 -0
- data/lib/puppet/pops/functions/function.rb +77 -0
- data/lib/puppet/pops/issues.rb +12 -0
- data/lib/puppet/pops/loader/base_loader.rb +102 -0
- data/lib/puppet/pops/loader/dependency_loader.rb +60 -0
- data/lib/puppet/pops/loader/gem_support.rb +49 -0
- data/lib/puppet/pops/loader/loader.rb +180 -0
- data/lib/puppet/pops/loader/loader_paths.rb +137 -0
- data/lib/puppet/pops/loader/module_loaders.rb +242 -0
- data/lib/puppet/pops/loader/null_loader.rb +44 -0
- data/lib/puppet/pops/loader/ruby_function_instantiator.rb +34 -0
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +109 -0
- data/lib/puppet/pops/loader/simple_environment_loader.rb +20 -0
- data/lib/puppet/pops/loader/static_loader.rb +69 -0
- data/lib/puppet/pops/loader/uri_helper.rb +22 -0
- data/lib/puppet/pops/loaders.rb +240 -0
- data/lib/puppet/pops/model/factory.rb +13 -5
- data/lib/puppet/pops/model/model_tree_dumper.rb +12 -4
- data/lib/puppet/pops/parser/egrammar.ra +31 -18
- data/lib/puppet/pops/parser/eparser.rb +1137 -1106
- data/lib/puppet/pops/parser/lexer2.rb +17 -16
- data/lib/puppet/pops/semantic_error.rb +17 -0
- data/lib/puppet/pops/types/type_calculator.rb +150 -15
- data/lib/puppet/pops/types/type_factory.rb +69 -0
- data/lib/puppet/pops/types/type_parser.rb +9 -0
- data/lib/puppet/pops/types/types.rb +65 -4
- data/lib/puppet/pops/validation/checker4_0.rb +1 -1
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -1
- data/lib/puppet/property/list.rb +1 -1
- data/lib/puppet/provider/augeas/augeas.rb +2 -2
- data/lib/puppet/provider/cron/crontab.rb +13 -2
- data/lib/puppet/provider/package.rb +24 -0
- data/lib/puppet/provider/package/apt.rb +6 -1
- data/lib/puppet/provider/package/gem.rb +8 -2
- data/lib/puppet/provider/package/msi.rb +0 -15
- data/lib/puppet/provider/package/openbsd.rb +0 -24
- data/lib/puppet/provider/package/rpm.rb +3 -29
- data/lib/puppet/provider/package/windows.rb +0 -15
- data/lib/puppet/provider/package/yum.rb +101 -24
- data/lib/puppet/provider/package/yumhelper.py +31 -1
- data/lib/puppet/provider/package/zypper.rb +10 -28
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/init.rb +3 -0
- data/lib/puppet/provider/service/openbsd.rb +318 -0
- data/lib/puppet/provider/service/redhat.rb +6 -3
- data/lib/puppet/provider/service/systemd.rb +2 -2
- data/lib/puppet/provider/yumrepo/inifile.rb +115 -42
- data/lib/puppet/resource.rb +13 -9
- data/lib/puppet/resource/catalog.rb +12 -6
- data/lib/puppet/resource/type_collection.rb +3 -3
- data/lib/puppet/settings.rb +57 -36
- data/lib/puppet/settings/config_file.rb +5 -0
- data/lib/puppet/settings/environment_conf.rb +147 -0
- data/lib/puppet/settings/ttl_setting.rb +48 -0
- data/lib/puppet/ssl/certificate_authority.rb +2 -3
- data/lib/puppet/ssl/certificate_authority/autosign_command.rb +1 -1
- data/lib/puppet/ssl/certificate_request.rb +4 -4
- data/lib/puppet/ssl/validator/default_validator.rb +2 -2
- data/lib/puppet/status.rb +1 -1
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/type/augeas.rb +13 -1
- data/lib/puppet/type/cron.rb +32 -18
- data/lib/puppet/type/file.rb +4 -2
- data/lib/puppet/type/file/checksum.rb +15 -5
- data/lib/puppet/type/file/content.rb +3 -1
- data/lib/puppet/type/file/source.rb +5 -5
- data/lib/puppet/type/package.rb +12 -17
- data/lib/puppet/type/resources.rb +3 -1
- data/lib/puppet/type/scheduled_task.rb +4 -5
- data/lib/puppet/type/service.rb +12 -2
- data/lib/puppet/type/user.rb +106 -0
- data/lib/puppet/type/yumrepo.rb +9 -1
- data/lib/puppet/util/checksums.rb +60 -1
- data/lib/puppet/util/diff.rb +3 -1
- data/lib/puppet/util/execution.rb +20 -16
- data/lib/puppet/util/feature.rb +3 -0
- data/lib/puppet/util/logging.rb +19 -12
- data/lib/puppet/util/rubygems.rb +10 -0
- data/lib/puppet/util/watched_file.rb +1 -1
- data/lib/puppet/util/windows/security.rb +5 -3
- data/lib/puppet/vendor/load_semantic.rb +1 -0
- data/lib/puppet/vendor/require_vendored.rb +2 -0
- data/lib/puppet/vendor/semantic/Gemfile +20 -0
- data/lib/puppet/vendor/semantic/Rakefile +69 -0
- data/lib/puppet/vendor/semantic/lib/semantic.rb +7 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency.rb +181 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/graph.rb +60 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/graph_node.rb +117 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb +46 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/source.rb +25 -0
- data/lib/puppet/vendor/semantic/lib/semantic/dependency/unsatisfiable_graph.rb +31 -0
- data/lib/puppet/vendor/semantic/lib/semantic/version.rb +168 -0
- data/lib/puppet/vendor/semantic/lib/semantic/version_range.rb +424 -0
- data/lib/puppet/vendor/semantic/spec/spec_helper.rb +24 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_node_spec.rb +141 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_spec.rb +162 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/module_release_spec.rb +143 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/source_spec.rb +5 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/unsatisfiable_graph_spec.rb +44 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency_spec.rb +383 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/version_range_spec.rb +307 -0
- data/lib/puppet/vendor/semantic/spec/unit/semantic/version_spec.rb +608 -0
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/java.tgz +0 -0
- data/spec/fixtures/stdlib.tgz +0 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/usee/lib/puppet/functions/usee/callee.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/user/lib/puppet/functions/user/caller.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/user/metadata.json +9 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/modulea/rb_func_a.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/rb_func_a.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/manifests/init.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/metadata.json +19 -0
- data/spec/fixtures/unit/pops/loaders/loaders/wo_metadata_module/modules/moduleb/lib/puppet/functions/moduleb/rb_func_b.rb +6 -0
- data/spec/fixtures/unit/pops/loaders/loaders/wo_metadata_module/modules/moduleb/manifests/init.pp +3 -0
- data/spec/fixtures/unit/provider/naginator/define_empty_param +6 -0
- data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services +7 -0
- data/spec/fixtures/unit/type/user/authorized_keys +5 -0
- data/spec/integration/application/apply_spec.rb +1 -2
- data/spec/integration/configurer_spec.rb +2 -2
- data/spec/integration/faces/plugin_spec.rb +62 -0
- data/spec/integration/indirector/catalog/compiler_spec.rb +1 -1
- data/spec/integration/indirector/catalog/queue_spec.rb +1 -1
- data/spec/integration/node/environment_spec.rb +2 -2
- data/spec/integration/parser/future_compiler_spec.rb +96 -142
- data/spec/integration/parser/ruby_manifest_spec.rb +0 -5
- data/spec/integration/provider/cron/crontab_spec.rb +35 -0
- data/spec/integration/type/file_spec.rb +74 -72
- data/spec/integration/util/windows/security_spec.rb +17 -0
- data/spec/lib/matchers/resource.rb +45 -13
- data/spec/lib/puppet_spec/files.rb +18 -0
- data/spec/lib/puppet_spec/module_tool/shared_functions.rb +56 -0
- data/spec/lib/puppet_spec/module_tool/stub_source.rb +133 -0
- data/spec/shared_contexts/checksums.rb +55 -0
- data/spec/unit/application/apply_spec.rb +10 -7
- data/spec/unit/application/doc_spec.rb +17 -10
- data/spec/unit/application/indirection_base_spec.rb +18 -10
- data/spec/unit/application/inspect_spec.rb +22 -20
- data/spec/unit/configurer/downloader_spec.rb +7 -6
- data/spec/unit/configurer/plugin_handler_spec.rb +5 -8
- data/spec/unit/configurer_spec.rb +1 -1
- data/spec/unit/context_spec.rb +23 -0
- data/spec/unit/environments_spec.rb +274 -16
- data/spec/unit/face/config_spec.rb +111 -11
- data/spec/unit/face/module/install_spec.rb +14 -85
- data/spec/unit/face/module/list_spec.rb +108 -62
- data/spec/unit/face/module/search_spec.rb +1 -1
- data/spec/unit/face/module/uninstall_spec.rb +21 -42
- data/spec/unit/face/parser_spec.rb +5 -2
- data/spec/unit/file_bucket/dipper_spec.rb +92 -86
- data/spec/unit/file_bucket/file_spec.rb +23 -75
- data/spec/unit/file_serving/metadata_spec.rb +74 -74
- data/spec/unit/forge/module_release_spec.rb +131 -0
- data/spec/unit/forge/repository_spec.rb +21 -20
- data/spec/unit/forge_spec.rb +99 -23
- data/spec/unit/functions/assert_type_spec.rb +59 -0
- data/spec/unit/functions4_spec.rb +671 -0
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +2 -2
- data/spec/unit/indirector/facts/facter_spec.rb +9 -3
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +156 -155
- data/spec/unit/indirector/rest_spec.rb +8 -0
- data/spec/unit/interface/face_collection_spec.rb +35 -23
- data/spec/unit/module_spec.rb +20 -8
- data/spec/unit/module_tool/applications/builder_spec.rb +40 -12
- data/spec/unit/module_tool/applications/checksummer_spec.rb +86 -105
- data/spec/unit/module_tool/applications/installer_spec.rb +293 -261
- data/spec/unit/module_tool/applications/searcher_spec.rb +1 -1
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +90 -154
- data/spec/unit/module_tool/applications/unpacker_spec.rb +12 -12
- data/spec/unit/module_tool/applications/upgrader_spec.rb +286 -18
- data/spec/unit/module_tool/metadata_spec.rb +223 -14
- data/spec/unit/module_tool/tar/gnu_spec.rb +12 -9
- data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
- data/spec/unit/module_tool/tar_spec.rb +4 -18
- data/spec/unit/module_tool_spec.rb +123 -27
- data/spec/unit/network/formats_spec.rb +2 -2
- data/spec/unit/network/http_pool_spec.rb +21 -0
- data/spec/unit/network/rights_spec.rb +10 -8
- data/spec/unit/node/environment_spec.rb +27 -2
- data/spec/unit/parser/collector_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +1 -1
- data/spec/unit/parser/functions/generate_spec.rb +4 -0
- data/spec/unit/pops/evaluator/access_ops_spec.rb +50 -11
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +25 -0
- data/spec/unit/pops/loaders/dependency_loader_spec.rb +44 -0
- data/spec/unit/pops/loaders/loader_paths_spec.rb +66 -0
- data/spec/unit/pops/loaders/loaders_spec.rb +105 -0
- data/spec/unit/pops/loaders/module_loaders_spec.rb +119 -0
- data/spec/unit/pops/loaders/static_loader_spec.rb +46 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +145 -10
- data/spec/unit/pops/types/type_factory_spec.rb +101 -0
- data/spec/unit/pops/types/type_parser_spec.rb +22 -0
- data/spec/unit/property/list_spec.rb +9 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +58 -11
- data/spec/unit/provider/cron/crontab_spec.rb +1 -0
- data/spec/unit/provider/cron/parsed_spec.rb +15 -0
- data/spec/unit/provider/naginator_spec.rb +14 -0
- data/spec/unit/provider/package/apt_spec.rb +78 -64
- data/spec/unit/provider/package/gem_spec.rb +15 -0
- data/spec/unit/provider/package/rpm_spec.rb +6 -6
- data/spec/unit/provider/package/windows_spec.rb +1 -1
- data/spec/unit/provider/package/yum_spec.rb +199 -104
- data/spec/unit/provider/package/zypper_spec.rb +41 -15
- data/spec/unit/provider/service/openbsd_spec.rb +129 -22
- data/spec/unit/provider/service/redhat_spec.rb +18 -4
- data/spec/unit/provider/service/systemd_spec.rb +5 -9
- data/spec/unit/provider/service/upstart_spec.rb +1 -1
- data/spec/unit/provider/user/directoryservice_spec.rb +10 -0
- data/spec/unit/provider/yumrepo/inifile_spec.rb +171 -15
- data/spec/unit/resource/catalog_spec.rb +20 -104
- data/spec/unit/resource/type_collection_spec.rb +10 -9
- data/spec/unit/settings/config_file_spec.rb +29 -6
- data/spec/unit/settings/environment_conf_spec.rb +51 -0
- data/spec/unit/settings_spec.rb +97 -12
- data/spec/unit/ssl/certificate_authority_spec.rb +2 -0
- data/spec/unit/type/augeas_spec.rb +1 -1
- data/spec/unit/type/cron_spec.rb +6 -7
- data/spec/unit/type/file/checksum_spec.rb +6 -0
- data/spec/unit/type/file/content_spec.rb +277 -207
- data/spec/unit/type/file_spec.rb +9 -7
- data/spec/unit/type/user_spec.rb +106 -18
- data/spec/unit/type/yumrepo_spec.rb +8 -0
- data/spec/unit/util/checksums_spec.rb +12 -5
- data/spec/unit/util/diff_spec.rb +8 -0
- data/spec/unit/util/execution_spec.rb +4 -4
- data/spec/unit/util/feature_spec.rb +2 -0
- data/spec/unit/util/logging_spec.rb +14 -4
- data/spec/unit/util/rdoc/parser_spec.rb +5 -4
- data/spec/unit/util/rubygems_spec.rb +14 -0
- data/tasks/parallel.rake +2 -2
- metadata +154 -21
- checksums.yaml +0 -7
- data/lib/puppet/module_tool/applications/generator.rb +0 -142
- data/lib/puppet/module_tool/skeleton.rb +0 -37
- data/lib/puppet/module_tool/skeleton/templates/generator/Modulefile.erb +0 -11
- data/lib/puppet/module_tool/skeleton/templates/generator/README.erb +0 -16
- data/lib/puppet/module_tool/tar/solaris.rb +0 -5
- data/spec/fixtures/unit/provider/service/systemd/list_units_services +0 -17
- data/spec/unit/module_tool/tar/solaris_spec.rb +0 -22
@@ -2,23 +2,232 @@ require 'spec_helper'
|
|
2
2
|
require 'puppet/module_tool'
|
3
3
|
|
4
4
|
describe Puppet::ModuleTool::Metadata do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
let(:data) { {} }
|
6
|
+
let(:metadata) { Puppet::ModuleTool::Metadata.new }
|
7
|
+
|
8
|
+
describe "#update" do
|
9
|
+
subject { metadata.update(data) }
|
10
|
+
|
11
|
+
context "with a valid name" do
|
12
|
+
let(:data) { { 'name' => 'billgates-mymodule' } }
|
13
|
+
|
14
|
+
it "extracts the author name from the name field" do
|
15
|
+
subject.to_hash['author'].should == 'billgates'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "extracts a module name from the name field" do
|
19
|
+
subject.module_name.should == 'mymodule'
|
20
|
+
end
|
21
|
+
|
22
|
+
context "and existing author" do
|
23
|
+
before { metadata.update('author' => 'foo') }
|
24
|
+
|
25
|
+
it "avoids overwriting the existing author" do
|
26
|
+
subject.to_hash['author'].should == 'foo'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "with a valid name and author" do
|
32
|
+
let(:data) { { 'name' => 'billgates-mymodule', 'author' => 'foo' } }
|
33
|
+
|
34
|
+
it "use the author name from the author field" do
|
35
|
+
subject.to_hash['author'].should == 'foo'
|
36
|
+
end
|
37
|
+
|
38
|
+
context "and preexisting author" do
|
39
|
+
before { metadata.update('author' => 'bar') }
|
40
|
+
|
41
|
+
it "avoids overwriting the existing author" do
|
42
|
+
subject.to_hash['author'].should == 'foo'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "with an invalid name" do
|
48
|
+
context "(short module name)" do
|
49
|
+
let(:data) { { 'name' => 'mymodule' } }
|
50
|
+
|
51
|
+
it "raises an exception" do
|
52
|
+
expect { subject }.to raise_error(ArgumentError, "Invalid 'name' field in metadata.json: the field must be a namespaced module name")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "(missing namespace)" do
|
57
|
+
let(:data) { { 'name' => '/mymodule' } }
|
58
|
+
|
59
|
+
it "raises an exception" do
|
60
|
+
expect { subject }.to raise_error(ArgumentError, "Invalid 'name' field in metadata.json: the field must be a namespaced module name")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "(missing module name)" do
|
65
|
+
let(:data) { { 'name' => 'namespace/' } }
|
66
|
+
|
67
|
+
it "raises an exception" do
|
68
|
+
expect { subject }.to raise_error(ArgumentError, "Invalid 'name' field in metadata.json: the field must be a namespaced module name")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "(invalid namespace)" do
|
73
|
+
let(:data) { { 'name' => "dolla'bill$-mymodule" } }
|
74
|
+
|
75
|
+
it "raises an exception" do
|
76
|
+
expect { subject }.to raise_error(ArgumentError, "Invalid 'name' field in metadata.json: the namespace contains non-alphanumeric characters")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context "(non-alphanumeric module name)" do
|
81
|
+
let(:data) { { 'name' => "dollabils-fivedolla'" } }
|
82
|
+
|
83
|
+
it "raises an exception" do
|
84
|
+
expect { subject }.to raise_error(ArgumentError, "Invalid 'name' field in metadata.json: the module name contains non-alphanumeric (or underscore) characters")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context "(module name starts with a number)" do
|
89
|
+
let(:data) { { 'name' => "dollabills-5dollars" } }
|
90
|
+
|
91
|
+
it "raises an exception" do
|
92
|
+
expect { subject }.to raise_error(ArgumentError, "Invalid 'name' field in metadata.json: the module name must begin with a letter")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
context "with an invalid version" do
|
99
|
+
let(:data) { { 'version' => '3.0' } }
|
100
|
+
|
101
|
+
it "raises an exception" do
|
102
|
+
expect { subject }.to raise_error(ArgumentError, "Invalid 'version' field in metadata.json: version string cannot be parsed as a valid Semantic Version")
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context "with a valid source" do
|
107
|
+
context "which is a GitHub URL" do
|
108
|
+
context "with a scheme" do
|
109
|
+
before { metadata.update('source' => 'https://github.com/billgates/amazingness') }
|
110
|
+
|
111
|
+
it "predicts a default project_page" do
|
112
|
+
subject.to_hash['project_page'].should == 'https://github.com/billgates/amazingness'
|
113
|
+
end
|
114
|
+
|
115
|
+
it "predicts a default issues_url" do
|
116
|
+
subject.to_hash['issues_url'].should == 'https://github.com/billgates/amazingness/issues'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context "without a scheme" do
|
121
|
+
before { metadata.update('source' => 'github.com/billgates/amazingness') }
|
122
|
+
|
123
|
+
it "predicts a default project_page" do
|
124
|
+
subject.to_hash['project_page'].should == 'https://github.com/billgates/amazingness'
|
125
|
+
end
|
126
|
+
|
127
|
+
it "predicts a default issues_url" do
|
128
|
+
subject.to_hash['issues_url'].should == 'https://github.com/billgates/amazingness/issues'
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context "which is not a GitHub URL" do
|
134
|
+
before { metadata.update('source' => 'https://notgithub.com/billgates/amazingness') }
|
135
|
+
|
136
|
+
it "does not predict a default project_page" do
|
137
|
+
subject.to_hash['project_page'].should be nil
|
138
|
+
end
|
139
|
+
|
140
|
+
it "does not predict a default issues_url" do
|
141
|
+
subject.to_hash['issues_url'].should be nil
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context "which is not a URL" do
|
146
|
+
before { metadata.update('source' => 'my brain') }
|
147
|
+
|
148
|
+
it "does not predict a default project_page" do
|
149
|
+
subject.to_hash['project_page'].should be nil
|
150
|
+
end
|
151
|
+
|
152
|
+
it "does not predict a default issues_url" do
|
153
|
+
subject.to_hash['issues_url'].should be nil
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
160
|
+
|
161
|
+
describe '#dashed_name' do
|
162
|
+
it 'returns nil in the absence of a module name' do
|
163
|
+
expect(metadata.update('version' => '1.0.0').release_name).to be_nil
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'returns a hyphenated string containing namespace and module name' do
|
167
|
+
data = metadata.update('name' => 'foo-bar')
|
168
|
+
data.dashed_name.should == 'foo-bar'
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'properly handles slash-separated names' do
|
172
|
+
data = metadata.update('name' => 'foo/bar')
|
173
|
+
data.dashed_name.should == 'foo-bar'
|
174
|
+
end
|
175
|
+
|
176
|
+
it 'is unaffected by author name' do
|
177
|
+
data = metadata.update('name' => 'foo/bar', 'author' => 'me')
|
178
|
+
data.dashed_name.should == 'foo-bar'
|
9
179
|
end
|
10
180
|
end
|
11
181
|
|
12
|
-
describe
|
13
|
-
it '
|
14
|
-
metadata
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
182
|
+
describe '#release_name' do
|
183
|
+
it 'returns nil in the absence of a module name' do
|
184
|
+
expect(metadata.update('version' => '1.0.0').release_name).to be_nil
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'returns nil in the absence of a version' do
|
188
|
+
expect(metadata.update('name' => 'foo/bar').release_name).to be_nil
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'returns a hyphenated string containing module name and version' do
|
192
|
+
data = metadata.update('name' => 'foo/bar', 'version' => '1.0.0')
|
193
|
+
data.release_name.should == 'foo-bar-1.0.0'
|
194
|
+
end
|
195
|
+
|
196
|
+
it 'is unaffected by author name' do
|
197
|
+
data = metadata.update('name' => 'foo/bar', 'version' => '1.0.0', 'author' => 'me')
|
198
|
+
data.release_name.should == 'foo-bar-1.0.0'
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
describe "#to_hash" do
|
203
|
+
subject { metadata.to_hash }
|
204
|
+
|
205
|
+
its(:keys) do
|
206
|
+
subject.sort.should == %w[ name version author summary license source issues_url project_page dependencies ].sort
|
207
|
+
end
|
208
|
+
|
209
|
+
describe "['license']" do
|
210
|
+
it "defaults to Apache 2" do
|
211
|
+
subject['license'].should == "Apache 2.0"
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
describe "['dependencies']" do
|
216
|
+
it "defaults to an empty Array" do
|
217
|
+
subject['dependencies'].should == []
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
context "when updated with non-default data" do
|
222
|
+
subject { metadata.update('license' => 'MIT', 'non-standard' => 'yup').to_hash }
|
223
|
+
|
224
|
+
it "overrides the defaults" do
|
225
|
+
subject['license'].should == 'MIT'
|
226
|
+
end
|
227
|
+
|
228
|
+
it 'contains unanticipated values' do
|
229
|
+
subject['non-standard'].should == 'yup'
|
230
|
+
end
|
22
231
|
end
|
23
232
|
end
|
24
233
|
end
|
@@ -2,21 +2,24 @@ require 'spec_helper'
|
|
2
2
|
require 'puppet/module_tool'
|
3
3
|
|
4
4
|
describe Puppet::ModuleTool::Tar::Gnu do
|
5
|
-
let(:sourcefile) { '/the/module.tar.gz' }
|
6
|
-
let(:destdir) { '/the/dest/dir' }
|
7
|
-
let(:sourcedir) { '/the/src/dir' }
|
8
|
-
let(:destfile) { '/the/dest/file.tar.gz' }
|
5
|
+
let(:sourcefile) { '/space path/the/module.tar.gz' }
|
6
|
+
let(:destdir) { '/space path/the/dest/dir' }
|
7
|
+
let(:sourcedir) { '/space path/the/src/dir' }
|
8
|
+
let(:destfile) { '/space path/the/dest/file.tar.gz' }
|
9
9
|
|
10
10
|
it "unpacks a tar file" do
|
11
|
-
|
12
|
-
Puppet::Util::Execution.expects(:execute).with("
|
13
|
-
Puppet::Util::Execution.expects(:
|
14
|
-
Puppet::Util::Execution.expects(:execute).with("
|
11
|
+
Dir.expects(:chdir).with(File.expand_path(destdir)).yields(mock)
|
12
|
+
Puppet::Util::Execution.expects(:execute).with(["gzip", "-dc", File.expand_path(sourcefile)])
|
13
|
+
Puppet::Util::Execution.expects(:execpipe).with(["tar", "xof", "-"], true, 'w+')
|
14
|
+
Puppet::Util::Execution.expects(:execute).with(["find", File.expand_path(destdir), "-type", "d", "-exec", "chmod", "755", "{}", "+"])
|
15
|
+
Puppet::Util::Execution.expects(:execute).with(["find", File.expand_path(destdir), "-type", "f", "-exec", "chmod", "a-wst", "{}", "+"])
|
16
|
+
Puppet::Util::Execution.expects(:execute).with(["chown", "-R", "<owner:group>", File.expand_path(destdir)])
|
15
17
|
subject.unpack(sourcefile, destdir, '<owner:group>')
|
16
18
|
end
|
17
19
|
|
18
20
|
it "packs a tar file" do
|
19
|
-
Puppet::Util::Execution.expects(:execute).with("tar cf -
|
21
|
+
Puppet::Util::Execution.expects(:execute).with(["tar", "cf", "-", sourcedir])
|
22
|
+
Puppet::Util::Execution.expects(:execpipe).with(["gzip", "-c"], true, 'w+')
|
20
23
|
subject.pack(sourcedir, destfile)
|
21
24
|
end
|
22
25
|
end
|
@@ -6,7 +6,7 @@ describe Puppet::ModuleTool::Tar::Mini, :if => (Puppet.features.minitar? and Pup
|
|
6
6
|
let(:destdir) { File.expand_path '/the/dest/dir' }
|
7
7
|
let(:sourcedir) { '/the/src/dir' }
|
8
8
|
let(:destfile) { '/the/dest/file.tar.gz' }
|
9
|
-
let(:minitar) { described_class.new
|
9
|
+
let(:minitar) { described_class.new }
|
10
10
|
|
11
11
|
it "unpacks a tar file" do
|
12
12
|
unpacks_the_entry(:file_start, 'thefile')
|
@@ -1,28 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'puppet/module_tool'
|
2
|
+
require 'puppet/module_tool/tar'
|
3
3
|
|
4
4
|
describe Puppet::ModuleTool::Tar do
|
5
5
|
|
6
|
-
it "uses gtar when present on Solaris" do
|
7
|
-
Facter.stubs(:value).with('osfamily').returns 'Solaris'
|
8
|
-
Puppet::Util.stubs(:which).with('gtar').returns '/usr/bin/gtar'
|
9
|
-
|
10
|
-
described_class.instance(nil).should be_a_kind_of Puppet::ModuleTool::Tar::Solaris
|
11
|
-
end
|
12
|
-
|
13
|
-
it "uses gtar when present on OpenBSD" do
|
14
|
-
Facter.stubs(:value).with('osfamily').returns 'OpenBSD'
|
15
|
-
Puppet::Util.stubs(:which).with('gtar').returns '/usr/bin/gtar'
|
16
|
-
|
17
|
-
described_class.instance(nil).should be_a_kind_of Puppet::ModuleTool::Tar::Solaris
|
18
|
-
end
|
19
|
-
|
20
6
|
it "uses tar when present and not on Windows" do
|
21
7
|
Facter.stubs(:value).with('osfamily').returns 'ObscureLinuxDistro'
|
22
8
|
Puppet::Util.stubs(:which).with('tar').returns '/usr/bin/tar'
|
23
9
|
Puppet::Util::Platform.stubs(:windows?).returns false
|
24
10
|
|
25
|
-
described_class.instance
|
11
|
+
described_class.instance.should be_a_kind_of Puppet::ModuleTool::Tar::Gnu
|
26
12
|
end
|
27
13
|
|
28
14
|
it "falls back to minitar when it and zlib are present" do
|
@@ -31,7 +17,7 @@ describe Puppet::ModuleTool::Tar do
|
|
31
17
|
Puppet::Util::Platform.stubs(:windows?).returns true
|
32
18
|
Puppet.stubs(:features).returns(stub(:minitar? => true, :zlib? => true))
|
33
19
|
|
34
|
-
described_class.instance
|
20
|
+
described_class.instance.should be_a_kind_of Puppet::ModuleTool::Tar::Mini
|
35
21
|
end
|
36
22
|
|
37
23
|
it "fails when there is no possible implementation" do
|
@@ -40,6 +26,6 @@ describe Puppet::ModuleTool::Tar do
|
|
40
26
|
Puppet::Util::Platform.stubs(:windows?).returns true
|
41
27
|
Puppet.stubs(:features).returns(stub(:minitar? => false, :zlib? => false))
|
42
28
|
|
43
|
-
expect { described_class.instance
|
29
|
+
expect { described_class.instance }.to raise_error RuntimeError, /No suitable tar/
|
44
30
|
end
|
45
31
|
end
|
@@ -6,14 +6,25 @@ require 'puppet/module_tool'
|
|
6
6
|
|
7
7
|
describe Puppet::ModuleTool do
|
8
8
|
describe '.is_module_root?' do
|
9
|
-
it 'should return true if directory has a
|
9
|
+
it 'should return true if directory has a Modulefile file' do
|
10
|
+
FileTest.expects(:file?).with(responds_with(:to_s, '/a/b/c/metadata.json')).
|
11
|
+
returns(false)
|
10
12
|
FileTest.expects(:file?).with(responds_with(:to_s, '/a/b/c/Modulefile')).
|
11
13
|
returns(true)
|
12
14
|
|
13
15
|
subject.is_module_root?(Pathname.new('/a/b/c')).should be_true
|
14
16
|
end
|
15
17
|
|
16
|
-
it 'should return
|
18
|
+
it 'should return true if directory has a metadata.json file' do
|
19
|
+
FileTest.expects(:file?).with(responds_with(:to_s, '/a/b/c/metadata.json')).
|
20
|
+
returns(true)
|
21
|
+
|
22
|
+
subject.is_module_root?(Pathname.new('/a/b/c')).should be_true
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should return false if directory does not have a metadata.json or a Modulefile file' do
|
26
|
+
FileTest.expects(:file?).with(responds_with(:to_s, '/a/b/c/metadata.json')).
|
27
|
+
returns(false)
|
17
28
|
FileTest.expects(:file?).with(responds_with(:to_s, '/a/b/c/Modulefile')).
|
18
29
|
returns(false)
|
19
30
|
|
@@ -155,48 +166,133 @@ TREE
|
|
155
166
|
|
156
167
|
describe '.set_option_defaults' do
|
157
168
|
let(:options) { {} }
|
158
|
-
let(:modulepath) { [
|
159
|
-
let(:
|
160
|
-
|
161
|
-
|
169
|
+
let(:modulepath) { ['/env/module/path', '/global/module/path'] }
|
170
|
+
let(:environment_name) { :current_environment }
|
171
|
+
let(:environment) { Puppet::Node::Environment.create(environment_name, modulepath) }
|
172
|
+
|
173
|
+
subject do
|
174
|
+
described_class.set_option_defaults(options)
|
175
|
+
options
|
176
|
+
end
|
177
|
+
|
178
|
+
around do |example|
|
179
|
+
envs = Puppet::Environments::Combined.new(
|
180
|
+
Puppet::Environments::Static.new(environment),
|
181
|
+
Puppet::Environments::Legacy.new
|
182
|
+
)
|
183
|
+
|
184
|
+
Puppet.override(:environments => envs) do
|
162
185
|
example.run
|
163
186
|
end
|
164
187
|
end
|
165
188
|
|
166
|
-
describe '
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
189
|
+
describe ':environment' do
|
190
|
+
context 'as String' do
|
191
|
+
let(:options) { { :environment => "#{environment_name}" } }
|
192
|
+
|
193
|
+
it 'assigns the environment with the given name to :environment_instance' do
|
194
|
+
expect(subject).to include :environment_instance => environment
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
context 'as Symbol' do
|
199
|
+
let(:options) { { :environment => :"#{environment_name}" } }
|
200
|
+
|
201
|
+
it 'assigns the environment with the given name to :environment_instance' do
|
202
|
+
expect(subject).to include :environment_instance => environment
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
context 'as Puppet::Node::Environment' do
|
207
|
+
let(:env) { Puppet::Node::Environment.create('anonymous', []) }
|
208
|
+
let(:options) { { :environment => env } }
|
209
|
+
|
210
|
+
it 'assigns the given environment to :environment_instance' do
|
211
|
+
expect(subject).to include :environment_instance => env
|
212
|
+
end
|
171
213
|
end
|
172
214
|
end
|
173
215
|
|
174
|
-
describe '
|
175
|
-
let
|
216
|
+
describe ':modulepath' do
|
217
|
+
let(:options) do
|
218
|
+
{ :modulepath => %w[bar foo baz].join(File::PATH_SEPARATOR) }
|
219
|
+
end
|
176
220
|
|
177
|
-
|
178
|
-
let (:options) { {:target_dir => target_dir} }
|
221
|
+
let(:paths) { options[:modulepath].split(File::PATH_SEPARATOR).map { |dir| File.expand_path(dir) } }
|
179
222
|
|
180
|
-
|
181
|
-
|
223
|
+
it 'is expanded to an absolute path' do
|
224
|
+
expect(subject[:environment_instance].full_modulepath).to eql paths
|
225
|
+
end
|
182
226
|
|
183
|
-
|
184
|
-
|
227
|
+
it 'is used to compute :target_dir' do
|
228
|
+
expect(subject).to include :target_dir => paths.first
|
229
|
+
end
|
230
|
+
|
231
|
+
context 'conflicts with :environment' do
|
232
|
+
let(:options) do
|
233
|
+
{ :modulepath => %w[bar foo baz].join(File::PATH_SEPARATOR), :environment => environment_name }
|
185
234
|
end
|
186
235
|
|
187
|
-
it '
|
188
|
-
subject.
|
236
|
+
it 'replaces the modulepath of the :environment_instance' do
|
237
|
+
expect(subject[:environment_instance].full_modulepath).to eql paths
|
238
|
+
end
|
189
239
|
|
190
|
-
|
240
|
+
it 'is used to compute :target_dir' do
|
241
|
+
expect(subject).to include :target_dir => paths.first
|
191
242
|
end
|
192
243
|
end
|
244
|
+
end
|
245
|
+
|
246
|
+
describe ':target_dir' do
|
247
|
+
let(:options) do
|
248
|
+
{ :target_dir => 'foo' }
|
249
|
+
end
|
250
|
+
|
251
|
+
let(:target) { File.expand_path(options[:target_dir]) }
|
252
|
+
|
253
|
+
it 'is expanded to an absolute path' do
|
254
|
+
expect(subject).to include :target_dir => target
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'is prepended to the modulepath of the :environment_instance' do
|
258
|
+
expect(subject[:environment_instance].full_modulepath.first).to eql target
|
259
|
+
end
|
260
|
+
|
261
|
+
context 'conflicts with :modulepath' do
|
262
|
+
let(:options) do
|
263
|
+
{ :target_dir => 'foo', :modulepath => %w[bar foo baz].join(File::PATH_SEPARATOR) }
|
264
|
+
end
|
193
265
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
266
|
+
it 'is prepended to the modulepath of the :environment_instance' do
|
267
|
+
expect(subject[:environment_instance].full_modulepath.first).to eql target
|
268
|
+
end
|
269
|
+
|
270
|
+
it 'shares the provided :modulepath via the :environment_instance' do
|
271
|
+
paths = %w[foo] + options[:modulepath].split(File::PATH_SEPARATOR)
|
272
|
+
paths.map! { |dir| File.expand_path(dir) }
|
273
|
+
expect(subject[:environment_instance].full_modulepath).to eql paths
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
context 'conflicts with :environment' do
|
278
|
+
let(:options) do
|
279
|
+
{ :target_dir => 'foo', :environment => environment_name }
|
280
|
+
end
|
281
|
+
|
282
|
+
it 'is prepended to the modulepath of the :environment_instance' do
|
283
|
+
expect(subject[:environment_instance].full_modulepath.first).to eql target
|
284
|
+
end
|
285
|
+
|
286
|
+
it 'shares the provided :modulepath via the :environment_instance' do
|
287
|
+
paths = %w[foo] + environment.full_modulepath
|
288
|
+
paths.map! { |dir| File.expand_path(dir) }
|
289
|
+
expect(subject[:environment_instance].full_modulepath).to eql paths
|
290
|
+
end
|
291
|
+
end
|
198
292
|
|
199
|
-
|
293
|
+
context 'when not passed' do
|
294
|
+
it 'is populated with the first component of the modulepath' do
|
295
|
+
expect(subject).to include :target_dir => subject[:environment_instance].full_modulepath.first
|
200
296
|
end
|
201
297
|
end
|
202
298
|
end
|