mirror of
https://github.com/inspec/inspec
synced 2024-11-21 20:23:06 +00:00
Apply chefstyle -a, and manually remove duplicate requires
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
e4c46e9dae
commit
cdfb325ca3
179 changed files with 225 additions and 256 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
# It is traditional in a gemspec to dynamically load the current version
|
||||
# from a file in the source tree. The next three lines make that happen.
|
||||
lib = File.expand_path("../lib", __FILE__)
|
||||
lib = File.expand_path("lib", __dir__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require "inspec-resource-lister/version"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
source "https://rubygems.org"
|
||||
main_gemspec = File.expand_path("../inspec-bin.gemspec", __FILE__)
|
||||
main_gemspec = File.expand_path("inspec-bin.gemspec", __dir__)
|
||||
if File.exist?(main_gemspec)
|
||||
gemspec name: "inspec-bin"
|
||||
else
|
||||
|
|
|
@ -3,7 +3,7 @@ Bundler::GemHelper.install_tasks name: "inspec-bin"
|
|||
desc "force install the inspec-bin gem"
|
||||
task "install:force" do
|
||||
sh "gem build -V inspec-bin.gemspec"
|
||||
built_gem_path = Dir["inspec-bin-*.gem"].sort_by { |f| File.mtime(f) }.last
|
||||
built_gem_path = Dir["inspec-bin-*.gem"].max_by { |f| File.mtime(f) }
|
||||
FileUtils.mkdir_p("pkg") unless Dir.exist?("pkg")
|
||||
FileUtils.mv(built_gem_path, "pkg")
|
||||
sh "gem install -f pkg/#{built_gem_path}"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Encoding.default_external = Encoding::UTF_8
|
||||
Encoding.default_internal = Encoding::UTF_8
|
||||
|
||||
lib = File.expand_path("../lib", __FILE__)
|
||||
lib = File.expand_path("lib", __dir__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
|
||||
require "inspec/cli"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
lib = File.expand_path("../lib", __FILE__)
|
||||
lib = File.expand_path("lib", __dir__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require "inspec-bin/version"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
lib = File.expand_path("../lib", __FILE__)
|
||||
lib = File.expand_path("lib", __dir__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require "inspec-bin/version"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# This file managed by automation - do not edit manually
|
||||
module InspecBin
|
||||
INSPECBIN_ROOT = File.expand_path("../..", __FILE__)
|
||||
INSPECBIN_ROOT = File.expand_path("..", __dir__)
|
||||
VERSION = "4.24.22".freeze
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
lib = File.expand_path("../lib", __FILE__)
|
||||
lib = File.expand_path("lib", __dir__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require "inspec/version"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
lib = File.expand_path("../lib", __FILE__)
|
||||
lib = File.expand_path("lib", __dir__)
|
||||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||
require "inspec/version"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "net/http"
|
||||
require "addressable/uri"
|
||||
require "net/http" unless defined?(Net::HTTP)
|
||||
require "addressable/uri" unless defined?(Addressable::URI)
|
||||
|
||||
module Supermarket
|
||||
class API
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "uri"
|
||||
require "uri" unless defined?(URI)
|
||||
require "inspec/fetcher"
|
||||
require "inspec/fetcher/url"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rubygems/package"
|
||||
require "rubygems/package" unless defined?(Gem::Package)
|
||||
|
||||
module Inspec::Archive
|
||||
class TarArchiveGenerator
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "rubygems"
|
||||
require "zip"
|
||||
require "pathname"
|
||||
require "rubygems" unless defined?(Gem)
|
||||
require "zip" unless defined?(Zip)
|
||||
require "pathname" unless defined?(Pathname)
|
||||
|
||||
module Inspec::Archive
|
||||
class ZipArchiveGenerator
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "thor"
|
||||
require "thor" unless defined?(Thor)
|
||||
require "inspec/log"
|
||||
require "inspec/ui"
|
||||
require "inspec/config"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "inspec/fetcher"
|
||||
require "forwardable"
|
||||
require "forwardable" unless defined?(Forwardable)
|
||||
|
||||
module Inspec
|
||||
class CachedFetcher
|
||||
|
|
|
@ -67,7 +67,7 @@ class Inspec::InspecCLI < Inspec::BaseCLI
|
|||
desc: "A list of controls to include. Ignore all other tests."
|
||||
profile_options
|
||||
def json(target)
|
||||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
|
||||
o = config
|
||||
diagnose(o)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# Represents InSpec configuration. Merges defaults, config file options,
|
||||
# and CLI arguments.
|
||||
|
||||
require "pp"
|
||||
require "stringio"
|
||||
require "forwardable"
|
||||
require "thor"
|
||||
require "base64"
|
||||
require "pp" unless defined?(PP)
|
||||
require "stringio" unless defined?(StringIO)
|
||||
require "forwardable" unless defined?(Forwardable)
|
||||
require "thor" unless defined?(Thor)
|
||||
require "base64" unless defined?(Base64)
|
||||
require "inspec/plugin/v2/filter"
|
||||
|
||||
module Inspec
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "fileutils"
|
||||
require "fileutils" unless defined?(FileUtils)
|
||||
|
||||
module Inspec
|
||||
#
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "inspec/shell_detector"
|
||||
require "erb"
|
||||
require "shellwords"
|
||||
require "erb" unless defined?(Erb)
|
||||
require "shellwords" unless defined?(Shellwords)
|
||||
|
||||
module Inspec
|
||||
class EnvPrinter
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "tmpdir"
|
||||
require "fileutils"
|
||||
require "mixlib/shellout"
|
||||
require "tmpdir" unless defined?(Dir.mktmpdir)
|
||||
require "fileutils" unless defined?(FileUtils)
|
||||
require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
|
||||
require "inspec/log"
|
||||
|
||||
module Inspec::Fetcher
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "openssl"
|
||||
require "openssl" unless defined?(OpenSSL)
|
||||
|
||||
module Inspec::Fetcher
|
||||
class Local < Inspec.fetcher(1)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "uri"
|
||||
require "openssl"
|
||||
require "tempfile"
|
||||
require "open-uri"
|
||||
require "uri" unless defined?(URI)
|
||||
require "openssl" unless defined?(OpenSSL)
|
||||
require "tempfile" unless defined?(Tempfile)
|
||||
require "open-uri" unless defined?(OpenURI)
|
||||
|
||||
module Inspec::Fetcher
|
||||
class Url < Inspec.fetcher(1)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "rubygems/package"
|
||||
require "pathname"
|
||||
require "zlib"
|
||||
require "zip"
|
||||
require "rubygems/package" unless defined?(Gem::Package)
|
||||
require "pathname" unless defined?(Pathname)
|
||||
require "zlib" unless defined?(Zlib)
|
||||
require "zip" unless defined?(Zip)
|
||||
|
||||
module Inspec
|
||||
class FileProvider
|
||||
|
|
|
@ -14,14 +14,17 @@ module Inspec
|
|||
class Input
|
||||
|
||||
class Error < Inspec::Error; end
|
||||
|
||||
class ValidationError < Error
|
||||
attr_accessor :input_name
|
||||
attr_accessor :input_value
|
||||
attr_accessor :input_type
|
||||
end
|
||||
|
||||
class TypeError < Error
|
||||
attr_accessor :input_type
|
||||
end
|
||||
|
||||
class RequiredError < Error
|
||||
attr_accessor :input_name
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "forwardable"
|
||||
require "singleton"
|
||||
require "forwardable" unless defined?(Forwardable)
|
||||
require "singleton" unless defined?(Singleton)
|
||||
require "inspec/input"
|
||||
require "inspec/secrets"
|
||||
require "inspec/exceptions"
|
||||
|
@ -14,9 +14,11 @@ module Inspec
|
|||
extend Forwardable
|
||||
|
||||
class Error < Inspec::Error; end
|
||||
|
||||
class ProfileLookupError < Error
|
||||
attr_accessor :profile_name
|
||||
end
|
||||
|
||||
class InputLookupError < Error
|
||||
attr_accessor :profile_name
|
||||
attr_accessor :input_name
|
||||
|
@ -199,7 +201,7 @@ module Inspec
|
|||
value = YAML.load(value)
|
||||
rescue Psych::SyntaxError => yaml_error
|
||||
# It could be that we just tried to run JSON through the YAML parser.
|
||||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
begin
|
||||
value = JSON.parse(value)
|
||||
rescue JSON::ParserError => json_error
|
||||
|
|
|
@ -216,7 +216,7 @@ module Inspec
|
|||
end
|
||||
|
||||
def self.from_yaml(ref, content, profile_id, logger = nil)
|
||||
require "erb"
|
||||
require "erb" unless defined?(Erb)
|
||||
res = Metadata.new(ref, logger)
|
||||
res.params = YAML.load(ERB.new(content).result)
|
||||
res.content = content
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "forwardable"
|
||||
require "forwardable" unless defined?(Forwardable)
|
||||
|
||||
module Inspec
|
||||
# Resource Plugins
|
||||
|
@ -36,7 +36,7 @@ module Inspec
|
|||
.flatten
|
||||
|
||||
# load bundled plugins
|
||||
bundled_dir = File.expand_path(File.dirname(__FILE__))
|
||||
bundled_dir = __dir__
|
||||
@paths += Dir[File.join(bundled_dir, "..", "bundles", "inspec-*.rb")].flatten
|
||||
|
||||
# map paths to names
|
||||
|
|
|
@ -6,17 +6,22 @@ module Inspec
|
|||
class Exception < Inspec::Error; end
|
||||
class ConfigError < Inspec::Plugin::V2::Exception; end
|
||||
class LoadError < Inspec::Plugin::V2::Exception; end
|
||||
|
||||
class GemActionError < Inspec::Plugin::V2::Exception
|
||||
attr_accessor :plugin_name
|
||||
attr_accessor :version
|
||||
end
|
||||
|
||||
class InstallError < Inspec::Plugin::V2::GemActionError; end
|
||||
|
||||
class PluginExcludedError < Inspec::Plugin::V2::InstallError
|
||||
attr_accessor :details
|
||||
end
|
||||
|
||||
class UpdateError < Inspec::Plugin::V2::GemActionError
|
||||
attr_accessor :from_version, :to_version
|
||||
end
|
||||
|
||||
class UnInstallError < Inspec::Plugin::V2::GemActionError; end
|
||||
class SearchError < Inspec::Plugin::V2::GemActionError; end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
|
||||
module Inspec::Plugin::V2
|
||||
# Represents the plugin config file on disk.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "singleton"
|
||||
require "json"
|
||||
require "singleton" unless defined?(Singleton)
|
||||
require "json" unless defined?(JSON)
|
||||
require "inspec/globals"
|
||||
|
||||
module Inspec::Plugin; end
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# This file is not required by default.
|
||||
|
||||
require "singleton"
|
||||
require "forwardable"
|
||||
require "fileutils"
|
||||
require "uri"
|
||||
require "singleton" unless defined?(Singleton)
|
||||
require "forwardable" unless defined?(Forwardable)
|
||||
require "fileutils" unless defined?(FileUtils)
|
||||
require "uri" unless defined?(URI)
|
||||
|
||||
# Gem extensions for doing unusual things - not loaded by Gem default
|
||||
require "rubygems/package"
|
||||
require "rubygems/package" unless defined?(Gem::Package)
|
||||
require "rubygems/name_tuple"
|
||||
require "rubygems/uninstaller"
|
||||
require "rubygems/remote_fetcher"
|
||||
|
|
|
@ -130,7 +130,7 @@ module Inspec::Plugin::V2
|
|||
end
|
||||
|
||||
def self.plugin_gem_path
|
||||
require "rbconfig"
|
||||
require "rbconfig" unless defined?(RbConfig)
|
||||
ruby_abi_version = RbConfig::CONFIG["ruby_version"]
|
||||
# TODO: why are we installing under the api directory for plugins?
|
||||
base_dir = Inspec.config_dir
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "forwardable"
|
||||
require "singleton"
|
||||
require "forwardable" unless defined?(Forwardable)
|
||||
require "singleton" unless defined?(Singleton)
|
||||
require "train"
|
||||
|
||||
require_relative "status"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# Copyright 2015 Dominik Richter
|
||||
|
||||
require "forwardable"
|
||||
require "openssl"
|
||||
require "pathname"
|
||||
require "forwardable" unless defined?(Forwardable)
|
||||
require "openssl" unless defined?(OpenSSL)
|
||||
require "pathname" unless defined?(Pathname)
|
||||
require "inspec/input_registry"
|
||||
require "inspec/cached_fetcher" # TODO: split or rename
|
||||
require "inspec/source_reader"
|
||||
|
|
|
@ -4,7 +4,7 @@ require "inspec/resource"
|
|||
require "inspec/library_eval_context"
|
||||
require "inspec/control_eval_context"
|
||||
require "inspec/require_loader"
|
||||
require "securerandom"
|
||||
require "securerandom" unless defined?(SecureRandom)
|
||||
require "inspec/input_registry"
|
||||
|
||||
module Inspec
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "json"
|
||||
require "net/http"
|
||||
require "json" unless defined?(JSON)
|
||||
require "net/http" unless defined?(Net::HTTP)
|
||||
|
||||
module Inspec::Reporters
|
||||
class Automate < JsonAutomate
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
|
||||
module Inspec::Reporters
|
||||
# rubocop:disable Layout/AlignHash, Style/BlockDelimiters
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
|
||||
module Inspec::Reporters
|
||||
class JsonAutomate < Json
|
||||
|
|
|
@ -16,11 +16,11 @@ inspec_core_only = ENV["NO_AWS"] || !File.exist?(File.join(File.dirname(__FILE__
|
|||
# Do not attempt to load cloud resources if we are in inspec-core mode
|
||||
unless inspec_core_only
|
||||
require "resource_support/aws"
|
||||
require "resources/azure/azure_backend.rb"
|
||||
require "resources/azure/azure_generic_resource.rb"
|
||||
require "resources/azure/azure_resource_group.rb"
|
||||
require "resources/azure/azure_virtual_machine.rb"
|
||||
require "resources/azure/azure_virtual_machine_data_disk.rb"
|
||||
require "resources/azure/azure_backend"
|
||||
require "resources/azure/azure_generic_resource"
|
||||
require "resources/azure/azure_resource_group"
|
||||
require "resources/azure/azure_virtual_machine"
|
||||
require "resources/azure/azure_virtual_machine_data_disk"
|
||||
end
|
||||
|
||||
require "inspec/resources/aide_conf"
|
||||
|
|
|
@ -24,7 +24,7 @@ require "inspec/resources/command"
|
|||
# apt-get install software-properties-common
|
||||
# add-apt-repository ppa:ubuntu-wine/ppa
|
||||
|
||||
require "uri"
|
||||
require "uri" unless defined?(URI)
|
||||
|
||||
module Inspec::Resources
|
||||
class AptRepository < Inspec.resource(1)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "forwardable"
|
||||
require "forwardable" unless defined?(Forwardable)
|
||||
require "inspec/utils/filter_array"
|
||||
require "inspec/utils/filter"
|
||||
require "inspec/utils/parser"
|
||||
|
|
|
@ -20,7 +20,7 @@ module Inspec::Resources
|
|||
# { 'name' => 'row2', 'col1' => 'value3', 'col2' => 'value4' }
|
||||
# ]
|
||||
def parse(content)
|
||||
require "csv"
|
||||
require "csv" unless defined?(CSV)
|
||||
|
||||
# convert empty field to nil
|
||||
CSV::Converters[:blank_to_nil] = lambda do |field|
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "openssl"
|
||||
require "openssl" unless defined?(OpenSSL)
|
||||
require "inspec/utils/file_reader"
|
||||
|
||||
module Inspec::Resources
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# copyright: 2015, Vulcano Security GmbH
|
||||
|
||||
require "shellwords"
|
||||
require "shellwords" unless defined?(Shellwords)
|
||||
require "inspec/utils/parser"
|
||||
|
||||
module Inspec::Resources
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# license: Apache v2
|
||||
|
||||
require "inspec/resources/command"
|
||||
require "faraday"
|
||||
require "faraday" unless defined?(Faraday)
|
||||
require "faraday_middleware"
|
||||
require "hashie"
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# This is just here to make the dynamic loader happy.
|
||||
require "inspec/resources/iis_website.rb"
|
||||
require "inspec/resources/iis_website"
|
||||
|
|
|
@ -24,7 +24,7 @@ module Inspec::Resources
|
|||
.install_filter_methods_on_resource(self, :scan_interfaces)
|
||||
|
||||
def ipv4_address
|
||||
require "ipaddr"
|
||||
require "ipaddr" unless defined?(IPAddr)
|
||||
|
||||
# Loop over interface names
|
||||
# Select those that are up and have an ipv4 address
|
||||
|
|
|
@ -66,7 +66,7 @@ module Inspec::Resources
|
|||
private
|
||||
|
||||
def parse(content)
|
||||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
JSON.parse(content)
|
||||
rescue => e
|
||||
raise Inspec::Exceptions::ResourceFailed, "Unable to parse JSON: #{e.message}"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "openssl"
|
||||
require "openssl" unless defined?(OpenSSL)
|
||||
require "hashie/mash"
|
||||
require "inspec/utils/file_reader"
|
||||
require "inspec/utils/pkey_reader"
|
||||
|
|
|
@ -95,7 +95,7 @@ module Inspec::Resources
|
|||
end
|
||||
|
||||
def parse_csv_result(cmd)
|
||||
require "csv"
|
||||
require "csv" unless defined?(CSV)
|
||||
table = CSV.parse(cmd.stdout, headers: true)
|
||||
|
||||
# remove first row, since it will be a seperator line
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# copyright: 2015, Vulcano Security GmbH
|
||||
|
||||
require "inspec/resources/command"
|
||||
require "shellwords"
|
||||
require "shellwords" unless defined?(Shellwords)
|
||||
|
||||
module Inspec::Resources
|
||||
class Lines
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "pathname"
|
||||
require "pathname" unless defined?(Pathname)
|
||||
require "hashie/mash"
|
||||
require "inspec/resources/command"
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "inspec/utils/nginx_parser"
|
||||
require "inspec/utils/find_files"
|
||||
require "inspec/utils/file_reader"
|
||||
require "forwardable"
|
||||
require "forwardable" unless defined?(Forwardable)
|
||||
|
||||
# STABILITY: Experimental
|
||||
# This resouce needs a proper interace to the underlying data, which is currently missing.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "inspec/resources/command"
|
||||
require "shellwords"
|
||||
require "shellwords" unless defined?(Shellwords)
|
||||
|
||||
module Inspec::Resources
|
||||
class NpmPackage < Inspec.resource(1)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "inspec/resources/command"
|
||||
require "inspec/utils/database_helpers"
|
||||
require "hashie/mash"
|
||||
require "csv"
|
||||
require "csv" unless defined?(CSV)
|
||||
|
||||
module Inspec::Resources
|
||||
# STABILITY: Experimental
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "inspec/utils/parser"
|
||||
require "inspec/utils/filter"
|
||||
require "ipaddr"
|
||||
require "ipaddr" unless defined?(IPAddr)
|
||||
|
||||
# TODO: currently we return local ip only
|
||||
# TODO: improve handling of same port on multiple interfaces
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# copyright: 2015, Vulcano Security GmbH
|
||||
|
||||
require "shellwords"
|
||||
require "shellwords" unless defined?(Shellwords)
|
||||
|
||||
module Inspec::Resources
|
||||
class Lines
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# This is just here to make the dynamic loader happy.
|
||||
require "inspec/resources/apt.rb"
|
||||
require "inspec/resources/apt"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# copyright: 2015, Vulcano Security GmbH
|
||||
|
||||
require "inspec/utils/filter"
|
||||
require "ostruct"
|
||||
require "ostruct" unless defined?(OpenStruct)
|
||||
require "inspec/resources/command"
|
||||
|
||||
module Inspec::Resources
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# This is just here to make the dynamic loader happy.
|
||||
require "inspec/resources/rabbitmq_config.rb"
|
||||
require "inspec/resources/rabbitmq_config"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# copyright: 2015, Vulcano Security GmbH
|
||||
|
||||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
require "inspec/resources/powershell"
|
||||
|
||||
# Three constructor methods are available:
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# This is just here to make the dynamic loader happy.
|
||||
require "inspec/resources/ssh_config.rb"
|
||||
require "inspec/resources/ssh_config"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# copyright: 2015, Chef Software Inc.
|
||||
|
||||
require "sslshake"
|
||||
require "sslshake" unless defined?(SSLShake)
|
||||
require "inspec/utils/filter"
|
||||
require "uri"
|
||||
require "uri" unless defined?(URI)
|
||||
require "parallel"
|
||||
|
||||
# Custom resource based on the InSpec resource DSL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "tomlrb"
|
||||
require "tomlrb" unless defined?(Tomlrb)
|
||||
require "inspec/resources/json"
|
||||
|
||||
module Inspec::Resources
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "inspec/resources/powershell"
|
||||
require "securerandom"
|
||||
require "securerandom" unless defined?(SecureRandom)
|
||||
|
||||
module Inspec::Resources
|
||||
# This resource allows users to run vbscript on windows machines. We decided
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# This is just here to make the dynamic loader happy.
|
||||
require "inspec/resources/registry_key.rb"
|
||||
require "inspec/resources/registry_key"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "openssl"
|
||||
require "openssl" unless defined?(OpenSSL)
|
||||
require "hashie/mash"
|
||||
require "inspec/utils/file_reader"
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ module Inspec::Resources
|
|||
EXAMPLE
|
||||
|
||||
def parse(content)
|
||||
require "rexml/document"
|
||||
require "rexml/document" unless defined?(REXML::Document)
|
||||
REXML::Document.new(content)
|
||||
rescue => e
|
||||
raise Inspec::Exceptions::ResourceFailed, "Unable to parse XML: #{e.message}"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# copyright: 2015, Dominik Richter
|
||||
|
||||
require "forwardable"
|
||||
require "uri"
|
||||
require "forwardable" unless defined?(Forwardable)
|
||||
require "uri" unless defined?(URI)
|
||||
require "inspec/backend"
|
||||
require "inspec/profile_context"
|
||||
require "inspec/profile"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
|
||||
module Inspec
|
||||
class Schema
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
require "inspec/schema/primitives"
|
||||
require "inspec/schema/exec_json"
|
||||
require "inspec/schema/exec_json_min"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "set"
|
||||
require "set" unless defined?(Set)
|
||||
|
||||
# These elements are shared between more than one output type
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "etc"
|
||||
require "rbconfig"
|
||||
require "etc" unless defined?(Etc)
|
||||
require "rbconfig" unless defined?(RbConfig)
|
||||
|
||||
module Inspec
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "shellwords"
|
||||
require "shellwords" unless defined?(Shellwords)
|
||||
|
||||
class CommandWrapper
|
||||
UNIX_SHELLS = %w{sh bash zsh ksh}.freeze
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "stringio"
|
||||
require "json"
|
||||
require "stringio" unless defined?(StringIO)
|
||||
require "json" unless defined?(JSON)
|
||||
require "inspec/globals"
|
||||
require "inspec/config"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
|
||||
# a simple streaming json logger
|
||||
class Logger::JSONFormatter < Logger::Formatter
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "inspec/config"
|
||||
require "inspec/utils/telemetry/data_series"
|
||||
require "singleton"
|
||||
require "singleton" unless defined?(Singleton)
|
||||
|
||||
module Inspec::Telemetry
|
||||
# A Singleton collection of data series objects.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "json"
|
||||
require "json" unless defined?(JSON)
|
||||
|
||||
module Inspec; end
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require "base64"
|
||||
require "openssl"
|
||||
require "pathname"
|
||||
require "set"
|
||||
require "tempfile"
|
||||
require "base64" unless defined?(Base64)
|
||||
require "openssl" unless defined?(OpenSSL)
|
||||
require "pathname" unless defined?(Pathname)
|
||||
require "set" unless defined?(Set)
|
||||
require "tempfile" unless defined?(Tempfile)
|
||||
require "yaml"
|
||||
require "inspec/dist"
|
||||
require "inspec/utils/json_profile_summary"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "fileutils"
|
||||
require "fileutils" unless defined?(FileUtils)
|
||||
require "plugins/shared/core_plugin_test_helper"
|
||||
require "securerandom"
|
||||
require "securerandom" unless defined?(SecureRandom)
|
||||
|
||||
class ArtifactCli < Minitest::Test
|
||||
include CorePluginFunctionalHelper
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "net/http"
|
||||
require "uri"
|
||||
require "json"
|
||||
require "net/http" unless defined?(Net::HTTP)
|
||||
require "uri" unless defined?(URI)
|
||||
require "json" unless defined?(JSON)
|
||||
require "inspec/dist"
|
||||
|
||||
require_relative "api/login"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "net/http"
|
||||
require "net/http" unless defined?(Net::HTTP)
|
||||
require "net/http/post/multipart"
|
||||
require "uri"
|
||||
require "uri" unless defined?(URI)
|
||||
|
||||
module InspecPlugins
|
||||
module Compliance
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "uri"
|
||||
require "uri" unless defined?(URI)
|
||||
require "inspec/fetcher"
|
||||
require "inspec/errors"
|
||||
require "inspec/dist"
|
||||
|
@ -85,7 +85,7 @@ module InspecPlugins
|
|||
# If version was specified, it will be the first and only result.
|
||||
# Note we are calling the sha256 as a string, not a symbol since
|
||||
# it was returned as json from the Compliance API.
|
||||
profile_info = profile_result.sort_by { |x| Gem::Version.new(x["version"]) }[0]
|
||||
profile_info = profile_result.min_by { |x| Gem::Version.new(x["version"]) }
|
||||
profile_checksum = profile_info.key?("sha256") ? profile_info["sha256"] : ""
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require_relative "../../../shared/core_plugin_test_helper.rb"
|
||||
require_relative "../../../shared/core_plugin_test_helper"
|
||||
|
||||
class ComplianceCli < Minitest::Test
|
||||
include CorePluginFunctionalHelper
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "minitest/autorun"
|
||||
require "mocha/minitest"
|
||||
require "webmock/minitest"
|
||||
require_relative "../../../lib/inspec-compliance/api.rb"
|
||||
require_relative "../../../lib/inspec-compliance/api"
|
||||
|
||||
describe InspecPlugins::Compliance::API do
|
||||
let(:automate_options) do
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "minitest/autorun"
|
||||
require "webmock/minitest"
|
||||
require "mocha/minitest"
|
||||
require_relative "../../lib/inspec-compliance/api.rb"
|
||||
require_relative "../../lib/inspec-compliance/api"
|
||||
|
||||
describe InspecPlugins::Compliance::API do
|
||||
let(:profiles_response) do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "minitest/autorun"
|
||||
require "mocha/minitest"
|
||||
require_relative "../../lib/inspec-compliance/api.rb"
|
||||
require_relative "../../lib/inspec-compliance/api"
|
||||
|
||||
describe InspecPlugins::Compliance::Fetcher do
|
||||
let(:config) { { "server" => "myserver" } }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "inspec/profile_vendor"
|
||||
require "mixlib/shellout"
|
||||
require "tomlrb"
|
||||
require "ostruct"
|
||||
require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
|
||||
require "tomlrb" unless defined?(Tomlrb)
|
||||
require "ostruct" unless defined?(OpenStruct)
|
||||
require "inspec/dist"
|
||||
|
||||
module InspecPlugins
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require_relative "../../../shared/core_plugin_test_helper.rb"
|
||||
require "fileutils"
|
||||
require_relative "../../../shared/core_plugin_test_helper"
|
||||
require "fileutils" unless defined?(FileUtils)
|
||||
|
||||
class ProfileCli < Minitest::Test
|
||||
include CorePluginFunctionalHelper
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require "mixlib/log"
|
||||
require "fileutils"
|
||||
require "fileutils" unless defined?(FileUtils)
|
||||
require "minitest/autorun"
|
||||
require "inspec/backend"
|
||||
require_relative "../../lib/inspec-habitat/profile.rb"
|
||||
require_relative "../../lib/inspec-habitat/profile"
|
||||
|
||||
class InspecPlugins::Habitat::ProfileTest < Minitest::Test
|
||||
def setup
|
||||
|
@ -15,7 +15,7 @@ class InspecPlugins::Habitat::ProfileTest < Minitest::Test
|
|||
|
||||
# Path from `__FILE__` needed to support running tests in `inspec/inspec`
|
||||
@test_profile_path = File.join(
|
||||
File.expand_path(File.dirname(__FILE__)),
|
||||
__dir__,
|
||||
"../",
|
||||
"support",
|
||||
"example_profile"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "pathname"
|
||||
require "pathname" unless defined?(Pathname)
|
||||
require_relative "renderer"
|
||||
|
||||
module InspecPlugins
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "pathname"
|
||||
require "pathname" unless defined?(Pathname)
|
||||
require_relative "renderer"
|
||||
|
||||
module InspecPlugins
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "fileutils"
|
||||
require "erb"
|
||||
require "fileutils" unless defined?(FileUtils)
|
||||
require "erb" unless defined?(Erb)
|
||||
|
||||
module InspecPlugins
|
||||
module Init
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require_relative "../../../shared/core_plugin_test_helper.rb"
|
||||
require_relative "../../../shared/core_plugin_test_helper"
|
||||
|
||||
class InitPluginCli < Minitest::Test
|
||||
include CorePluginFunctionalHelper
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "yaml"
|
||||
require_relative "../../../shared/core_plugin_test_helper.rb"
|
||||
require_relative "../../../shared/core_plugin_test_helper"
|
||||
|
||||
class InitCli < Minitest::Test
|
||||
include CorePluginFunctionalHelper
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "pathname"
|
||||
require "pathname" unless defined?(Pathname)
|
||||
require "inspec/plugin/v2"
|
||||
require "inspec/plugin/v2/installer"
|
||||
require "inspec/dist"
|
||||
|
@ -505,8 +505,8 @@ module InspecPlugins
|
|||
plugin_name = status.name.to_s
|
||||
Inspec::Plugin::V2::Loader.list_installed_plugin_gems
|
||||
.select { |spec| spec.name == plugin_name }
|
||||
.sort_by(&:version)
|
||||
.last.version
|
||||
.max_by(&:version)
|
||||
.version
|
||||
end
|
||||
when :path
|
||||
"src"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require_relative "../../../shared/core_plugin_test_helper.rb"
|
||||
require_relative "../../../shared/core_plugin_test_helper"
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Thor option defs
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require_relative "../../../shared/core_plugin_test_helper.rb"
|
||||
require_relative "../../../shared/core_plugin_test_helper"
|
||||
|
||||
#-----------------------------------------------------------------------#
|
||||
# Plugin Definition
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "erb"
|
||||
require "erb" unless defined?(Erb)
|
||||
require "inspec/config"
|
||||
|
||||
module InspecPlugins::Html2Reporter
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require_relative "../../../shared/core_plugin_test_helper.rb"
|
||||
require "tempfile"
|
||||
require_relative "../../../shared/core_plugin_test_helper"
|
||||
require "tempfile" unless defined?(Tempfile)
|
||||
|
||||
describe "inspec-reporter-html2" do
|
||||
include CorePluginFunctionalHelper
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue