Class: GemWatch::Check::Update

Inherits:
GemWatch::Check show all
Defined in:
lib/gem_watch/checks/update.rb

Overview

Implements a simple check to assure that installed gem(s) are up to date.

Instance Attribute Summary

Attributes inherited from GemWatch::Check

#gem_name, #impacts

Instance Method Summary collapse

Methods inherited from GemWatch::Check

#initialize, #passed?

Constructor Details

This class inherits a constructor from GemWatch::Check

Instance Method Details

#resultsObject

Displays a formated result with gem name, local and remote version.



17
18
19
20
21
# File 'lib/gem_watch/checks/update.rb', line 17

def results
  @impacts.collect do |name, (local_version, remote_version)|
    "%-20s%-10s%s" % [name, local_version, remote_version]
  end
end

#runObject

Check if specified gem(s) are up to date.



8
9
10
11
12
13
14
# File 'lib/gem_watch/checks/update.rb', line 8

def run
  if gem_name.to_s == 'all'
    Gem::SourceIndex.from_installed_gems.outdated.each {|g| run_on g}
  else
    run_on gem_name
  end
end