Sha256: 38674f4f7d8be3657ffcf3ced45e564aa86ada8a9b4f81c30236ff1cb06448a1

Contents?: true

Size: 1.13 KB

Versions: 54

Compression:

Stored size: 1.13 KB

Contents

# encoding: utf-8

module InspecPlugins
  module Compliance
    # is a helper that provides information which version of compliance supports
    # which feature
    class Support
      # for a feature, returns either:
      #  - a version v0:                      v supports v0       iff v0 <= v
      #  - an array [v0, v1] of two versions: v supports [v0, v1] iff v0 <= v < v1
      def self.version_with_support(feature)
        case feature.to_sym
        when :oidc # open id connect authentication
          Gem::Version.new('0.16.19')
        else
          Gem::Version.new('0.0.0')
        end
      end

      # determines if the given version support a certain feature
      def self.supported?(feature, version)
        sup = version_with_support(feature)

        if sup.is_a?(Array)
          Gem::Version.new(version) >= sup[0] &&
            Gem::Version.new(version) < sup[1]
        else
          Gem::Version.new(version) >= sup
        end
      end

      # we do not know the version, therefore we do not know if its possible to use the feature
      # return if self['version'].nil? || self['version']['version'].nil?
    end
  end
end

Version data entries

54 entries across 54 versions & 2 rubygems

Version Path
inspec-core-4.3.2 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-4.3.2 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-core-4.2.0.preview lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-4.2.0.preview lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-core-4.1.4.preview lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-4.1.4.preview lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-core-3.9.3 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-3.9.3 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-core-3.9.0 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-3.9.0 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-core-3.7.11 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-3.7.11 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-core-3.7.1 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-3.7.1 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-core-3.6.6 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-3.6.6 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-core-3.6.4 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-3.6.4 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-core-2.3.28 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb
inspec-2.3.28 lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb