diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 32f3f5288a..b6f616ec3a 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -607,7 +607,7 @@ def check_for_config_scripts configs = Dir["#{p}/*-config"] # puts "#{p}\n #{configs * ' '}" unless configs.empty? - config_scripts << [p, configs.collect {|p| File.basename(p)}] unless configs.empty? + config_scripts << [p, configs.map { |c| File.basename(c) }] unless configs.empty? end unless config_scripts.empty? diff --git a/Library/Homebrew/cmd/prune.rb b/Library/Homebrew/cmd/prune.rb index 29e57ee3ef..e2c4ef3103 100644 --- a/Library/Homebrew/cmd/prune.rb +++ b/Library/Homebrew/cmd/prune.rb @@ -9,9 +9,9 @@ module Homebrew extend self $d = 0 dirs = [] - Keg::PRUNEABLE_DIRECTORIES.each do |path| - next unless path.directory? - path.find do |path| + Keg::PRUNEABLE_DIRECTORIES.each do |dir| + next unless dir.directory? + dir.find do |path| path.extend ObserverPathnameExtension if path.symlink? unless path.resolved_path_exists? diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb index eaaf041b56..4742dcfb59 100644 --- a/Library/Homebrew/compilers.rb +++ b/Library/Homebrew/compilers.rb @@ -149,10 +149,10 @@ class CompilerSelector so that we can update the formula accordingly. Thanks! EOS - viable = @compilers.reject { |cc| @f.fails_with? cc } + viable = @compilers.reject { |c| @f.fails_with? c } unless viable.empty? warning += "\nIf it fails you can use " - options = viable.map { |cc| "--use-#{cc.name}" } + options = viable.map { |c| "--use-#{c.name}" } warning += "#{options*' or '} to try a different compiler." end diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index 6ac5a0db24..c8b5672399 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -391,9 +391,9 @@ class << ENV def remove_from_cflags f remove cc_flag_vars, f end - def append key, value, separator = ' ' + def append keys, value, separator = ' ' value = value.to_s - [*key].each do |key| + Array(keys).each do |key| unless self[key].to_s.empty? self[key] = self[key] + separator + value.to_s else @@ -401,8 +401,8 @@ class << ENV end end end - def prepend key, value, separator = ' ' - [*key].each do |key| + def prepend keys, value, separator = ' ' + Array(keys).each do |key| unless self[key].to_s.empty? self[key] = value.to_s + separator + self[key] else @@ -413,8 +413,8 @@ class << ENV def prepend_path key, path prepend key, path, ':' if File.directory? path end - def remove key, value - [*key].each do |key| + def remove keys, value + Array(keys).each do |key| next unless self[key] self[key] = self[key].sub(value, '') delete(key) if self[key].to_s.empty? diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 0ebb1441d9..eef9e1e0d7 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -36,9 +36,9 @@ class Keg < Pathname # of files and directories linked $n=$d=0 - TOP_LEVEL_DIRECTORIES.map{ |d| self/d }.each do |src| - next unless src.exist? - src.find do |src| + TOP_LEVEL_DIRECTORIES.map{ |d| self/d }.each do |dir| + next unless dir.exist? + dir.find do |src| next if src == self dst=HOMEBREW_PREFIX+src.relative_path_from(self) dst.extend ObserverPathnameExtension diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 150cf3c769..955c1e8f20 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -199,8 +199,8 @@ def archs_for_command cmd Pathname.new(cmd).archs end -def inreplace path, before=nil, after=nil - [*path].each do |path| +def inreplace paths, before=nil, after=nil + Array(paths).each do |path| f = File.open(path, 'r') s = f.read