Sha256: 31c669d48509f5dc85eacbdb1003708caa117cded5a28ed8cee447c8be2b260b
Contents?: true
Size: 949 Bytes
Versions: 18
Compression:
Stored size: 949 Bytes
Contents
require 'singleton' module Kontena class PluginManager include Singleton attr_reader :plugins def initialize @plugins = [] end # @return [Array<Gem::Specification>] def load_plugins Gem::Specification.to_a.each do |spec| spec.require_paths.to_a.each do |require_path| plugin = File.join(spec.gem_dir, require_path, 'kontena_cli_plugin.rb') if File.exist?(plugin) && !@plugins.find{ |p| p.name == spec.name } begin load(plugin) @plugins << spec rescue LoadError => exc STDERR.puts "failed to load plugin: #{spec.name}" if ENV['DEBUG'] STDERR.puts exc.message STDERR.puts exc.backtrace.join("\n") end exit 1 end end end end @plugins rescue => exc STDERR.puts exc.message end end end
Version data entries
18 entries across 18 versions & 1 rubygems