inspec 4.18.51 → 4.18.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/inspec.gemspec +15 -37
- data/lib/resource_support/aws/aws_resource_mixin.rb +1 -1
- metadata +22 -709
- data/Gemfile +0 -61
- data/LICENSE +0 -14
- data/README.md +0 -474
- data/etc/deprecations.json +0 -125
- data/etc/plugin_filters.json +0 -45
- data/lib/bundles/README.md +0 -3
- data/lib/bundles/inspec-compliance/api.rb +0 -7
- data/lib/bundles/inspec-compliance/configuration.rb +0 -7
- data/lib/bundles/inspec-compliance/http.rb +0 -7
- data/lib/bundles/inspec-compliance/support.rb +0 -7
- data/lib/bundles/inspec-compliance/target.rb +0 -7
- data/lib/bundles/inspec-supermarket.rb +0 -9
- data/lib/bundles/inspec-supermarket/README.md +0 -45
- data/lib/bundles/inspec-supermarket/api.rb +0 -87
- data/lib/bundles/inspec-supermarket/cli.rb +0 -71
- data/lib/bundles/inspec-supermarket/target.rb +0 -31
- data/lib/inspec.rb +0 -30
- data/lib/inspec/archive/tar.rb +0 -25
- data/lib/inspec/archive/zip.rb +0 -15
- data/lib/inspec/backend.rb +0 -101
- data/lib/inspec/base_cli.rb +0 -318
- data/lib/inspec/cached_fetcher.rb +0 -65
- data/lib/inspec/cli.rb +0 -469
- data/lib/inspec/completions/bash.sh.erb +0 -45
- data/lib/inspec/completions/fish.sh.erb +0 -34
- data/lib/inspec/completions/zsh.sh.erb +0 -61
- data/lib/inspec/config.rb +0 -511
- data/lib/inspec/control_eval_context.rb +0 -248
- data/lib/inspec/dependencies/cache.rb +0 -74
- data/lib/inspec/dependencies/dependency_set.rb +0 -93
- data/lib/inspec/dependencies/lockfile.rb +0 -115
- data/lib/inspec/dependencies/requirement.rb +0 -135
- data/lib/inspec/dependencies/resolver.rb +0 -86
- data/lib/inspec/describe_base.rb +0 -53
- data/lib/inspec/dist.rb +0 -20
- data/lib/inspec/dsl.rb +0 -115
- data/lib/inspec/dsl_shared.rb +0 -32
- data/lib/inspec/env_printer.rb +0 -156
- data/lib/inspec/errors.rb +0 -18
- data/lib/inspec/exceptions.rb +0 -11
- data/lib/inspec/expect.rb +0 -42
- data/lib/inspec/fetcher.rb +0 -48
- data/lib/inspec/fetcher/git.rb +0 -211
- data/lib/inspec/fetcher/local.rb +0 -116
- data/lib/inspec/fetcher/mock.rb +0 -34
- data/lib/inspec/fetcher/url.rb +0 -281
- data/lib/inspec/file_provider.rb +0 -318
- data/lib/inspec/formatters.rb +0 -3
- data/lib/inspec/formatters/base.rb +0 -269
- data/lib/inspec/formatters/json_rspec.rb +0 -20
- data/lib/inspec/formatters/show_progress.rb +0 -12
- data/lib/inspec/globals.rb +0 -9
- data/lib/inspec/impact.rb +0 -36
- data/lib/inspec/input.rb +0 -421
- data/lib/inspec/input_dsl_helpers.rb +0 -26
- data/lib/inspec/input_registry.rb +0 -315
- data/lib/inspec/library_eval_context.rb +0 -55
- data/lib/inspec/log.rb +0 -7
- data/lib/inspec/metadata.rb +0 -253
- data/lib/inspec/method_source.rb +0 -20
- data/lib/inspec/objects.rb +0 -14
- data/lib/inspec/objects/control.rb +0 -85
- data/lib/inspec/objects/describe.rb +0 -106
- data/lib/inspec/objects/each_loop.rb +0 -41
- data/lib/inspec/objects/input.rb +0 -49
- data/lib/inspec/objects/list.rb +0 -15
- data/lib/inspec/objects/or_test.rb +0 -45
- data/lib/inspec/objects/ruby_helper.rb +0 -13
- data/lib/inspec/objects/tag.rb +0 -32
- data/lib/inspec/objects/test.rb +0 -94
- data/lib/inspec/objects/value.rb +0 -32
- data/lib/inspec/plugin/v1.rb +0 -2
- data/lib/inspec/plugin/v1/plugin_types/cli.rb +0 -22
- data/lib/inspec/plugin/v1/plugin_types/fetcher.rb +0 -83
- data/lib/inspec/plugin/v1/plugin_types/resource.rb +0 -176
- data/lib/inspec/plugin/v1/plugin_types/secret.rb +0 -11
- data/lib/inspec/plugin/v1/plugin_types/source_reader.rb +0 -36
- data/lib/inspec/plugin/v1/plugins.rb +0 -59
- data/lib/inspec/plugin/v1/registry.rb +0 -90
- data/lib/inspec/plugin/v2.rb +0 -46
- data/lib/inspec/plugin/v2/activator.rb +0 -40
- data/lib/inspec/plugin/v2/config_file.rb +0 -151
- data/lib/inspec/plugin/v2/filter.rb +0 -96
- data/lib/inspec/plugin/v2/installer.rb +0 -512
- data/lib/inspec/plugin/v2/loader.rb +0 -321
- data/lib/inspec/plugin/v2/plugin_base.rb +0 -112
- data/lib/inspec/plugin/v2/plugin_types/cli.rb +0 -49
- data/lib/inspec/plugin/v2/plugin_types/dsl.rb +0 -11
- data/lib/inspec/plugin/v2/plugin_types/input.rb +0 -34
- data/lib/inspec/plugin/v2/plugin_types/mock.rb +0 -12
- data/lib/inspec/plugin/v2/registry.rb +0 -98
- data/lib/inspec/plugin/v2/status.rb +0 -29
- data/lib/inspec/profile.rb +0 -658
- data/lib/inspec/profile_context.rb +0 -203
- data/lib/inspec/profile_vendor.rb +0 -84
- data/lib/inspec/reporters.rb +0 -73
- data/lib/inspec/reporters/automate.rb +0 -78
- data/lib/inspec/reporters/base.rb +0 -25
- data/lib/inspec/reporters/cli.rb +0 -370
- data/lib/inspec/reporters/json.rb +0 -113
- data/lib/inspec/reporters/json_automate.rb +0 -80
- data/lib/inspec/reporters/json_min.rb +0 -48
- data/lib/inspec/reporters/junit.rb +0 -77
- data/lib/inspec/reporters/yaml.rb +0 -20
- data/lib/inspec/require_loader.rb +0 -29
- data/lib/inspec/resource.rb +0 -114
- data/lib/inspec/resources.rb +0 -130
- data/lib/inspec/resources/aide_conf.rb +0 -153
- data/lib/inspec/resources/apache.rb +0 -47
- data/lib/inspec/resources/apache_conf.rb +0 -156
- data/lib/inspec/resources/apt.rb +0 -151
- data/lib/inspec/resources/audit_policy.rb +0 -64
- data/lib/inspec/resources/auditd.rb +0 -251
- data/lib/inspec/resources/auditd_conf.rb +0 -45
- data/lib/inspec/resources/bash.rb +0 -33
- data/lib/inspec/resources/bond.rb +0 -70
- data/lib/inspec/resources/bridge.rb +0 -125
- data/lib/inspec/resources/bsd_service.rb +0 -2
- data/lib/inspec/resources/chocolatey_package.rb +0 -82
- data/lib/inspec/resources/command.rb +0 -91
- data/lib/inspec/resources/cpan.rb +0 -58
- data/lib/inspec/resources/cran.rb +0 -64
- data/lib/inspec/resources/crontab.rb +0 -173
- data/lib/inspec/resources/csv.rb +0 -56
- data/lib/inspec/resources/dh_params.rb +0 -83
- data/lib/inspec/resources/directory.rb +0 -23
- data/lib/inspec/resources/docker.rb +0 -274
- data/lib/inspec/resources/docker_container.rb +0 -91
- data/lib/inspec/resources/docker_image.rb +0 -84
- data/lib/inspec/resources/docker_object.rb +0 -52
- data/lib/inspec/resources/docker_plugin.rb +0 -64
- data/lib/inspec/resources/docker_service.rb +0 -91
- data/lib/inspec/resources/elasticsearch.rb +0 -165
- data/lib/inspec/resources/etc_fstab.rb +0 -96
- data/lib/inspec/resources/etc_group.rb +0 -157
- data/lib/inspec/resources/etc_hosts.rb +0 -68
- data/lib/inspec/resources/etc_hosts_allow.rb +0 -2
- data/lib/inspec/resources/etc_hosts_allow_deny.rb +0 -114
- data/lib/inspec/resources/etc_hosts_deny.rb +0 -2
- data/lib/inspec/resources/file.rb +0 -339
- data/lib/inspec/resources/filesystem.rb +0 -139
- data/lib/inspec/resources/firewalld.rb +0 -148
- data/lib/inspec/resources/gem.rb +0 -80
- data/lib/inspec/resources/group.rb +0 -2
- data/lib/inspec/resources/groups.rb +0 -241
- data/lib/inspec/resources/grub_conf.rb +0 -230
- data/lib/inspec/resources/host.rb +0 -310
- data/lib/inspec/resources/http.rb +0 -275
- data/lib/inspec/resources/iis_app.rb +0 -101
- data/lib/inspec/resources/iis_app_pool.rb +0 -127
- data/lib/inspec/resources/iis_site.rb +0 -148
- data/lib/inspec/resources/iis_website.rb +0 -2
- data/lib/inspec/resources/inetd_conf.rb +0 -53
- data/lib/inspec/resources/ini.rb +0 -28
- data/lib/inspec/resources/interface.rb +0 -204
- data/lib/inspec/resources/ip6tables.rb +0 -79
- data/lib/inspec/resources/iptables.rb +0 -80
- data/lib/inspec/resources/json.rb +0 -116
- data/lib/inspec/resources/kernel_module.rb +0 -106
- data/lib/inspec/resources/kernel_parameter.rb +0 -54
- data/lib/inspec/resources/key_rsa.rb +0 -66
- data/lib/inspec/resources/ksh.rb +0 -33
- data/lib/inspec/resources/launchd_service.rb +0 -2
- data/lib/inspec/resources/limits_conf.rb +0 -45
- data/lib/inspec/resources/linux_kernel_parameter.rb +0 -2
- data/lib/inspec/resources/login_defs.rb +0 -56
- data/lib/inspec/resources/mount.rb +0 -88
- data/lib/inspec/resources/mssql_session.rb +0 -117
- data/lib/inspec/resources/mysql.rb +0 -81
- data/lib/inspec/resources/mysql_conf.rb +0 -128
- data/lib/inspec/resources/mysql_session.rb +0 -88
- data/lib/inspec/resources/nginx.rb +0 -96
- data/lib/inspec/resources/nginx_conf.rb +0 -232
- data/lib/inspec/resources/noop.rb +0 -9
- data/lib/inspec/resources/npm.rb +0 -68
- data/lib/inspec/resources/ntp_conf.rb +0 -51
- data/lib/inspec/resources/oneget.rb +0 -71
- data/lib/inspec/resources/oracledb_session.rb +0 -149
- data/lib/inspec/resources/os.rb +0 -34
- data/lib/inspec/resources/os_env.rb +0 -86
- data/lib/inspec/resources/package.rb +0 -391
- data/lib/inspec/resources/packages.rb +0 -111
- data/lib/inspec/resources/parse_config.rb +0 -112
- data/lib/inspec/resources/parse_config_file.rb +0 -2
- data/lib/inspec/resources/passwd.rb +0 -73
- data/lib/inspec/resources/pip.rb +0 -132
- data/lib/inspec/resources/platform.rb +0 -112
- data/lib/inspec/resources/port.rb +0 -791
- data/lib/inspec/resources/postfix_conf.rb +0 -35
- data/lib/inspec/resources/postgres.rb +0 -152
- data/lib/inspec/resources/postgres_conf.rb +0 -116
- data/lib/inspec/resources/postgres_hba_conf.rb +0 -86
- data/lib/inspec/resources/postgres_ident_conf.rb +0 -75
- data/lib/inspec/resources/postgres_session.rb +0 -70
- data/lib/inspec/resources/powershell.rb +0 -67
- data/lib/inspec/resources/ppa.rb +0 -2
- data/lib/inspec/resources/processes.rb +0 -219
- data/lib/inspec/resources/rabbitmq_conf.rb +0 -2
- data/lib/inspec/resources/rabbitmq_config.rb +0 -52
- data/lib/inspec/resources/registry_key.rb +0 -296
- data/lib/inspec/resources/runit_service.rb +0 -2
- data/lib/inspec/resources/script.rb +0 -1
- data/lib/inspec/resources/security_identifier.rb +0 -91
- data/lib/inspec/resources/security_policy.rb +0 -182
- data/lib/inspec/resources/service.rb +0 -820
- data/lib/inspec/resources/shadow.rb +0 -150
- data/lib/inspec/resources/ssh_config.rb +0 -98
- data/lib/inspec/resources/sshd_config.rb +0 -2
- data/lib/inspec/resources/ssl.rb +0 -99
- data/lib/inspec/resources/sys_info.rb +0 -119
- data/lib/inspec/resources/systemd_service.rb +0 -2
- data/lib/inspec/resources/sysv_service.rb +0 -2
- data/lib/inspec/resources/toml.rb +0 -30
- data/lib/inspec/resources/upstart_service.rb +0 -2
- data/lib/inspec/resources/user.rb +0 -1
- data/lib/inspec/resources/users.rb +0 -742
- data/lib/inspec/resources/vbscript.rb +0 -67
- data/lib/inspec/resources/virtualization.rb +0 -255
- data/lib/inspec/resources/windows_feature.rb +0 -126
- data/lib/inspec/resources/windows_hotfix.rb +0 -37
- data/lib/inspec/resources/windows_registry_key.rb +0 -2
- data/lib/inspec/resources/windows_task.rb +0 -112
- data/lib/inspec/resources/wmi.rb +0 -109
- data/lib/inspec/resources/x509_certificate.rb +0 -143
- data/lib/inspec/resources/xinetd_conf.rb +0 -103
- data/lib/inspec/resources/xml.rb +0 -48
- data/lib/inspec/resources/yaml.rb +0 -42
- data/lib/inspec/resources/yum.rb +0 -162
- data/lib/inspec/resources/zfs_dataset.rb +0 -62
- data/lib/inspec/resources/zfs_pool.rb +0 -50
- data/lib/inspec/rspec_extensions.rb +0 -116
- data/lib/inspec/rule.rb +0 -389
- data/lib/inspec/runner.rb +0 -333
- data/lib/inspec/runner_mock.rb +0 -37
- data/lib/inspec/runner_rspec.rb +0 -184
- data/lib/inspec/runtime_profile.rb +0 -23
- data/lib/inspec/schema.rb +0 -245
- data/lib/inspec/secrets.rb +0 -15
- data/lib/inspec/secrets/yaml.rb +0 -29
- data/lib/inspec/shell.rb +0 -211
- data/lib/inspec/shell_detector.rb +0 -89
- data/lib/inspec/source_reader.rb +0 -26
- data/lib/inspec/ui.rb +0 -213
- data/lib/inspec/ui_table_helper.rb +0 -12
- data/lib/inspec/utils/command_wrapper.rb +0 -23
- data/lib/inspec/utils/convert.rb +0 -8
- data/lib/inspec/utils/database_helpers.rb +0 -75
- data/lib/inspec/utils/deprecation.rb +0 -6
- data/lib/inspec/utils/deprecation/config_file.rb +0 -109
- data/lib/inspec/utils/deprecation/deprecator.rb +0 -118
- data/lib/inspec/utils/deprecation/errors.rb +0 -14
- data/lib/inspec/utils/deprecation/global_method.rb +0 -9
- data/lib/inspec/utils/enumerable_delegation.rb +0 -7
- data/lib/inspec/utils/erlang_parser.rb +0 -190
- data/lib/inspec/utils/file_reader.rb +0 -24
- data/lib/inspec/utils/filter.rb +0 -461
- data/lib/inspec/utils/filter_array.rb +0 -25
- data/lib/inspec/utils/find_files.rb +0 -44
- data/lib/inspec/utils/hash.rb +0 -37
- data/lib/inspec/utils/json_log.rb +0 -15
- data/lib/inspec/utils/modulator.rb +0 -9
- data/lib/inspec/utils/nginx_parser.rb +0 -101
- data/lib/inspec/utils/object_traversal.rb +0 -47
- data/lib/inspec/utils/parser.rb +0 -277
- data/lib/inspec/utils/pkey_reader.rb +0 -17
- data/lib/inspec/utils/simpleconfig.rb +0 -121
- data/lib/inspec/utils/spdx.rb +0 -10
- data/lib/inspec/utils/spdx.txt +0 -383
- data/lib/inspec/utils/telemetry.rb +0 -3
- data/lib/inspec/utils/telemetry/collector.rb +0 -81
- data/lib/inspec/utils/telemetry/data_series.rb +0 -44
- data/lib/inspec/utils/telemetry/global_methods.rb +0 -22
- data/lib/inspec/version.rb +0 -3
- data/lib/matchers/matchers.rb +0 -341
- data/lib/plugins/README.md +0 -16
- data/lib/plugins/inspec-artifact/lib/inspec-artifact.rb +0 -12
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +0 -170
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb +0 -116
- data/lib/plugins/inspec-artifact/test/functional/inspec_artifact_test.rb +0 -50
- data/lib/plugins/inspec-compliance/README.md +0 -207
- data/lib/plugins/inspec-compliance/lib/inspec-compliance.rb +0 -12
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +0 -362
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb +0 -198
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +0 -269
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/configuration.rb +0 -103
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/http.rb +0 -117
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/images/cc-token.png +0 -0
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb +0 -34
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb +0 -146
- data/lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb +0 -53
- data/lib/plugins/inspec-compliance/test/integration/default/cli.rb +0 -91
- data/lib/plugins/inspec-compliance/test/unit/api/login_test.rb +0 -190
- data/lib/plugins/inspec-compliance/test/unit/api_test.rb +0 -386
- data/lib/plugins/inspec-compliance/test/unit/target_test.rb +0 -155
- data/lib/plugins/inspec-habitat/Berksfile +0 -5
- data/lib/plugins/inspec-habitat/README.md +0 -150
- data/lib/plugins/inspec-habitat/kitchen.yml +0 -28
- data/lib/plugins/inspec-habitat/lib/inspec-habitat.rb +0 -11
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +0 -41
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +0 -265
- data/lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb +0 -6
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/Berksfile +0 -2
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/files/hab_setup.exp +0 -28
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/metadata.rb +0 -9
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/recipes/default.rb +0 -61
- data/lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb +0 -34
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb +0 -40
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/inspec.yml +0 -10
- data/lib/plugins/inspec-habitat/test/support/example_profile/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/support/example_profile/controls/example.rb +0 -7
- data/lib/plugins/inspec-habitat/test/support/example_profile/inspec.yml +0 -10
- data/lib/plugins/inspec-habitat/test/unit/profile_test.rb +0 -242
- data/lib/plugins/inspec-init/README.md +0 -31
- data/lib/plugins/inspec-init/lib/inspec-init.rb +0 -12
- data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +0 -15
- data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +0 -243
- data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +0 -47
- data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +0 -97
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Gemfile +0 -11
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/LICENSE +0 -2
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/README.md +0 -28
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Rakefile +0 -40
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template.rb +0 -14
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/cli_command.rb +0 -62
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/plugin.rb +0 -53
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/version.rb +0 -8
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/fixtures/README.md +0 -24
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/README.md +0 -12
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/inspec_plugin_template_test.rb +0 -110
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/helper.rb +0 -24
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/README.md +0 -17
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/cli_args_test.rb +0 -67
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/plugin_def_test.rb +0 -51
- data/lib/plugins/inspec-init/templates/profiles/aws/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/azure/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/gcp/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/os/README.md +0 -3
- data/lib/plugins/inspec-init/templates/profiles/os/controls/example.rb +0 -18
- data/lib/plugins/inspec-init/templates/profiles/os/inspec.yml +0 -10
- data/lib/plugins/inspec-init/templates/profiles/os/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/test/functional/inspec_init_plugin_test.rb +0 -184
- data/lib/plugins/inspec-init/test/functional/inspec_init_profile_test.rb +0 -121
- data/lib/plugins/inspec-plugin-manager-cli/README.md +0 -6
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb +0 -17
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +0 -518
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb +0 -12
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/config_dirs/empty/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette.rb +0 -2
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-wrong-structure/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name.rb +0 -1
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/help_test.rb +0 -23
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/helper.rb +0 -62
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/install_test.rb +0 -368
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/list_test.rb +0 -101
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/search_test.rb +0 -129
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/uninstall_test.rb +0 -63
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/update_test.rb +0 -84
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +0 -77
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb +0 -39
- data/lib/plugins/shared/core_plugin_test_helper.rb +0 -153
- data/lib/plugins/things-for-train-integration.rb +0 -14
- data/lib/source_readers/flat.rb +0 -36
- data/lib/source_readers/inspec.rb +0 -66
@@ -1,248 +0,0 @@
|
|
1
|
-
require "inspec/dsl"
|
2
|
-
require "inspec/dsl_shared"
|
3
|
-
require "rspec/core/dsl"
|
4
|
-
|
5
|
-
module Inspec
|
6
|
-
#
|
7
|
-
# ControlEvalContext constructs an anonymous class that control
|
8
|
-
# files will be instance_exec'd against.
|
9
|
-
#
|
10
|
-
# The anonymous class includes the given passed resource_dsl as well
|
11
|
-
# as the basic DSL of the control files (describe, control, title,
|
12
|
-
# etc).
|
13
|
-
#
|
14
|
-
class ControlEvalContext
|
15
|
-
# Create the context for controls. This includes all components of the DSL,
|
16
|
-
# including matchers and resources.
|
17
|
-
#
|
18
|
-
# @param [ResourcesDSL] resources_dsl which has all resources to attach
|
19
|
-
# @return [RuleContext] the inner context of rules
|
20
|
-
def self.rule_context(resources_dsl, profile_id)
|
21
|
-
Class.new(Inspec::Rule) do
|
22
|
-
include RSpec::Core::DSL
|
23
|
-
with_resource_dsl resources_dsl
|
24
|
-
|
25
|
-
# allow attributes to be accessed within control blocks
|
26
|
-
define_method :input do |input_name, options = {}|
|
27
|
-
if options.empty?
|
28
|
-
# Simply an access, no event here
|
29
|
-
Inspec::InputRegistry.find_or_register_input(input_name, profile_id).value
|
30
|
-
else
|
31
|
-
options[:priority] ||= 20
|
32
|
-
options[:provider] = :inline_control_code
|
33
|
-
evt = Inspec::Input.infer_event(options)
|
34
|
-
Inspec::InputRegistry.find_or_register_input(input_name, profile_id, event: evt).value
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Find the Input object, but don't collapse to a value.
|
39
|
-
# Will return nil on a miss.
|
40
|
-
define_method :input_object do |input_name|
|
41
|
-
Inspec::InputRegistry.find_or_register_input(input_name, profile_id)
|
42
|
-
end
|
43
|
-
|
44
|
-
define_method :attribute do |name, options = {}|
|
45
|
-
Inspec.deprecate(:attrs_dsl, "Input name: #{name}, Profile: #{profile_id}")
|
46
|
-
input(name, options)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Support for Control DSL plugins.
|
50
|
-
# This is called when an unknown method is encountered
|
51
|
-
# within a control block.
|
52
|
-
def method_missing(method_name, *arguments, &block)
|
53
|
-
# Check to see if there is a control_dsl plugin activator hook with the method name
|
54
|
-
registry = Inspec::Plugin::V2::Registry.instance
|
55
|
-
hook = registry.find_activators(plugin_type: :control_dsl, activator_name: method_name).first
|
56
|
-
if hook
|
57
|
-
# OK, load the hook if it hasn't been already. We'll then know a module,
|
58
|
-
# which we can then inject into the context
|
59
|
-
hook.activate
|
60
|
-
|
61
|
-
# Inject the module's methods into the context.
|
62
|
-
# implementation_class is the field name, but this is actually a module.
|
63
|
-
self.class.include(hook.implementation_class)
|
64
|
-
# Now that the module is loaded, it defined one or more methods
|
65
|
-
# (presumably the one we were looking for.)
|
66
|
-
# We still haven't called it, so do so now.
|
67
|
-
send(method_name, *arguments, &block)
|
68
|
-
else
|
69
|
-
begin
|
70
|
-
Inspec::DSL.method_missing_resource(inspec, method_name, *arguments)
|
71
|
-
rescue LoadError
|
72
|
-
super
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
# Creates the heart of the control eval context:
|
81
|
-
#
|
82
|
-
# An instantiated object which has all resources registered to it
|
83
|
-
# and exposes them to the a test file.
|
84
|
-
#
|
85
|
-
# @param profile_context [Inspec::ProfileContext]
|
86
|
-
# @param outer_dsl [OuterDSLClass]
|
87
|
-
# @return [ProfileContextClass]
|
88
|
-
def self.create(profile_context, resources_dsl) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
89
|
-
profile_context_owner = profile_context
|
90
|
-
profile_id = profile_context.profile_id
|
91
|
-
rule_class = rule_context(resources_dsl, profile_id)
|
92
|
-
Class.new do # rubocop:disable Metrics/BlockLength
|
93
|
-
include Inspec::DSL
|
94
|
-
include Inspec::DSL::RequireOverride
|
95
|
-
include resources_dsl
|
96
|
-
|
97
|
-
attr_accessor :skip_file
|
98
|
-
|
99
|
-
def initialize(backend, conf, dependencies, require_loader, skip_only_if_eval)
|
100
|
-
@backend = backend
|
101
|
-
@conf = conf
|
102
|
-
@dependencies = dependencies
|
103
|
-
@require_loader = require_loader
|
104
|
-
@skip_file_message = nil
|
105
|
-
@skip_file = false
|
106
|
-
@skip_only_if_eval = skip_only_if_eval
|
107
|
-
end
|
108
|
-
|
109
|
-
define_method :title do |arg|
|
110
|
-
profile_context_owner.set_header(:title, arg)
|
111
|
-
end
|
112
|
-
|
113
|
-
def to_s
|
114
|
-
"Control Evaluation Context (#{profile_name})"
|
115
|
-
end
|
116
|
-
|
117
|
-
define_method :profile_name do
|
118
|
-
profile_id
|
119
|
-
end
|
120
|
-
|
121
|
-
define_method :control do |*args, &block|
|
122
|
-
id = args[0]
|
123
|
-
opts = args[1] || {}
|
124
|
-
opts[:skip_only_if_eval] = @skip_only_if_eval
|
125
|
-
register_control(rule_class.new(id, profile_id, opts, &block))
|
126
|
-
end
|
127
|
-
|
128
|
-
#
|
129
|
-
# Describe allows users to write rspec-like bare describe
|
130
|
-
# blocks without declaring an inclosing control. Here, we
|
131
|
-
# generate a control for them automatically and then execute
|
132
|
-
# the describe block in the context of that control.
|
133
|
-
#
|
134
|
-
define_method :describe do |*args, &block|
|
135
|
-
loc = block_location(block, caller(1..1).first)
|
136
|
-
id = "(generated from #{loc} #{SecureRandom.hex})"
|
137
|
-
|
138
|
-
res = nil
|
139
|
-
rule = rule_class.new(id, profile_id, {}) do
|
140
|
-
res = describe(*args, &block)
|
141
|
-
end
|
142
|
-
register_control(rule, &block)
|
143
|
-
|
144
|
-
res
|
145
|
-
end
|
146
|
-
|
147
|
-
define_method :add_resource do |name, new_res|
|
148
|
-
resources_dsl.module_exec do
|
149
|
-
define_method name.to_sym do |*args|
|
150
|
-
new_res.new(@backend, name.to_s, *args)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
define_method :add_resources do |context|
|
156
|
-
self.class.class_eval do
|
157
|
-
include context.to_resources_dsl
|
158
|
-
end
|
159
|
-
|
160
|
-
rule_class.class_eval do
|
161
|
-
include context.to_resources_dsl
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
define_method :add_subcontext do |context|
|
166
|
-
profile_context_owner.add_subcontext(context)
|
167
|
-
end
|
168
|
-
|
169
|
-
define_method :register_control do |control, &block|
|
170
|
-
if @skip_file
|
171
|
-
::Inspec::Rule.set_skip_rule(control, true, @skip_file_message)
|
172
|
-
end
|
173
|
-
|
174
|
-
unless profile_context_owner.profile_supports_platform?
|
175
|
-
platform = inspec.platform
|
176
|
-
msg = "Profile `#{profile_context_owner.profile_id}` is not supported on platform #{platform.name}/#{platform.release}."
|
177
|
-
::Inspec::Rule.set_skip_rule(control, true, msg)
|
178
|
-
end
|
179
|
-
|
180
|
-
unless profile_context_owner.profile_supports_inspec_version?
|
181
|
-
msg = "Profile `#{profile_context_owner.profile_id}` is not supported on InSpec version (#{Inspec::VERSION})."
|
182
|
-
::Inspec::Rule.set_skip_rule(control, true, msg)
|
183
|
-
end
|
184
|
-
|
185
|
-
profile_context_owner.register_rule(control, &block) unless control.nil?
|
186
|
-
end
|
187
|
-
|
188
|
-
define_method :input do |input_name, options = {}|
|
189
|
-
if options.empty?
|
190
|
-
# Simply an access, no event here
|
191
|
-
Inspec::InputRegistry.find_or_register_input(input_name, profile_id).value
|
192
|
-
else
|
193
|
-
options[:priority] ||= 20
|
194
|
-
options[:provider] = :inline_control_code
|
195
|
-
evt = Inspec::Input.infer_event(options)
|
196
|
-
Inspec::InputRegistry.find_or_register_input(input_name, profile_id, event: evt).value
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
# Find the Input object, but don't collapse to a value.
|
201
|
-
# Will return nil on a miss.
|
202
|
-
define_method :input_object do |input_name|
|
203
|
-
Inspec::InputRegistry.find_or_register_input(input_name, profile_id)
|
204
|
-
end
|
205
|
-
|
206
|
-
define_method :attribute do |name, options = {}|
|
207
|
-
Inspec.deprecate(:attrs_dsl, "Input name: #{name}, Profile: #{profile_id}")
|
208
|
-
input(name, options)
|
209
|
-
end
|
210
|
-
|
211
|
-
define_method :skip_control do |id|
|
212
|
-
profile_context_owner.unregister_rule(id)
|
213
|
-
end
|
214
|
-
|
215
|
-
define_method :only_if do |message = nil, &block|
|
216
|
-
return unless block
|
217
|
-
return if @skip_file == true
|
218
|
-
return if @skip_only_if_eval == true
|
219
|
-
|
220
|
-
return if block.yield == true
|
221
|
-
|
222
|
-
# Apply `set_skip_rule` for other rules in the same file
|
223
|
-
profile_context_owner.rules.values.each do |r|
|
224
|
-
sources_match = r.source_file == block.source_location[0]
|
225
|
-
Inspec::Rule.set_skip_rule(r, true, message) if sources_match
|
226
|
-
end
|
227
|
-
|
228
|
-
@skip_file_message = message
|
229
|
-
@skip_file = true
|
230
|
-
end
|
231
|
-
|
232
|
-
alias_method :rule, :control
|
233
|
-
alias_method :skip_rule, :skip_control
|
234
|
-
|
235
|
-
private
|
236
|
-
|
237
|
-
def block_location(block, alternate_caller)
|
238
|
-
if block.nil?
|
239
|
-
alternate_caller[/^(.+:\d+):in .+$/, 1] || "unknown"
|
240
|
-
else
|
241
|
-
path, line = block.source_location
|
242
|
-
"#{File.basename(path)}:#{line}"
|
243
|
-
end
|
244
|
-
end
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
require "fileutils"
|
2
|
-
|
3
|
-
module Inspec
|
4
|
-
#
|
5
|
-
# Inspec::Cache manages an on-disk cache of inspec profiles. The
|
6
|
-
# cache can contain:
|
7
|
-
#
|
8
|
-
# - .tar.gz profile archives
|
9
|
-
# - .zip profile archives
|
10
|
-
# - unpacked profiles
|
11
|
-
#
|
12
|
-
# Cache entries names include a hash of their source to prevent
|
13
|
-
# conflicts between depenedencies with the same name from different
|
14
|
-
# sources.
|
15
|
-
#
|
16
|
-
#
|
17
|
-
class Cache
|
18
|
-
attr_reader :path
|
19
|
-
def initialize(path = nil)
|
20
|
-
@path = path || File.join(Inspec.config_dir, "cache")
|
21
|
-
FileUtils.mkdir_p(@path) unless File.directory?(@path)
|
22
|
-
rescue Errno::EACCES
|
23
|
-
# ignore
|
24
|
-
end
|
25
|
-
|
26
|
-
def prefered_entry_for(key)
|
27
|
-
path = base_path_for(key)
|
28
|
-
if File.directory?(path)
|
29
|
-
path
|
30
|
-
else
|
31
|
-
archive_entry_for(key)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def archive_entry_for(key)
|
36
|
-
path = base_path_for(key)
|
37
|
-
if File.exist?("#{path}.tar.gz")
|
38
|
-
"#{path}.tar.gz"
|
39
|
-
elsif File.exist?("#{path}.zip")
|
40
|
-
"#{path}.zip"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
#
|
45
|
-
# For a given name and source_url, return true if the
|
46
|
-
# profile exists in the Cache.
|
47
|
-
#
|
48
|
-
# @param [String] name
|
49
|
-
# @param [String] source_url
|
50
|
-
# @return [Boolean]
|
51
|
-
#
|
52
|
-
def exists?(key)
|
53
|
-
return false if key.nil? || key.empty?
|
54
|
-
|
55
|
-
path = base_path_for(key)
|
56
|
-
File.directory?(path) || File.exist?("#{path}.tar.gz") || File.exist?("#{path}.zip")
|
57
|
-
end
|
58
|
-
|
59
|
-
#
|
60
|
-
# Return the path to given profile in the cache.
|
61
|
-
#
|
62
|
-
# The `source_url` parameter should be a URI-like string that
|
63
|
-
# fully specifies the source of the exact version we want to pull
|
64
|
-
# down.
|
65
|
-
#
|
66
|
-
# @param [String] name
|
67
|
-
# @param [String] source_url
|
68
|
-
# @return [String]
|
69
|
-
#
|
70
|
-
def base_path_for(cache_key)
|
71
|
-
File.join(@path, cache_key)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
require "inspec/dependencies/requirement"
|
2
|
-
require "inspec/dependencies/resolver"
|
3
|
-
|
4
|
-
module Inspec
|
5
|
-
#
|
6
|
-
# A DependencySet manages a list of dependencies for a profile.
|
7
|
-
#
|
8
|
-
class DependencySet
|
9
|
-
#
|
10
|
-
# Return a dependency set given a lockfile.
|
11
|
-
#
|
12
|
-
# @param lockfile [Inspec::Lockfile] A lockfile to generate the dependency set from
|
13
|
-
# @param cwd [String] Current working directory for relative path includes
|
14
|
-
# @param vendor_path [String] Path to the vendor directory
|
15
|
-
#
|
16
|
-
def self.from_lockfile(lockfile, config, opts = {})
|
17
|
-
dep_tree = lockfile.deps.map do |dep|
|
18
|
-
Inspec::Requirement.from_lock_entry(dep, config, opts)
|
19
|
-
end
|
20
|
-
|
21
|
-
dep_list = flatten_dep_tree(dep_tree)
|
22
|
-
new(config[:cwd], config[:cache], dep_list, config[:backend])
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.from_array(dependencies, cwd, cache, backend)
|
26
|
-
dep_list = {}
|
27
|
-
dependencies.each do |d|
|
28
|
-
dep_list[d.name] = d
|
29
|
-
end
|
30
|
-
new(cwd, cache, dep_list, backend)
|
31
|
-
end
|
32
|
-
|
33
|
-
# This is experimental code to test the working of the
|
34
|
-
# dependency loader - perform a proper dependency related search
|
35
|
-
# in the future.
|
36
|
-
#
|
37
|
-
# Flatten tree because that is all we know how to deal with for
|
38
|
-
# right now. Last dep seen for a given name wins right now.
|
39
|
-
def self.flatten_dep_tree(dep_tree)
|
40
|
-
dep_list = {}
|
41
|
-
dep_tree.each do |d|
|
42
|
-
dep_list[d.name] = d
|
43
|
-
dep_list.merge!(flatten_dep_tree(d.dependencies))
|
44
|
-
end
|
45
|
-
dep_list
|
46
|
-
end
|
47
|
-
|
48
|
-
attr_reader :vendor_path
|
49
|
-
attr_accessor :dep_list
|
50
|
-
# initialize
|
51
|
-
#
|
52
|
-
# @param cwd [String] current working directory for relative path includes
|
53
|
-
# @param vendor_path [String] path which contains vendored dependencies
|
54
|
-
# @return [dependencies] this
|
55
|
-
def initialize(cwd, cache, dep_list, backend)
|
56
|
-
@cwd = cwd
|
57
|
-
@cache = cache
|
58
|
-
@dep_list = dep_list
|
59
|
-
@backend = backend
|
60
|
-
end
|
61
|
-
|
62
|
-
def each
|
63
|
-
@dep_list.each do |_k, v|
|
64
|
-
yield v.profile
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def list
|
69
|
-
@dep_list || {}
|
70
|
-
end
|
71
|
-
|
72
|
-
def to_array
|
73
|
-
return [] if @dep_list.nil?
|
74
|
-
|
75
|
-
@dep_list.map do |_k, v|
|
76
|
-
v.to_hash
|
77
|
-
end.compact
|
78
|
-
end
|
79
|
-
|
80
|
-
#
|
81
|
-
# 1. Get dependencies, pull things to a local cache if necessary
|
82
|
-
# 2. Resolve dependencies
|
83
|
-
#
|
84
|
-
# @param dependencies [Gem::Dependency] list of dependencies
|
85
|
-
# @return [nil]
|
86
|
-
#
|
87
|
-
def vendor(dependencies)
|
88
|
-
return nil if dependencies.nil? || dependencies.empty?
|
89
|
-
|
90
|
-
@dep_list = Resolver.resolve(dependencies, @cache, @cwd, @backend)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
@@ -1,115 +0,0 @@
|
|
1
|
-
require "yaml"
|
2
|
-
|
3
|
-
module Inspec
|
4
|
-
class Lockfile
|
5
|
-
# When we finalize this feature, we should set these to 1
|
6
|
-
MINIMUM_SUPPORTED_VERSION = 1
|
7
|
-
CURRENT_LOCKFILE_VERSION = 1
|
8
|
-
|
9
|
-
def self.from_dependency_set(dep_set)
|
10
|
-
lockfile_content = {
|
11
|
-
"lockfile_version" => CURRENT_LOCKFILE_VERSION,
|
12
|
-
"depends" => dep_set.to_array,
|
13
|
-
}
|
14
|
-
new(lockfile_content)
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.from_content(content)
|
18
|
-
parsed_content = YAML.load(content)
|
19
|
-
version = parsed_content["lockfile_version"]
|
20
|
-
raise "No lockfile_version set in #{path}!" if version.nil?
|
21
|
-
|
22
|
-
validate_lockfile_version!(version.to_i)
|
23
|
-
new(parsed_content)
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.from_file(path)
|
27
|
-
content = File.read(path)
|
28
|
-
from_content(content)
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.validate_lockfile_version!(version)
|
32
|
-
if version < MINIMUM_SUPPORTED_VERSION
|
33
|
-
raise <<~EOF
|
34
|
-
This lockfile specifies a lockfile_version of #{version} which is
|
35
|
-
lower than the minimum supported version #{MINIMUM_SUPPORTED_VERSION}.
|
36
|
-
|
37
|
-
Please create a new lockfile for this project by running:
|
38
|
-
|
39
|
-
inspec vendor
|
40
|
-
EOF
|
41
|
-
elsif version > CURRENT_LOCKFILE_VERSION
|
42
|
-
raise <<~EOF
|
43
|
-
This lockfile claims to be version #{version} which is greater than
|
44
|
-
the most recent lockfile version(#{CURRENT_LOCKFILE_VERSION}).
|
45
|
-
|
46
|
-
This may happen if you are using an older version of inspec than was
|
47
|
-
used to create the lockfile.
|
48
|
-
EOF
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
attr_reader :version, :deps
|
53
|
-
def initialize(lockfile_content_hash)
|
54
|
-
version = lockfile_content_hash["lockfile_version"]
|
55
|
-
@version = version.to_i
|
56
|
-
parse_content_hash(lockfile_content_hash)
|
57
|
-
end
|
58
|
-
|
59
|
-
def to_yaml
|
60
|
-
{
|
61
|
-
"lockfile_version" => CURRENT_LOCKFILE_VERSION,
|
62
|
-
"depends" => @deps.map { |i| stringify_keys(i) },
|
63
|
-
}.to_yaml
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
# Refactor this to be "version-wise" - i.e. make one dispatch
|
69
|
-
# function for each version so that even if it duplicates code,
|
70
|
-
# it can describe the part of the code that it expects to be
|
71
|
-
# different. Then that dispatch routine can call more well
|
72
|
-
# defined methods like "parse_v0_dependencies" or
|
73
|
-
# "parse_flat_dependencies" or what not as things generally
|
74
|
-
# develop. It does help people easily set breakpoints/track
|
75
|
-
# different entry points of the API.
|
76
|
-
def parse_content_hash(lockfile_content_hash)
|
77
|
-
case version
|
78
|
-
when 1
|
79
|
-
parse_content_hash_1(lockfile_content_hash)
|
80
|
-
else
|
81
|
-
# If we've gotten here, there is likely a mistake in the
|
82
|
-
# lockfile version validation in the constructor.
|
83
|
-
raise "No lockfile parser for version #{version}"
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def parse_content_hash_1(lockfile_content_hash)
|
88
|
-
@deps = lockfile_content_hash["depends"]&.map { |i| symbolize_keys(i) }
|
89
|
-
end
|
90
|
-
|
91
|
-
def mutate_hash_keys_with(hash, fun)
|
92
|
-
hash.each_with_object({}) do |v, memo|
|
93
|
-
key = fun.call(v[0])
|
94
|
-
value = if v[1].is_a?(Hash)
|
95
|
-
mutate_hash_keys_with(v[1], fun)
|
96
|
-
elsif v[1].is_a?(Array)
|
97
|
-
v[1].map do |i|
|
98
|
-
i.is_a?(Hash) ? mutate_hash_keys_with(i, fun) : i
|
99
|
-
end
|
100
|
-
else
|
101
|
-
v[1]
|
102
|
-
end
|
103
|
-
memo[key] = value
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def stringify_keys(hash)
|
108
|
-
mutate_hash_keys_with(hash, proc { |i| i.to_s })
|
109
|
-
end
|
110
|
-
|
111
|
-
def symbolize_keys(hash)
|
112
|
-
mutate_hash_keys_with(hash, proc { |i| i.to_sym })
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|