Class: Denmark::Plugins

Inherits:
Object
  • Object
show all
Defined in:
lib/denmark/plugins.rb

Overview

metrics class

Defined Under Namespace

Classes: Issues, Metadata, PullRequests, Timeline

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Plugins

Returns a new instance of Plugins.



9
10
11
12
13
14
15
16
17
# File 'lib/denmark/plugins.rb', line 9

def initialize(options)
  if options[:enable]
    disable = Denmark::Plugins.plugins.keys - options[:enable].map(&:to_sym)
    options[:disable] ||= Array.new
    options[:disable].concat disable
  end
  Denmark::Plugins.disregard_plugins(*options[:disable])
  Denmark::Plugins.initialize_plugins
end

Instance Method Details

#listObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/denmark/plugins.rb', line 19

def list
  str = "                    Available smell test plugins\n"
  str += "                 ===============================\n\n"
  Denmark::Plugins.plugins.each do |name, plugin|
    str += name.to_s
    str += "\n--------\n"
    str += plugin.description.strip
    str += "\n\n"
  end
  str
end

#run(mod, repo) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/denmark/plugins.rb', line 31

def run(mod, repo)
  results = []
  Denmark::Plugins.plugins.each do |_name, plugin|
    plugin.setup
    results.concat plugin.run(mod, repo)
    plugin.cleanup
  end
  results
end