Sha256: d6536e92515c0c7d5e34e6ad5bde754185eab3185dcc55c1446c159f9537fa48

Contents?: true

Size: 630 Bytes

Versions: 2

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

require 'bolt/plugin/puppetdb'
require 'bolt/plugin/terraform'

module Bolt
  class Plugin
    def self.setup(config, pdb_client)
      plugins = new(config)
      plugins.add_plugin(Bolt::Plugin::Puppetdb.new(pdb_client))
      plugins.add_plugin(Bolt::Plugin::Terraform.new)
      plugins
    end

    def initialize(_config)
      @plugins = {}
    end

    def add_plugin(plugin)
      @plugins[plugin.name] = plugin
    end

    def for_hook(hook)
      @plugins.filter { |_n, plug| plug.hooks.include? hook }
    end

    def by_name(plugin_name)
      @plugins[plugin_name]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bolt-1.21.0 lib/bolt/plugin.rb
bolt-1.20.0 lib/bolt/plugin.rb