Leopard: Fix undefined method count for Array

Leopard runs Ruby 1.8.6 while Snow Leopard runs 1.8.7 and `Array.count` was not
introduced until 1.8.7.

Using `Array.length` instead.
This commit is contained in:
Charlie Sharpsteen 2011-08-24 17:33:28 -07:00
parent 98fc60db69
commit f7bd98875b
3 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ module Homebrew extend self
ARGV.formulae.map{ |f| [f.prefix.parent, f.name, f.version] }
end
if outdated.count > 1
if outdated.length > 1
oh1 "Upgrading #{outdated.count} outdated package#{outdated.count.plural_s}, with result:"
puts outdated.map{ |_, name, version| "#{name} #{version}" } * ", "
end

View File

@ -512,7 +512,7 @@ private
def verify_download_integrity fn, *args
require 'digest'
if args.count != 2
if args.length != 2
type=CHECKSUM_TYPES.detect { |type| instance_variable_defined?("@#{type}") }
type ||= :md5
supplied=instance_variable_get("@#{type}")

View File

@ -176,7 +176,7 @@ class FormulaInstaller
def check_PATH
# warn the user if stuff was installed outside of their PATH
[f.bin, f.sbin].each do |bin|
if bin.directory? and bin.children.count > 0
if bin.directory? and bin.children.length > 0
bin = (HOMEBREW_PREFIX/bin.basename).realpath.to_s
unless paths.include? bin
opoo "#{bin} is not in your PATH"