aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-05-31 10:00:24 -0500
committerJack Nagel2014-05-31 10:08:36 -0500
commit809ba1e4c2741c115d001fcc43106b9cde9779e9 (patch)
tree65cd8466ec23e31392d9d0e9e330a2aae8230ce2
parent493272b769bbce3d11dcec50645facec28fd0078 (diff)
downloadhomebrew-809ba1e4c2741c115d001fcc43106b9cde9779e9.tar.bz2
Prefer Dir.glob when iterating over the result
-rw-r--r--Library/Formula/couchdb-lucene.rb2
-rw-r--r--Library/Formula/dex2jar.rb2
-rw-r--r--Library/Formula/elixir.rb2
-rw-r--r--Library/Formula/gdal.rb2
-rw-r--r--Library/Formula/groovy.rb2
-rw-r--r--Library/Formula/jena.rb2
-rw-r--r--Library/Formula/jetty.rb4
-rw-r--r--Library/Formula/luciddb.rb2
-rw-r--r--Library/Formula/nss.rb10
-rw-r--r--Library/Formula/shrewsoft-vpn-client.rb5
10 files changed, 14 insertions, 19 deletions
diff --git a/Library/Formula/couchdb-lucene.rb b/Library/Formula/couchdb-lucene.rb
index 8e17a61a2..f9ea6470a 100644
--- a/Library/Formula/couchdb-lucene.rb
+++ b/Library/Formula/couchdb-lucene.rb
@@ -18,7 +18,7 @@ class CouchdbLucene < Formula
rm_rf Dir["bin/*.bat"]
libexec.install Dir["*"]
- Dir["#{libexec}/bin/*"].each do |path|
+ Dir.glob("#{libexec}/bin/*") do |path|
bin_name = File.basename(path)
(bin+bin_name).write shim_script(bin_name)
end
diff --git a/Library/Formula/dex2jar.rb b/Library/Formula/dex2jar.rb
index 86ce69542..edb765ee1 100644
--- a/Library/Formula/dex2jar.rb
+++ b/Library/Formula/dex2jar.rb
@@ -13,7 +13,7 @@ class Dex2jar < Formula
prefix.install_metafiles
libexec.install Dir['*']
- Dir["#{libexec}/*.sh"].each do |script|
+ Dir.glob("#{libexec}/*.sh") do |script|
bin.install_symlink script => File.basename(script, '.sh')
end
end
diff --git a/Library/Formula/elixir.rb b/Library/Formula/elixir.rb
index 945549b85..d380d5047 100644
--- a/Library/Formula/elixir.rb
+++ b/Library/Formula/elixir.rb
@@ -36,7 +36,7 @@ class Elixir < Formula
system "make"
bin.install Dir['bin/*'] - Dir['bin/*.bat']
- Dir['lib/*/ebin'].each do |path|
+ Dir.glob("lib/*/ebin") do |path|
app = File.basename(File.dirname(path))
(lib/app).install path
end
diff --git a/Library/Formula/gdal.rb b/Library/Formula/gdal.rb
index 99a576858..b15218565 100644
--- a/Library/Formula/gdal.rb
+++ b/Library/Formula/gdal.rb
@@ -289,7 +289,7 @@ class Gdal < Formula
system 'make', 'man' if build.head?
system 'make', 'install-man'
# Clean up any stray doxygen files.
- Dir[bin + '*.dox'].each { |p| rm p }
+ Dir.glob("#{bin}/*.dox") { |p| rm p }
end
def caveats
diff --git a/Library/Formula/groovy.rb b/Library/Formula/groovy.rb
index e6fffa9d2..8042fc4a9 100644
--- a/Library/Formula/groovy.rb
+++ b/Library/Formula/groovy.rb
@@ -12,7 +12,7 @@ class Groovy < Formula
rm_f Dir["bin/*.bat"]
if build.include? 'invokedynamic'
- Dir['indy/*.jar'].each do |src_path|
+ Dir.glob("indy/*.jar") do |src_path|
dst_file = File.basename(src_path, '-indy.jar') + '.jar'
dst_path = File.join('lib', dst_file)
mv src_path, dst_path
diff --git a/Library/Formula/jena.rb b/Library/Formula/jena.rb
index be678a4a3..9da5fec77 100644
--- a/Library/Formula/jena.rb
+++ b/Library/Formula/jena.rb
@@ -19,7 +19,7 @@ class Jena < Formula
prefix.install %w{ LICENSE ReleaseNotes-Jena.txt NOTICE ReleaseNotes-TDB.txt README ReleaseNotes-ARQ.txt }
doc.install ['javadoc-arq', 'javadoc-core', 'javadoc-sdb', 'javadoc-tdb', 'src-examples']
libexec.install Dir['*']
- Dir["#{libexec}/bin/*"].each do |path|
+ Dir.glob("#{libexec}/bin/*") do |path|
bin_name = File.basename(path)
(bin+bin_name).write shim_script(bin_name)
end
diff --git a/Library/Formula/jetty.rb b/Library/Formula/jetty.rb
index 6cf3b65c7..169b9a356 100644
--- a/Library/Formula/jetty.rb
+++ b/Library/Formula/jetty.rb
@@ -11,12 +11,12 @@ class Jetty < Formula
(libexec+'logs').mkpath
bin.mkpath
- Dir["#{libexec}/bin/*.sh"].each do |f|
+ Dir.glob("#{libexec}/bin/*.sh") do |f|
scriptname = File.basename(f, '.sh')
(bin+scriptname).write <<-EOS.undent
#!/bin/bash
JETTY_HOME=#{libexec}
- #{f} $@
+ #{f} "$@"
EOS
chmod 0755, bin+scriptname
end
diff --git a/Library/Formula/luciddb.rb b/Library/Formula/luciddb.rb
index 5ddcaa7df..12189ad54 100644
--- a/Library/Formula/luciddb.rb
+++ b/Library/Formula/luciddb.rb
@@ -21,7 +21,7 @@ class Luciddb < Formula
ENV['JAVA_HOME'] = `/usr/libexec/java_home`.chomp
system "./install.sh"
end
- Dir["#{libexec}/bin/*"].each do |b|
+ Dir.glob("#{libexec}/bin/*") do |b|
next if b =~ /classpath.gen/ or b =~ /defineFarragoRuntime/
n = File.basename(b)
(bin+n).write shim_script(n)
diff --git a/Library/Formula/nss.rb b/Library/Formula/nss.rb
index 670b9a6bc..edff2c472 100644
--- a/Library/Formula/nss.rb
+++ b/Library/Formula/nss.rb
@@ -38,22 +38,18 @@ class Nss < Formula
# rather than copying the referenced file.
cd "../dist"
bin.mkdir
- Dir["Darwin*/bin/*"].each do |file|
+ Dir.glob("Darwin*/bin/*") do |file|
cp file, bin unless file.include? ".dylib"
end
include.mkdir
include_target = include + "nss"
include_target.mkdir
- ["dbm", "nss"].each do |dir|
- Dir["public/#{dir}/*"].each do |file|
- cp file, include_target
- end
- end
+ Dir.glob("public/{dbm,nss}/*") { |file| cp file, include_target }
lib.mkdir
libexec.mkdir
- Dir["Darwin*/lib/*"].each do |file|
+ Dir.glob("Darwin*/lib/*") do |file|
cp file, lib unless file.include? ".chk"
cp file, libexec if file.include? ".chk"
end
diff --git a/Library/Formula/shrewsoft-vpn-client.rb b/Library/Formula/shrewsoft-vpn-client.rb
index b10d10202..116ea9681 100644
--- a/Library/Formula/shrewsoft-vpn-client.rb
+++ b/Library/Formula/shrewsoft-vpn-client.rb
@@ -20,8 +20,7 @@ class ShrewsoftVpnClient < Formula
# https://lists.shrew.net/pipermail/vpn-devel/2014-January/000636.html
# there is no suport for an alternate Frameworks folder, must change hard-coded paths
- ["package/macosx/vpn-client-install.packproj"] +
- Dir["source/*/CMakeLists.txt"].each do |path|
+ Dir.glob(%w[source/*/CMakeLists.txt package/macosx/vpn-client-install.packproj]) do |path|
next unless File.read(path).include? "/Library/Frameworks"
inreplace path, "/Library/Frameworks", frameworks
end
@@ -51,7 +50,7 @@ class ShrewsoftVpnClient < Formula
system "cmake", *cmake_args
# change relative framework paths to absolute ones (otherwise /Library/Frameworks is assumed)
- Dir["source/*/cmake_install.cmake"].each do |path|
+ Dir.glob("source/*/cmake_install.cmake") do |path|
inreplace path, /"(ShrewSoft.+?\.framework)/, "\"#{frameworks}/\\1"
end