class Capistrano::Doctor::GemsDoctor

Prints table of all Capistrano-related gems and their version numbers. If there is a newer version of a gem available, call attention to it.

Public Instance Methods

call() click to toggle source
# File lib/capistrano/doctor/gems_doctor.rb, line 10
def call
  title("Gems")
  table(all_gem_names) do |gem, row|
    row.yellow if update_available?(gem)
    row << gem
    row << installed_gem_version(gem)
    row << "(update available)" if update_available?(gem)
  end
end

Private Instance Methods

all_gem_names() click to toggle source
# File lib/capistrano/doctor/gems_doctor.rb, line 32
def all_gem_names
  core_gem_names + plugin_gem_names
end
core_gem_names() click to toggle source
# File lib/capistrano/doctor/gems_doctor.rb, line 36
def core_gem_names
  %w(capistrano airbrussh rake sshkit) & Gem.loaded_specs.keys
end
installed_gem_version(gem_name) click to toggle source
# File lib/capistrano/doctor/gems_doctor.rb, line 22
def installed_gem_version(gem_name)
  Gem.loaded_specs[gem_name].version
end
plugin_gem_names() click to toggle source
# File lib/capistrano/doctor/gems_doctor.rb, line 40
def plugin_gem_names
  (Gem.loaded_specs.keys - ["capistrano"]).grep(/capistrano/).sort
end
update_available?(gem_name) click to toggle source
# File lib/capistrano/doctor/gems_doctor.rb, line 26
def update_available?(gem_name)
  latest = Gem.latest_version_for(gem_name)
  return false if latest.nil?
  latest > installed_gem_version(gem_name)
end