Sha256: 482de774c8831d61f6fd06ef4cc766b5586477386dbb20370bb5e2c7fc80415a

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 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 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/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

6 entries across 6 versions & 2 rubygems

Version Path
inspec-core-2.3.10 lib/inspec/plugin/v2.rb
inspec-2.3.10 lib/inspec/plugin/v2.rb
inspec-core-2.3.5 lib/inspec/plugin/v2.rb
inspec-2.3.5 lib/inspec/plugin/v2.rb
inspec-core-2.3.4 lib/inspec/plugin/v2.rb
inspec-2.3.4 lib/inspec/plugin/v2.rb