brew/Library/Homebrew/cmd/outdated.rb
Jack Nagel 8b763acc2a outdated: always do comparisons with a Formula as the receiver
It is possible for the object returned by Formula#version to be a
subclass of Version with special behavior, so we want to use that for
the comparison.
2013-05-14 20:11:48 -05:00

26 lines
570 B
Ruby

require 'formula'
require 'keg'
module Homebrew extend self
def outdated
outdated_brews do |f|
if $stdout.tty? and not ARGV.flag? '--quiet'
versions = f.rack.subdirs.map { |d| Keg.new(d).version }.sort
puts "#{f.name} (#{versions*', '} < #{f.version})"
else
puts f.name
end
end
end
def outdated_brews
Formula.installed.map do |f|
kegs = f.rack.subdirs.map { |d| Keg.new(d) }
if kegs.all? { |k| f.version > k.version }
yield f if block_given?
f
end
end.compact
end
end