Sha256: 491c3c55c4d6456f2e07bc106faccc9d3fd82d9df085b8e926423fc52ce780f0

Contents?: true

Size: 1.43 KB

Versions: 8

Compression:

Stored size: 1.43 KB

Contents

require "inspec/errors"

module Inspec
  module Plugin
    module V2
      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
  end
end

require "inspec/globals"
require "inspec/plugin/v2/config_file"
require "inspec/plugin/v2/registry"
require "inspec/plugin/v2/loader"
require "inspec/plugin/v2/plugin_base"

# Load all plugin type base classes
Dir.glob(File.join(__dir__, "v2", "plugin_types", "*.rb")).each { |file| require file }

module Inspec
  # Provides the base class that plugin implementors should use.
  def self.plugin(version, plugin_type = nil)
    unless version == 2
      raise "Only plugins version 2 is supported!"
    end

    return Inspec::Plugin::V2::PluginBase if plugin_type.nil?
    Inspec::Plugin::V2::PluginBase.base_class_for_type(plugin_type)
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
inspec-core-4.7.3 lib/inspec/plugin/v2.rb
inspec-4.7.3 lib/inspec/plugin/v2.rb
inspec-core-4.6.9 lib/inspec/plugin/v2.rb
inspec-4.6.9 lib/inspec/plugin/v2.rb
inspec-core-4.6.4 lib/inspec/plugin/v2.rb
inspec-4.6.4 lib/inspec/plugin/v2.rb
inspec-core-4.6.3 lib/inspec/plugin/v2.rb
inspec-4.6.3 lib/inspec/plugin/v2.rb