Sha256: f408a2fa1c1bc5ddec1d6d4d24ea95a32fc7f73ea2a008874b0024520ba0e9c2

Contents?: true

Size: 987 Bytes

Versions: 13

Compression:

Stored size: 987 Bytes

Contents

# frozen_string_literal: true

module Inspec
  module Utils
    #
    # Inspec::Utils::YamlProfileSummary takes in certain information to identify a
    # profile and then produces a YAML-formatted summary of that profile. It can
    # return the results to STDOUT or a file.
    #
    #
    module YamlProfileSummary
      def self.produce_yaml(info:, write_path: "", suppress_output: false)
        # add in inspec version
        info[:generator] = {
          name: "inspec",
          version: Inspec::VERSION,
        }
        if write_path.empty?
          puts info.to_yaml
        else
          unless suppress_output
            if File.exist? write_path
              Inspec::Log.info "----> updating #{write_path}"
            else
              Inspec::Log.info "----> creating #{write_path}"
            end
          end
          full_write_path = File.expand_path(write_path)
          File.write(full_write_path, info.to_yaml)
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
inspec-core-6.8.24 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-5.22.65 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-6.8.11 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-5.22.58 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-5.22.55 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-6.8.1 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-5.22.40 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-6.6.0 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-5.22.36 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-5.22.29 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-5.22.3 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-5.21.29 lib/inspec/utils/yaml_profile_summary.rb
inspec-core-5.18.14 lib/inspec/utils/yaml_profile_summary.rb