Class: GemFresh::Reporter
- Inherits:
-
Object
- Object
- GemFresh::Reporter
- Defined in:
- lib/gem_fresh/reporter.rb
Instance Method Summary collapse
-
#initialize ⇒ Reporter
constructor
A new instance of Reporter.
- #report ⇒ Object
Constructor Details
#initialize ⇒ Reporter
Returns a new instance of Reporter.
4 5 6 7 8 |
# File 'lib/gem_fresh/reporter.rb', line 4 def initialize Missing.new.check_for_missing_gems! @calculator = Calculator.new @calculator.calculate! end |
Instance Method Details
#report ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gem_fresh/reporter.rb', line 10 def report puts puts "A bounty is calculated for each gem based on how outdated the gem" puts "is and the impact the gem has on the application code. Foundational" puts "gems like RSpec get a higher bounty, simple add-on tools like bullet" puts "get a lower bounty. See Gemfresh.rb for details." puts puts "The total bounty is #{@calculator.total_score} points." puts puts "These are the outdated gems, sorted by highest bounty:" puts sorted_scores = @calculator.all_scores.sort_by{|gem_name, score| [-score, gem_name]} sorted_scores.each do |gem_name, score| name = " #{gem_name.ljust(25)[0..24]} " if score >= 1000 puts "#{name} #{score}" elsif score > 0 puts "#{name} #{score}" else puts "#{name} up to date" end end puts end |