Don't shadow outer local variables

This commit is contained in:
Jack Nagel 2013-02-17 22:54:43 -06:00
parent 1a799f04e6
commit f037be5148
6 changed files with 17 additions and 17 deletions

View File

@ -607,7 +607,7 @@ def check_for_config_scripts
configs = Dir["#{p}/*-config"] configs = Dir["#{p}/*-config"]
# puts "#{p}\n #{configs * ' '}" unless configs.empty? # 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 end
unless config_scripts.empty? unless config_scripts.empty?

View File

@ -9,9 +9,9 @@ module Homebrew extend self
$d = 0 $d = 0
dirs = [] dirs = []
Keg::PRUNEABLE_DIRECTORIES.each do |path| Keg::PRUNEABLE_DIRECTORIES.each do |dir|
next unless path.directory? next unless dir.directory?
path.find do |path| dir.find do |path|
path.extend ObserverPathnameExtension path.extend ObserverPathnameExtension
if path.symlink? if path.symlink?
unless path.resolved_path_exists? unless path.resolved_path_exists?

View File

@ -149,10 +149,10 @@ class CompilerSelector
so that we can update the formula accordingly. Thanks! so that we can update the formula accordingly. Thanks!
EOS EOS
viable = @compilers.reject { |cc| @f.fails_with? cc } viable = @compilers.reject { |c| @f.fails_with? c }
unless viable.empty? unless viable.empty?
warning += "\nIf it fails you can use " 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." warning += "#{options*' or '} to try a different compiler."
end end

View File

@ -391,9 +391,9 @@ class << ENV
def remove_from_cflags f def remove_from_cflags f
remove cc_flag_vars, f remove cc_flag_vars, f
end end
def append key, value, separator = ' ' def append keys, value, separator = ' '
value = value.to_s value = value.to_s
[*key].each do |key| Array(keys).each do |key|
unless self[key].to_s.empty? unless self[key].to_s.empty?
self[key] = self[key] + separator + value.to_s self[key] = self[key] + separator + value.to_s
else else
@ -401,8 +401,8 @@ class << ENV
end end
end end
end end
def prepend key, value, separator = ' ' def prepend keys, value, separator = ' '
[*key].each do |key| Array(keys).each do |key|
unless self[key].to_s.empty? unless self[key].to_s.empty?
self[key] = value.to_s + separator + self[key] self[key] = value.to_s + separator + self[key]
else else
@ -413,8 +413,8 @@ class << ENV
def prepend_path key, path def prepend_path key, path
prepend key, path, ':' if File.directory? path prepend key, path, ':' if File.directory? path
end end
def remove key, value def remove keys, value
[*key].each do |key| Array(keys).each do |key|
next unless self[key] next unless self[key]
self[key] = self[key].sub(value, '') self[key] = self[key].sub(value, '')
delete(key) if self[key].to_s.empty? delete(key) if self[key].to_s.empty?

View File

@ -36,9 +36,9 @@ class Keg < Pathname
# of files and directories linked # of files and directories linked
$n=$d=0 $n=$d=0
TOP_LEVEL_DIRECTORIES.map{ |d| self/d }.each do |src| TOP_LEVEL_DIRECTORIES.map{ |d| self/d }.each do |dir|
next unless src.exist? next unless dir.exist?
src.find do |src| dir.find do |src|
next if src == self next if src == self
dst=HOMEBREW_PREFIX+src.relative_path_from(self) dst=HOMEBREW_PREFIX+src.relative_path_from(self)
dst.extend ObserverPathnameExtension dst.extend ObserverPathnameExtension

View File

@ -199,8 +199,8 @@ def archs_for_command cmd
Pathname.new(cmd).archs Pathname.new(cmd).archs
end end
def inreplace path, before=nil, after=nil def inreplace paths, before=nil, after=nil
[*path].each do |path| Array(paths).each do |path|
f = File.open(path, 'r') f = File.open(path, 'r')
s = f.read s = f.read