Class: GemsStatus::Runner
- Inherits:
-
Object
- Object
- GemsStatus::Runner
- Defined in:
- lib/gems-status/runner.rb
Instance Attribute Summary collapse
-
#checker_results ⇒ Object
Returns the value of attribute checker_results.
-
#gem_list ⇒ Object
Returns the value of attribute gem_list.
-
#source ⇒ Object
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #add_checker(check_object) ⇒ Object
- #add_comments(comments) ⇒ Object
- #are_there_gems? ⇒ Boolean
- #execute ⇒ Object
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #print ⇒ Object
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
9 10 11 12 13 14 15 |
# File 'lib/gems-status/runner.rb', line 9 def initialize @source = nil @checkers = [] @checker_results = {} @comments = {} @gem_list = nil end |
Instance Attribute Details
#checker_results ⇒ Object
Returns the value of attribute checker_results.
7 8 9 |
# File 'lib/gems-status/runner.rb', line 7 def checker_results @checker_results end |
#gem_list ⇒ Object
Returns the value of attribute gem_list.
7 8 9 |
# File 'lib/gems-status/runner.rb', line 7 def gem_list @gem_list end |
#source ⇒ Object
Returns the value of attribute source.
7 8 9 |
# File 'lib/gems-status/runner.rb', line 7 def source @source end |
Class Method Details
.setup_runner(conf) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gems-status/runner.rb', line 17 def Runner.setup_runner(conf) GemsStatus::Utils::known_licenses = conf["licenses"] runner = GemsStatus::Runner.new c = conf["source"] gems = eval("GemsStatus::#{c["classname"]}").new(c) runner.source = gems if conf["checkers"] conf["checkers"].each do |c| checker = eval("GemsStatus::#{c["classname"]}").new(c) runner.add_checker(checker) end end if conf["comments"] runner.add_comments(conf["comments"]) end return runner end |
Instance Method Details
#add_checker(check_object) ⇒ Object
35 36 37 |
# File 'lib/gems-status/runner.rb', line 35 def add_checker(check_object) @checkers << check_object end |
#add_comments(comments) ⇒ Object
53 54 55 |
# File 'lib/gems-status/runner.rb', line 53 def add_comments(comments) @comments = comments end |
#are_there_gems? ⇒ Boolean
57 58 59 |
# File 'lib/gems-status/runner.rb', line 57 def are_there_gems? return @gem_list && !@gem_list.empty? end |
#execute ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/gems-status/runner.rb', line 39 def execute return unless @source @gem_list = @source.gem_list @checkers.each do |check_object| Utils::log_debug "checking #{check_object.class.name}" @gem_list.each do |name, gem| if !check_object.check?(gem) @checker_results[name] = [] unless @checker_results[name] @checker_results[name] << check_object.clone end end end end |
#print ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/gems-status/runner.rb', line 61 def print return if !are_there_gems? view = TextView.new view.print_head ids = @source.filename view.print_description(ids) view.print_results(@gem_list, @checker_results, @comments) view.print_tail end |