Module: See::Plugins

Defined in:
lib/see/plugins.rb,
lib/see/plugins/circle.rb,
lib/see/plugins/github.rb,
lib/see/plugins/travis.rb,
lib/see/plugins/pivotal.rb

Defined Under Namespace

Classes: Circle, GitHub, Pivotal, Plugin, TravisCI

Class Method Summary collapse

Class Method Details

.find_plugins(name) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/see/plugins.rb', line 5

def self.find_plugins(name)
  See::Plugins.constants.select do |const|
    const != :Plugin
  end.map do |const|
    See::Plugins.const_get(const).new
  end.select do |plugin|
    plugin.config_name == name
  end
end

.run_plugin(name, config) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/see/plugins.rb', line 15

def self.run_plugin(name, config)
  plugins = find_plugins(name)
  if plugins.empty?
    return ["\nNo plugin found with the name \"#{name}\"".light_red]
  end

  lines = ["\n"]
  lines << plugins.map do |plugin|
    lines_from_plugin = [plugin.display_name.light_magenta]
    begin
      lines_from_plugin << plugin.run(config, config[plugin.config_name])
    rescue => error
      lines_from_plugin << ["  #{error.message}".red]
    end
  end
end