aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2013-02-17 22:54:43 -0600
committerJack Nagel2013-02-18 12:13:36 -0600
commit4d341f2115661b3e88589d91b5df74c9d889b778 (patch)
tree99ec33a9e576555457b5cef9637688a9cb5ef0e5
parent33393a2597916d8e73009dd981dfcb07ea669434 (diff)
downloadhomebrew-4d341f2115661b3e88589d91b5df74c9d889b778.tar.bz2
Don't shadow outer local variables
-rw-r--r--Library/Homebrew/cmd/doctor.rb2
-rw-r--r--Library/Homebrew/cmd/prune.rb6
-rw-r--r--Library/Homebrew/compilers.rb4
-rw-r--r--Library/Homebrew/extend/ENV.rb12
-rw-r--r--Library/Homebrew/keg.rb6
-rw-r--r--Library/Homebrew/utils.rb4
6 files changed, 17 insertions, 17 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 32f3f5288..b6f616ec3 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 29e57ee3e..e2c4ef310 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 eaaf041b5..4742dcfb5 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 6ac5a0db2..c8b567239 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 0ebb1441d..eef9e1e0d 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 150cf3c76..955c1e8f2 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