Sha256: 9ff72ed29f26cb91ee9e3f775573d64ca78c850c63ba125475ace979a207acec
Contents?: true
Size: 969 Bytes
Versions: 3
Compression:
Stored size: 969 Bytes
Contents
require "rubygems" require "gem_watch/check" # Implements a simple check to assure that installed gem(s) are up to date. class GemWatch::Check::Update < GemWatch::Check # Check if specified gem(s) are up to date. 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 # Displays a formated result with gem name, local and remote version. def results @impacts.collect do |name, (local_version, remote_version)| "%-20s%-10s%s" % [name, local_version, remote_version] end end private def run_on(gem_name) local = Gem::SourceIndex.from_installed_gems.find_name(gem_name).last dep = Gem::Dependency.new local.name, ">= #{local.version}" remotes = Gem::SpecFetcher.fetcher.fetch dep remote = remotes.last.first @impacts[local.name] = [local.version, remote.version] if local.version != remote.version end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gem_watch-0.1.2 | lib/gem_watch/checks/update.rb |
gem_watch-0.1.0 | lib/gem_watch/checks/update.rb |
gem_watch-0.1.1 | lib/gem_watch/checks/update.rb |