aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/--env.rb4
-rw-r--r--Library/Homebrew/cmd/--prefix.rb2
-rw-r--r--Library/Homebrew/cmd/aspell-dictionaries.rb9
-rw-r--r--Library/Homebrew/cmd/audit.rb180
-rw-r--r--Library/Homebrew/cmd/bottle.rb56
-rw-r--r--Library/Homebrew/cmd/cleanup.rb28
-rw-r--r--Library/Homebrew/cmd/command.rb2
-rw-r--r--Library/Homebrew/cmd/commands.rb10
-rw-r--r--Library/Homebrew/cmd/config.rb20
-rw-r--r--Library/Homebrew/cmd/create.rb26
-rw-r--r--Library/Homebrew/cmd/deps.rb22
-rw-r--r--Library/Homebrew/cmd/doctor.rb1088
-rw-r--r--Library/Homebrew/cmd/edit.rb10
-rw-r--r--Library/Homebrew/cmd/fetch.rb20
-rw-r--r--Library/Homebrew/cmd/gist-logs.rb48
-rw-r--r--Library/Homebrew/cmd/help.rb1
-rw-r--r--Library/Homebrew/cmd/info.rb36
-rw-r--r--Library/Homebrew/cmd/install.rb27
-rw-r--r--Library/Homebrew/cmd/irb.rb6
-rw-r--r--Library/Homebrew/cmd/leaves.rb6
-rw-r--r--Library/Homebrew/cmd/link.rb4
-rw-r--r--Library/Homebrew/cmd/linkapps.rb4
-rw-r--r--Library/Homebrew/cmd/list.rb49
-rw-r--r--Library/Homebrew/cmd/man.rb2
-rw-r--r--Library/Homebrew/cmd/missing.rb8
-rw-r--r--Library/Homebrew/cmd/options.rb10
-rw-r--r--Library/Homebrew/cmd/outdated.rb12
-rw-r--r--Library/Homebrew/cmd/pin.rb2
-rw-r--r--Library/Homebrew/cmd/prune.rb6
-rw-r--r--Library/Homebrew/cmd/pull.rb56
-rw-r--r--Library/Homebrew/cmd/reinstall.rb8
-rw-r--r--Library/Homebrew/cmd/search.rb35
-rw-r--r--Library/Homebrew/cmd/sh.rb12
-rw-r--r--Library/Homebrew/cmd/switch.rb2
-rw-r--r--Library/Homebrew/cmd/tap-readme.rb2
-rw-r--r--Library/Homebrew/cmd/tap.rb8
-rw-r--r--Library/Homebrew/cmd/test-bot.rb158
-rw-r--r--Library/Homebrew/cmd/test.rb1
-rw-r--r--Library/Homebrew/cmd/uninstall.rb8
-rw-r--r--Library/Homebrew/cmd/unlinkapps.rb4
-rw-r--r--Library/Homebrew/cmd/unpack.rb4
-rw-r--r--Library/Homebrew/cmd/unpin.rb2
-rw-r--r--Library/Homebrew/cmd/untap.rb4
-rw-r--r--Library/Homebrew/cmd/update.rb24
-rw-r--r--Library/Homebrew/cmd/upgrade.rb15
-rw-r--r--Library/Homebrew/cmd/uses.rb6
46 files changed, 1020 insertions, 1027 deletions
diff --git a/Library/Homebrew/cmd/--env.rb b/Library/Homebrew/cmd/--env.rb
index fb6163d81..eba497253 100644
--- a/Library/Homebrew/cmd/--env.rb
+++ b/Library/Homebrew/cmd/--env.rb
@@ -16,7 +16,7 @@ module Homebrew
end
end
- def build_env_keys env
+ def build_env_keys(env)
%w[
CC CXX LD OBJC OBJCXX
HOMEBREW_CC HOMEBREW_CXX
@@ -30,7 +30,7 @@ module Homebrew
ACLOCAL_PATH PATH CPATH].select { |key| env.key?(key) }
end
- def dump_build_env env, f=$stdout
+ def dump_build_env(env, f = $stdout)
keys = build_env_keys(env)
keys -= %w[CC CXX OBJC OBJCXX] if env["CC"] == env["HOMEBREW_CC"]
diff --git a/Library/Homebrew/cmd/--prefix.rb b/Library/Homebrew/cmd/--prefix.rb
index 535a7b422..a822f2646 100644
--- a/Library/Homebrew/cmd/--prefix.rb
+++ b/Library/Homebrew/cmd/--prefix.rb
@@ -3,7 +3,7 @@ module Homebrew
if ARGV.named.empty?
puts HOMEBREW_PREFIX
else
- puts ARGV.resolved_formulae.map{ |f| f.opt_prefix.exist? ? f.opt_prefix : f.installed_prefix }
+ puts ARGV.resolved_formulae.map { |f| f.opt_prefix.exist? ? f.opt_prefix : f.installed_prefix }
end
end
end
diff --git a/Library/Homebrew/cmd/aspell-dictionaries.rb b/Library/Homebrew/cmd/aspell-dictionaries.rb
index 8e9197bda..f610ecfbd 100644
--- a/Library/Homebrew/cmd/aspell-dictionaries.rb
+++ b/Library/Homebrew/cmd/aspell-dictionaries.rb
@@ -1,6 +1,6 @@
-require 'open-uri'
-require 'resource'
-require 'formula'
+require "open-uri"
+require "resource"
+require "formula"
module Homebrew
def aspell_dictionaries
@@ -14,7 +14,8 @@ module Homebrew
next unless /^<tr><td><a/ === line
fields = line.split('"')
- lang, path = fields[1], fields[3]
+ lang = fields[1]
+ path = fields[3]
lang.gsub!("-", "_")
languages[lang] = path
end
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index 9e70b73d4..c9db7f93c 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -41,7 +41,7 @@ module Homebrew
end
$times = {}
- at_exit { puts $times.sort_by{ |k, v| v }.map{ |k, v| "#{k}: #{v}" } }
+ at_exit { puts $times.sort_by { |_k, v| v }.map { |k, v| "#{k}: #{v}" } }
end
ff = if ARGV.named.empty?
@@ -78,7 +78,7 @@ module Homebrew
end
class FormulaText
- def initialize path
+ def initialize(path)
@text = path.open("rb", &:read)
@lines = @text.lines.to_a
end
@@ -99,11 +99,11 @@ class FormulaText
/\Z\n/ =~ @text
end
- def =~ regex
+ def =~(regex)
regex =~ @text
end
- def line_number regex
+ def line_number(regex)
index = @lines.index { |line| line =~ regex }
index ? index + 1 : nil
end
@@ -131,13 +131,13 @@ class FormulaAuditor
FILEUTILS_METHODS = FileUtils.singleton_methods(false).join "|"
- def initialize(formula, options={})
+ def initialize(formula, options = {})
@formula = formula
@strict = !!options[:strict]
@online = !!options[:online]
@problems = []
@text = FormulaText.new(formula.path)
- @specs = %w{stable devel head}.map { |s| formula.send(s) }.compact
+ @specs = %w[stable devel head].map { |s| formula.send(s) }.compact
end
def audit_file
@@ -145,11 +145,11 @@ class FormulaAuditor
problem "Incorrect file permissions: chmod 644 #{formula.path}"
end
- if text.has_DATA? and not text.has_END?
+ if text.has_DATA? && !text.has_END?
problem "'DATA' was found, but no '__END__'"
end
- if text.has_END? and not text.has_DATA?
+ if text.has_END? && !text.has_DATA?
problem "'__END__' was found, but 'DATA' is not used"
end
@@ -160,22 +160,22 @@ class FormulaAuditor
return unless @strict
component_list = [
- [/^ desc ["'][\S\ ]+["']/, "desc" ],
- [/^ homepage ["'][\S\ ]+["']/, "homepage" ],
- [/^ url ["'][\S\ ]+["']/, "url" ],
- [/^ mirror ["'][\S\ ]+["']/, "mirror" ],
- [/^ version ["'][\S\ ]+["']/, "version" ],
- [/^ (sha1|sha256) ["'][\S\ ]+["']/, "checksum" ],
- [/^ head ["'][\S\ ]+["']/, "head" ],
- [/^ stable do/, "stable block" ],
- [/^ bottle do/, "bottle block" ],
- [/^ devel do/, "devel block" ],
- [/^ head do/, "head block" ],
- [/^ option/, "option" ],
- [/^ depends_on/, "depends_on" ],
+ [/^ desc ["'][\S\ ]+["']/, "desc"],
+ [/^ homepage ["'][\S\ ]+["']/, "homepage"],
+ [/^ url ["'][\S\ ]+["']/, "url"],
+ [/^ mirror ["'][\S\ ]+["']/, "mirror"],
+ [/^ version ["'][\S\ ]+["']/, "version"],
+ [/^ (sha1|sha256) ["'][\S\ ]+["']/, "checksum"],
+ [/^ head ["'][\S\ ]+["']/, "head"],
+ [/^ stable do/, "stable block"],
+ [/^ bottle do/, "bottle block"],
+ [/^ devel do/, "devel block"],
+ [/^ head do/, "head block"],
+ [/^ option/, "option"],
+ [/^ depends_on/, "depends_on"],
[/^ def install/, "install method"],
[/^ def caveats/, "caveats method"],
- [/^ test do/, "test block" ],
+ [/^ test do/, "test block"]
]
component_list.map do |regex, name|
@@ -289,7 +289,7 @@ class FormulaAuditor
case dep.name
when *BUILD_TIME_DEPS
- next if dep.build? or dep.run?
+ next if dep.build? || dep.run?
problem <<-EOS.undent
#{dep} dependency should be
depends_on "#{dep}" => :build
@@ -346,7 +346,7 @@ class FormulaAuditor
desc = formula.desc
- unless desc and desc.length > 0
+ unless desc && desc.length > 0
problem "Formula should have a desc (Description)."
return
end
@@ -360,11 +360,11 @@ class FormulaAuditor
EOS
end
- if desc =~ %r[[Cc]ommandline]
+ if desc =~ /[Cc]ommandline/
problem "It should be \"command-line\", not \"commandline\"."
end
- if desc =~ %r[[Cc]ommand line]
+ if desc =~ /[Cc]ommand line/
problem "It should be \"command-line\", not \"command line\"."
end
end
@@ -372,19 +372,19 @@ class FormulaAuditor
def audit_homepage
homepage = formula.homepage
- unless homepage =~ %r[^https?://]
+ unless homepage =~ %r{^https?://}
problem "The homepage should start with http or https (URL is #{homepage})."
end
# Check for http:// GitHub homepage urls, https:// is preferred.
# Note: only check homepages that are repo pages, not *.github.com hosts
- if homepage =~ %r[^http://github\.com/]
+ if homepage =~ %r{^http://github\.com/}
problem "Please use https:// for #{homepage}"
end
# Savannah has full SSL/TLS support but no auto-redirect.
# Doesn't apply to the download URLs, only the homepage.
- if homepage =~ %r[^http://savannah\.nongnu\.org/]
+ if homepage =~ %r{^http://savannah\.nongnu\.org/}
problem "Please use https:// for #{homepage}"
end
@@ -392,7 +392,7 @@ class FormulaAuditor
# To enable https Freedesktop change the URL from http://project.freedesktop.org/wiki to
# https://wiki.freedesktop.org/project_name.
# "Software" is redirected to https://wiki.freedesktop.org/www/Software/project_name
- if homepage =~ %r[^http://((?:www|nice|libopenraw|liboil|telepathy|xorg)\.)?freedesktop\.org/(?:wiki/)?]
+ if homepage =~ %r{^http://((?:www|nice|libopenraw|liboil|telepathy|xorg)\.)?freedesktop\.org/(?:wiki/)?}
if homepage =~ /Software/
problem "#{homepage} should be styled `https://wiki.freedesktop.org/www/Software/project_name`"
else
@@ -401,34 +401,34 @@ class FormulaAuditor
end
# Google Code homepages should end in a slash
- if homepage =~ %r[^https?://code\.google\.com/p/[^/]+[^/]$]
+ if homepage =~ %r{^https?://code\.google\.com/p/[^/]+[^/]$}
problem "#{homepage} should end with a slash"
end
# People will run into mixed content sometimes, but we should enforce and then add
# exemptions as they are discovered. Treat mixed content on homepages as a bug.
# Justify each exemptions with a code comment so we can keep track here.
- if homepage =~ %r[^http://[^/]*github\.io/]
+ if homepage =~ %r{^http://[^/]*github\.io/}
problem "Please use https:// for #{homepage}"
end
# There's an auto-redirect here, but this mistake is incredibly common too.
# Only applies to the homepage and subdomains for now, not the FTP URLs.
- if homepage =~ %r[^http://((?:build|cloud|developer|download|extensions|git|glade|help|library|live|nagios|news|people|projects|rt|static|wiki|www)\.)?gnome\.org]
+ if homepage =~ %r{^http://((?:build|cloud|developer|download|extensions|git|glade|help|library|live|nagios|news|people|projects|rt|static|wiki|www)\.)?gnome\.org}
problem "Please use https:// for #{homepage}"
end
# Compact the above into this list as we're able to remove detailed notations, etc over time.
case homepage
- when %r[^http://[^/]*\.apache\.org],
- %r[^http://packages\.debian\.org],
- %r[^http://wiki\.freedesktop\.org/],
- %r[^http://((?:www)\.)?gnupg.org/],
- %r[^http://ietf\.org],
- %r[^http://[^/.]+\.ietf\.org],
- %r[^http://[^/.]+\.tools\.ietf\.org],
- %r[^http://www\.gnu\.org/],
- %r[^http://code\.google\.com/]
+ when %r{^http://[^/]*\.apache\.org},
+ %r{^http://packages\.debian\.org},
+ %r{^http://wiki\.freedesktop\.org/},
+ %r{^http://((?:www)\.)?gnupg.org/},
+ %r{^http://ietf\.org},
+ %r{^http://[^/.]+\.ietf\.org},
+ %r{^http://[^/.]+\.tools\.ietf\.org},
+ %r{^http://www\.gnu\.org/},
+ %r{^http://code\.google\.com/}
problem "Please use https:// for #{homepage}"
end
@@ -462,7 +462,7 @@ class FormulaAuditor
problem "GitHub repository not notable enough (<10 forks, <10 watchers and <20 stars)"
end
- if (Date.parse(metadata["created_at"]) > (Date.today - 30))
+ if Date.parse(metadata["created_at"]) > (Date.today - 30)
problem "GitHub repository too new (<30 days old)"
end
end
@@ -530,16 +530,16 @@ class FormulaAuditor
def audit_patch(patch)
case patch.url
- when %r[raw\.github\.com], %r[gist\.github\.com/raw], %r[gist\.github\.com/.+/raw],
- %r[gist\.githubusercontent\.com/.+/raw]
+ when /raw\.github\.com/, %r{gist\.github\.com/raw}, %r{gist\.github\.com/.+/raw},
+ %r{gist\.githubusercontent\.com/.+/raw}
unless patch.url =~ /[a-fA-F0-9]{40}/
problem "GitHub/Gist patches should specify a revision:\n#{patch.url}"
end
- when %r[macports/trunk]
+ when %r{macports/trunk}
problem "MacPorts patches should specify a revision instead of trunk:\n#{patch.url}"
- when %r[^http://trac\.macports\.org]
+ when %r{^http://trac\.macports\.org}
problem "Patches from MacPorts Trac should be https://, not http:\n#{patch.url}"
- when %r[^http://bugs\.debian\.org]
+ when %r{^http://bugs\.debian\.org}
problem "Patches from Debian should be https://, not http:\n#{patch.url}"
end
end
@@ -550,11 +550,11 @@ class FormulaAuditor
end
if text =~ /system\s+['"]xcodebuild/
- problem %{use "xcodebuild *args" instead of "system 'xcodebuild', *args"}
+ problem %(use "xcodebuild *args" instead of "system 'xcodebuild', *args")
end
if text =~ /xcodebuild[ (]["'*]/ && text !~ /SYMROOT=/
- problem %{xcodebuild should be passed an explicit "SYMROOT"}
+ problem %(xcodebuild should be passed an explicit "SYMROOT")
end
if text =~ /Formula\.factory\(/
@@ -635,7 +635,7 @@ class FormulaAuditor
problem "\"(#{$1}...#{$2})\" should be \"(#{$3.downcase}+...)\""
end
- if line =~ %r[((man)\s*\+\s*(['"])(man[1-8])(['"]))]
+ if line =~ /((man)\s*\+\s*(['"])(man[1-8])(['"]))/
problem "\"#{$1}\" should be \"#{$4}\""
end
@@ -656,7 +656,7 @@ class FormulaAuditor
problem "\"#{$1}\" should be \"\#{#{$2}}\""
end
- if line =~ %r[depends_on :(automake|autoconf|libtool)]
+ if line =~ /depends_on :(automake|autoconf|libtool)/
problem ":#{$1} is deprecated. Usage should be \"#{$1}\""
end
@@ -751,13 +751,13 @@ class FormulaAuditor
problem "Use MacOS.version instead of MACOS_VERSION"
end
- cats = %w{leopard snow_leopard lion mountain_lion}.join("|")
+ cats = %w[leopard snow_leopard lion mountain_lion].join("|")
if line =~ /MacOS\.(?:#{cats})\?/
problem "\"#{$&}\" is deprecated, use a comparison to MacOS.version instead"
end
if line =~ /skip_clean\s+:all/
- problem "`skip_clean :all` is deprecated; brew no longer strips symbols\n" +
+ problem "`skip_clean :all` is deprecated; brew no longer strips symbols\n" \
"\tPass explicit paths to prevent Homebrew from removing empty folders."
end
@@ -827,7 +827,7 @@ class FormulaAuditor
return unless @strict
return unless formula.core_formula?
- if TAP_MIGRATIONS.has_key?(formula.name)
+ if TAP_MIGRATIONS.key?(formula.name)
problem <<-EOS.undent
#{formula.name} seems to be listed in tap_migrations.rb!
Please remove #{formula.name} from present tap & tap_migrations.rb
@@ -860,9 +860,9 @@ class FormulaAuditor
case condition
when /if build\.include\? ['"]with-#{dep}['"]$/, /if build\.with\? ['"]#{dep}['"]$/
- problem %{Replace #{line.inspect} with "depends_on #{quoted_dep} => :optional"}
+ problem %(Replace #{line.inspect} with "depends_on #{quoted_dep} => :optional")
when /unless build\.include\? ['"]without-#{dep}['"]$/, /unless build\.without\? ['"]#{dep}['"]$/
- problem %{Replace #{line.inspect} with "depends_on #{quoted_dep} => :recommended"}
+ problem %(Replace #{line.inspect} with "depends_on #{quoted_dep} => :recommended")
end
end
@@ -896,7 +896,7 @@ class FormulaAuditor
private
- def problem p
+ def problem(p)
@problems << p
end
@@ -937,7 +937,7 @@ class ResourceAuditor
problem "missing version"
elsif version.to_s.empty?
problem "version is set to an empty string"
- elsif not version.detected_from_url?
+ elsif !version.detected_from_url?
version_text = version
version_url = Version.detect(url, specs)
if version_url.to_s == version_text.to_s && version.instance_of?(Version)
@@ -977,7 +977,7 @@ class ResourceAuditor
end
def audit_download_strategy
- if url =~ %r[^(cvs|bzr|hg|fossil)://] || url =~ %r[^(svn)\+http://]
+ if url =~ %r{^(cvs|bzr|hg|fossil)://} || url =~ %r{^(svn)\+http://}
problem "Use of the #{$&} scheme is deprecated, pass `:using => :#{$1}` instead"
end
@@ -992,10 +992,10 @@ class ResourceAuditor
return unless using
if using == :ssl3 || \
- (Object.const_defined?("CurlSSL3DownloadStrategy") && using == CurlSSL3DownloadStrategy)
+ (Object.const_defined?("CurlSSL3DownloadStrategy") && using == CurlSSL3DownloadStrategy)
problem "The SSL3 download strategy is deprecated, please choose a different URL"
elsif (Object.const_defined?("CurlUnsafeDownloadStrategy") && using == CurlUnsafeDownloadStrategy) || \
- (Object.const_defined?("UnsafeSubversionDownloadStrategy") && using == UnsafeSubversionDownloadStrategy)
+ (Object.const_defined?("UnsafeSubversionDownloadStrategy") && using == UnsafeSubversionDownloadStrategy)
problem "#{using.name} is deprecated, please choose a different URL"
end
@@ -1006,7 +1006,7 @@ class ResourceAuditor
problem "Redundant :module value in URL"
end
- if url =~ %r[:[^/]+$]
+ if url =~ %r{:[^/]+$}
mod = url.split(":").last
if mod == name
@@ -1017,7 +1017,7 @@ class ResourceAuditor
end
end
- using_strategy = DownloadStrategyDetector.detect('', using)
+ using_strategy = DownloadStrategyDetector.detect("", using)
if url_strategy == using_strategy
problem "Redundant :using value in URL"
@@ -1026,12 +1026,12 @@ class ResourceAuditor
def audit_urls
# Check GNU urls; doesn't apply to mirrors
- if url =~ %r[^(?:https?|ftp)://(?!alpha).+/gnu/]
+ if url =~ %r{^(?:https?|ftp)://(?!alpha).+/gnu/}
problem "Please use \"http://ftpmirror.gnu.org\" instead of #{url}."
end
# GNU's ftpmirror does NOT support SSL/TLS.
- if url =~ %r[^https://ftpmirror\.gnu\.org/]
+ if url =~ %r{^https://ftpmirror\.gnu\.org/}
problem "Please use http:// for #{url}"
end
@@ -1045,17 +1045,17 @@ class ResourceAuditor
# or are overly common errors that need to be reduced & fixed over time.
urls.each do |p|
case p
- when %r[^http://ftp\.gnu\.org/],
- %r[^http://[^/]*\.apache\.org/],
- %r[^http://code\.google\.com/],
- %r[^http://fossies\.org/],
- %r[^http://mirrors\.kernel\.org/],
- %r[^http://([^/]*\.|)bintray\.com/],
- %r[^http://tools\.ietf\.org/]
+ when %r{^http://ftp\.gnu\.org/},
+ %r{^http://[^/]*\.apache\.org/},
+ %r{^http://code\.google\.com/},
+ %r{^http://fossies\.org/},
+ %r{^http://mirrors\.kernel\.org/},
+ %r{^http://([^/]*\.|)bintray\.com/},
+ %r{^http://tools\.ietf\.org/}
problem "Please use https:// for #{p}"
- when %r[^http://search\.mcpan\.org/CPAN/(.*)]i
+ when %r{^http://search\.mcpan\.org/CPAN/(.*)}i
problem "#{p} should be `https://cpan.metacpan.org/#{$1}`"
- when %r[^(http|ftp)://ftp\.gnome\.org/pub/gnome/(.*)]i
+ when %r{^(http|ftp)://ftp\.gnome\.org/pub/gnome/(.*)}i
problem "#{p} should be `https://download.gnome.org/#{$2}`"
end
end
@@ -1063,11 +1063,11 @@ class ResourceAuditor
# Check SourceForge urls
urls.each do |p|
# Skip if the URL looks like a SVN repo
- next if p =~ %r[/svnroot/]
- next if p =~ %r[svn\.sourceforge]
+ next if p =~ %r{/svnroot/}
+ next if p =~ /svn\.sourceforge/
# Is it a sourceforge http(s) URL?
- next unless p =~ %r[^https?://.*\b(sourceforge|sf)\.(com|net)]
+ next unless p =~ %r{^https?://.*\b(sourceforge|sf)\.(com|net)}
if p =~ /(\?|&)use_mirror=/
problem "Don't use #{$1}use_mirror in SourceForge urls (url is #{p})."
@@ -1077,16 +1077,16 @@ class ResourceAuditor
problem "Don't use /download in SourceForge urls (url is #{p})."
end
- if p =~ %r[^https?://sourceforge\.]
+ if p =~ %r{^https?://sourceforge\.}
problem "Use https://downloads.sourceforge.net to get geolocation (url is #{p})."
end
- if p =~ %r[^https?://prdownloads\.]
- problem "Don't use prdownloads in SourceForge urls (url is #{p}).\n" +
+ if p =~ %r{^https?://prdownloads\.}
+ problem "Don't use prdownloads in SourceForge urls (url is #{p}).\n" \
"\tSee: http://librelist.com/browser/homebrew/2011/1/12/prdownloads-is-bad/"
end
- if p =~ %r[^http://\w+\.dl\.]
+ if p =~ %r{^http://\w+\.dl\.}
problem "Don't use specific dl mirrors in SourceForge urls (url is #{p})."
end
@@ -1098,42 +1098,42 @@ class ResourceAuditor
# Check for Google Code download urls, https:// is preferred
# Intentionally not extending this to SVN repositories due to certificate
# issues.
- urls.grep(%r[^http://.*\.googlecode\.com/files.*]) do |u|
+ urls.grep(%r{^http://.*\.googlecode\.com/files.*}) do |u|
problem "Please use https:// for #{u}"
end
# Check for new-url Google Code download urls, https:// is preferred
- urls.grep(%r[^http://code\.google\.com/]) do |u|
+ urls.grep(%r{^http://code\.google\.com/}) do |u|
problem "Please use https:// for #{u}"
end
# Check for git:// GitHub repo urls, https:// is preferred.
- urls.grep(%r[^git://[^/]*github\.com/]) do |u|
+ urls.grep(%r{^git://[^/]*github\.com/}) do |u|
problem "Please use https:// for #{u}"
end
# Check for git:// Gitorious repo urls, https:// is preferred.
- urls.grep(%r[^git://[^/]*gitorious\.org/]) do |u|
+ urls.grep(%r{^git://[^/]*gitorious\.org/}) do |u|
problem "Please use https:// for #{u}"
end
# Check for http:// GitHub repo urls, https:// is preferred.
- urls.grep(%r[^http://github\.com/.*\.git$]) do |u|
+ urls.grep(%r{^http://github\.com/.*\.git$}) do |u|
problem "Please use https:// for #{u}"
end
# Use new-style archive downloads
- urls.select { |u| u =~ %r[https://.*github.*/(?:tar|zip)ball/] && u !~ %r[\.git$] }.each do |u|
+ urls.select { |u| u =~ %r{https://.*github.*/(?:tar|zip)ball/} && u !~ /\.git$/ }.each do |u|
problem "Use /archive/ URLs for GitHub tarballs (url is #{u})."
end
# Don't use GitHub .zip files
- urls.select { |u| u =~ %r[https://.*github.*/(archive|releases)/.*\.zip$] && u !~ %r[releases/download] }.each do |u|
+ urls.select { |u| u =~ %r{https://.*github.*/(archive|releases)/.*\.zip$} && u !~ %r{releases/download} }.each do |u|
problem "Use GitHub tarballs rather than zipballs (url is #{u})."
end
end
- def problem text
+ def problem(text)
@problems << text
end
end
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 537e896fd..73b071552 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -1,11 +1,11 @@
-require 'formula'
-require 'bottles'
-require 'tab'
-require 'keg'
-require 'formula_versions'
-require 'utils/inreplace'
-require 'erb'
-require 'extend/pathname'
+require "formula"
+require "bottles"
+require "tab"
+require "keg"
+require "formula_versions"
+require "utils/inreplace"
+require "erb"
+require "extend/pathname"
BOTTLE_ERB = <<-EOS
bottle do
@@ -33,10 +33,10 @@ BOTTLE_ERB = <<-EOS
EOS
module Homebrew
- def keg_contains string, keg, ignores
+ def keg_contains(string, keg, ignores)
@put_string_exists_header, @put_filenames = nil
- def print_filename string, filename
+ def print_filename(string, filename)
unless @put_string_exists_header
opoo "String '#{string}' still exists in these files:"
@put_string_exists_header = true
@@ -57,7 +57,7 @@ module Homebrew
# Check dynamic library linkage. Importantly, do not run otool on static
# libraries, which will falsely report "linkage" to themselves.
- if file.mach_o_executable? or file.dylib? or file.mach_o_bundle?
+ if file.mach_o_executable? || file.dylib? || file.mach_o_bundle?
linked_libraries = file.dynamically_linked_libraries
linked_libraries = linked_libraries.select { |lib| lib.include? string }
result ||= linked_libraries.any?
@@ -77,7 +77,7 @@ module Homebrew
until io.eof?
str = io.readline.chomp
- next if ignores.any? {|i| i =~ str }
+ next if ignores.any? { |i| i =~ str }
next unless str.include? string
@@ -110,12 +110,12 @@ module Homebrew
result
end
- def bottle_output bottle
+ def bottle_output(bottle)
erb = ERB.new BOTTLE_ERB
- erb.result(bottle.instance_eval { binding }).gsub(/^\s*$\n/, '')
+ erb.result(bottle.instance_eval { binding }).gsub(/^\s*$\n/, "")
end
- def bottle_formula f
+ def bottle_formula(f)
unless f.installed?
return ofail "Formula not installed or up-to-date: #{f.full_name}"
end
@@ -128,7 +128,7 @@ module Homebrew
return ofail "Formula has no stable version: #{f.full_name}"
end
- if ARGV.include? '--no-revision'
+ if ARGV.include? "--no-revision"
bottle_revision = 0
else
ohai "Determining #{f.full_name} bottle revision..."
@@ -158,14 +158,14 @@ module Homebrew
cd cellar do
# Use gzip, faster to compress than bzip2, faster to uncompress than bzip2
# or an uncompressed tarball (and more bandwidth friendly).
- safe_system 'tar', 'czf', bottle_path, "#{f.name}/#{f.pkg_version}"
+ safe_system "tar", "czf", bottle_path, "#{f.name}/#{f.pkg_version}"
end
if bottle_path.size > 1*1024*1024
ohai "Detecting if #{filename} is relocatable..."
end
- if prefix == '/usr/local'
+ if prefix == "/usr/local"
prefix_check = File.join(prefix, "opt")
else
prefix_check = prefix
@@ -206,7 +206,7 @@ module Homebrew
puts "./#{filename}"
puts output
- if ARGV.include? '--rb'
+ if ARGV.include? "--rb"
File.open("#{filename.prefix}.bottle.rb", "w") do |file|
file.write("\# #{f.full_name}\n")
file.write(output)
@@ -224,7 +224,7 @@ module Homebrew
merge_hash = {}
ARGV.named.each do |argument|
bottle_block = IO.read(argument)
- formula_name = bottle_block.lines.first.sub(/^# /,"").chomp
+ formula_name = bottle_block.lines.first.sub(/^# /, "").chomp
merge_hash[formula_name] ||= []
merge_hash[formula_name] << bottle_block
end
@@ -238,18 +238,18 @@ module Homebrew
output = bottle_output bottle
puts output
- if ARGV.include? '--write'
+ if ARGV.include? "--write"
f = Formulary.factory(formula_name)
update_or_add = nil
Utils::Inreplace.inreplace(f.path) do |s|
- if s.include? 'bottle do'
- update_or_add = 'update'
+ if s.include? "bottle do"
+ update_or_add = "update"
string = s.sub!(/ bottle do.+?end\n/m, output)
- odie 'Bottle block update failed!' unless string
+ odie "Bottle block update failed!" unless string
else
- update_or_add = 'add'
- if s.include? 'stable do'
+ update_or_add = "add"
+ if s.include? "stable do"
indent = s.slice(/^ +stable do/).length - "stable do".length
string = s.sub!(/^ {#{indent}}stable do(.|\n)+?^ {#{indent}}end\n/m, '\0' + output + "\n")
else
@@ -267,7 +267,7 @@ module Homebrew
)+
/mx, '\0' + output + "\n")
end
- odie 'Bottle block addition failed!' unless string
+ odie "Bottle block addition failed!" unless string
end
end
@@ -282,7 +282,7 @@ module Homebrew
end
def bottle
- merge if ARGV.include? '--merge'
+ merge if ARGV.include? "--merge"
ARGV.resolved_formulae.each do |f|
bottle_formula f
diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb
index 45761be88..157b40891 100644
--- a/Library/Homebrew/cmd/cleanup.rb
+++ b/Library/Homebrew/cmd/cleanup.rb
@@ -1,6 +1,6 @@
-require 'formula'
-require 'keg'
-require 'bottles'
+require "formula"
+require "keg"
+require "bottles"
module Homebrew
def cleanup
@@ -39,7 +39,7 @@ module Homebrew
end
end
- def cleanup_formula f
+ def cleanup_formula(f)
if f.installed?
eligible_kegs = f.rack.subdirs.map { |d| Keg.new(d) }.select { |k| f.pkg_version > k.version }
if eligible_kegs.any? && eligible_for_cleanup?(f)
@@ -54,7 +54,7 @@ module Homebrew
end
end
- def cleanup_keg keg
+ def cleanup_keg(keg)
if keg.linked?
opoo "Skipping (old) #{keg} due to it being linked"
else
@@ -84,12 +84,12 @@ module Homebrew
end
file_is_stale = if PkgVersion === version
- f.pkg_version > version
- else
- f.version > version
- end
+ f.pkg_version > version
+ else
+ f.version > version
+ end
- if file_is_stale || ARGV.switch?('s') && !f.installed? || bottle_file_outdated?(f, file)
+ if file_is_stale || ARGV.switch?("s") && !f.installed? || bottle_file_outdated?(f, file)
cleanup_path(file) { file.unlink }
end
end
@@ -107,15 +107,15 @@ module Homebrew
def cleanup_lockfiles
return unless HOMEBREW_CACHE_FORMULA.directory?
candidates = HOMEBREW_CACHE_FORMULA.children
- lockfiles = candidates.select { |f| f.file? && f.extname == '.brewing' }
+ lockfiles = candidates.select { |f| f.file? && f.extname == ".brewing" }
lockfiles.select(&:readable?).each do |file|
- file.open.flock(File::LOCK_EX | File::LOCK_NB) and file.unlink
+ file.open.flock(File::LOCK_EX | File::LOCK_NB) && file.unlink
end
end
def rm_DS_Store
paths = %w[Cellar Frameworks Library bin etc include lib opt sbin share var].
- map { |p| HOMEBREW_PREFIX/p }.select(&:exist?)
+ map { |p| HOMEBREW_PREFIX/p }.select(&:exist?)
args = paths.map(&:to_s) + %w[-name .DS_Store -delete]
quiet_system "find", *args
end
@@ -126,7 +126,7 @@ module Homebrew
# introduced the opt symlink, and built against that instead. So provided
# no brew exists that was built against an old-style keg-only keg, we can
# remove it.
- if not formula.keg_only? or ARGV.force?
+ if !formula.keg_only? || ARGV.force?
true
elsif formula.opt_prefix.directory?
# SHA records were added to INSTALL_RECEIPTS the same day as opt symlinks
diff --git a/Library/Homebrew/cmd/command.rb b/Library/Homebrew/cmd/command.rb
index c2ea96dab..6dce00e32 100644
--- a/Library/Homebrew/cmd/command.rb
+++ b/Library/Homebrew/cmd/command.rb
@@ -3,7 +3,7 @@ module Homebrew
cmd = ARGV.first
cmd = HOMEBREW_INTERNAL_COMMAND_ALIASES.fetch(cmd, cmd)
- if (path = HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb"; path.file?)
+ if (path = HOMEBREW_LIBRARY_PATH/"cmd/#{cmd}.rb" && path.file?)
puts path
elsif (path = which("brew-#{cmd}") || which("brew-#{cmd}.rb"))
puts path
diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb
index a41099982..1d4022f8d 100644
--- a/Library/Homebrew/cmd/commands.rb
+++ b/Library/Homebrew/cmd/commands.rb
@@ -21,13 +21,13 @@ module Homebrew
def internal_commands
with_directory = false
(HOMEBREW_REPOSITORY/"Library/Homebrew/cmd").
- children(with_directory).
- map {|f| File.basename(f, '.rb')}
+ children(with_directory).
+ map { |f| File.basename(f, ".rb") }
end
def external_commands
- paths.map{ |p| Dir["#{p}/brew-*"] }.flatten.
- map{ |f| File.basename(f, '.rb')[5..-1] }.
- reject{ |f| f =~ /\./ }
+ paths.map { |p| Dir["#{p}/brew-*"] }.flatten.
+ map { |f| File.basename(f, ".rb")[5..-1] }.
+ reject { |f| f =~ /\./ }
end
end
diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb
index d3f00555c..7627d6e97 100644
--- a/Library/Homebrew/cmd/config.rb
+++ b/Library/Homebrew/cmd/config.rb
@@ -1,4 +1,4 @@
-require 'hardware'
+require "hardware"
require "software_spec"
module Homebrew
@@ -59,7 +59,7 @@ module Homebrew
if origin.empty? then "(none)" else origin end
end
- def describe_path path
+ def describe_path(path)
return "N/A" if path.nil?
realpath = path.realpath
if realpath == path then path else "#{path} => #{realpath}" end
@@ -67,16 +67,16 @@ module Homebrew
def describe_x11
return "N/A" unless MacOS::XQuartz.installed?
- return "#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}"
+ "#{MacOS::XQuartz.version} => #{describe_path(MacOS::XQuartz.prefix)}"
end
def describe_perl
- describe_path(which 'perl')
+ describe_path(which "perl")
end
def describe_python
- python = which 'python'
- if %r{/shims/python$} =~ python && which('pyenv')
+ python = which "python"
+ if %r{/shims/python$} =~ python && which("pyenv")
"#{python} => #{Pathname.new(`pyenv which python`.strip).realpath}" rescue describe_path(python)
else
describe_path(python)
@@ -84,8 +84,8 @@ module Homebrew
end
def describe_ruby
- ruby = which 'ruby'
- if %r{/shims/ruby$} =~ ruby && which('rbenv')
+ ruby = which "ruby"
+ if %r{/shims/ruby$} =~ ruby && which("rbenv")
"#{ruby} => #{Pathname.new(`rbenv which ruby`.strip).realpath}" rescue describe_path(ruby)
else
describe_path(ruby)
@@ -114,7 +114,7 @@ module Homebrew
s << RUBY_VERSION
end
- if RUBY_PATH.to_s !~ %r[^/System/Library/Frameworks/Ruby.framework/Versions/[12]\.[089]/usr/bin/ruby]
+ if RUBY_PATH.to_s !~ %r{^/System/Library/Frameworks/Ruby.framework/Versions/[12]\.[089]/usr/bin/ruby}
s << " => #{RUBY_PATH}"
end
s
@@ -131,7 +131,7 @@ module Homebrew
end
end
- def dump_verbose_config(f=$stdout)
+ def dump_verbose_config(f = $stdout)
f.puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
f.puts "ORIGIN: #{origin}"
f.puts "HEAD: #{head}"
diff --git a/Library/Homebrew/cmd/create.rb b/Library/Homebrew/cmd/create.rb
index eaa1dca5c..88b8c0df3 100644
--- a/Library/Homebrew/cmd/create.rb
+++ b/Library/Homebrew/cmd/create.rb
@@ -1,17 +1,15 @@
-require 'formula'
-require 'blacklist'
-require 'digest'
-require 'erb'
+require "formula"
+require "blacklist"
+require "digest"
+require "erb"
module Homebrew
-
# Create a formula from a tarball URL
def create
-
# Allow searching MacPorts or Fink.
- if ARGV.include? '--macports'
+ if ARGV.include? "--macports"
exec_browser "https://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
- elsif ARGV.include? '--fink'
+ elsif ARGV.include? "--fink"
exec_browser "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}"
end
@@ -22,17 +20,17 @@ module Homebrew
url = ARGV.named.first # Pull the first (and only) url from ARGV
- version = ARGV.next if ARGV.include? '--set-version'
- name = ARGV.next if ARGV.include? '--set-name'
+ version = ARGV.next if ARGV.include? "--set-version"
+ name = ARGV.next if ARGV.include? "--set-name"
fc = FormulaCreator.new
fc.name = name
fc.version = version
fc.url = url
- fc.mode = if ARGV.include? '--cmake'
+ fc.mode = if ARGV.include? "--cmake"
:cmake
- elsif ARGV.include? '--autotools'
+ elsif ARGV.include? "--autotools"
:autotools
end
@@ -76,7 +74,7 @@ class FormulaCreator
attr_reader :url, :sha256
attr_accessor :name, :version, :path, :mode
- def url= url
+ def url=(url)
@url = url
path = Pathname.new(url)
if @name.nil?
@@ -115,7 +113,7 @@ class FormulaCreator
@sha256 = r.fetch.sha256 if r.download_strategy == CurlDownloadStrategy
end
- path.write ERB.new(template, nil, '>').result(binding)
+ path.write ERB.new(template, nil, ">").result(binding)
end
def template; <<-EOS.undent
diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb
index 180ad3de3..f69d1be93 100644
--- a/Library/Homebrew/cmd/deps.rb
+++ b/Library/Homebrew/cmd/deps.rb
@@ -1,15 +1,15 @@
# encoding: UTF-8
-require 'formula'
-require 'ostruct'
+require "formula"
+require "ostruct"
module Homebrew
def deps
mode = OpenStruct.new(
- :installed? => ARGV.include?('--installed'),
- :tree? => ARGV.include?('--tree'),
- :all? => ARGV.include?('--all'),
- :topo_order? => ARGV.include?('-n'),
- :union? => ARGV.include?('--union')
+ :installed? => ARGV.include?("--installed"),
+ :tree? => ARGV.include?("--tree"),
+ :all? => ARGV.include?("--all"),
+ :topo_order? => ARGV.include?("-n"),
+ :union? => ARGV.include?("--union")
)
if mode.installed? && mode.tree?
@@ -30,7 +30,7 @@ module Homebrew
end
end
- def deps_for_formula(f, recursive=false)
+ def deps_for_formula(f, recursive = false)
ignores = []
ignores << "build?" if ARGV.include? "--skip-build"
ignores << "optional?" if ARGV.include? "--skip-optional"
@@ -54,8 +54,8 @@ module Homebrew
deps + reqs.select(&:default_formula?).map(&:to_dependency)
end
- def deps_for_formulae(formulae, recursive=false, &block)
- formulae.map {|f| deps_for_formula(f, recursive) }.inject(&block)
+ def deps_for_formulae(formulae, recursive = false, &block)
+ formulae.map { |f| deps_for_formula(f, recursive) }.inject(&block)
end
def puts_deps(formulae)
@@ -70,7 +70,7 @@ module Homebrew
end
end
- def recursive_deps_tree f, prefix
+ def recursive_deps_tree(f, prefix)
reqs = f.requirements.select(&:default_formula?)
max = reqs.length - 1
reqs.each_with_index do |req, i|
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index df27e27ed..7c184587f 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -9,7 +9,7 @@ class Volumes
@volumes = get_mounts
end
- def which path
+ def which(path)
vols = get_mounts path
# no volume found
@@ -22,10 +22,10 @@ class Volumes
if vol_index.nil?
return -1
end
- return vol_index
+ vol_index
end
- def get_mounts path=nil
+ def get_mounts(path = nil)
vols = []
# get the volume of path, if path is nil returns all volumes
@@ -41,20 +41,18 @@ class Volumes
end
end
end
- return vols
+ vols
end
end
-
class Checks
-
-############# HELPERS
+ ############# HELPERS
# Finds files in HOMEBREW_PREFIX *and* /usr/local.
# Specify paths relative to a prefix eg. "include/foo.h".
# Sets @found for your convenience.
- def find_relative_paths *relative_paths
+ def find_relative_paths(*relative_paths)
@found = %W[#{HOMEBREW_PREFIX} /usr/local].uniq.inject([]) do |found, prefix|
- found + relative_paths.map{|f| File.join(prefix, f) }.select{|f| File.exist? f }
+ found + relative_paths.map { |f| File.join(prefix, f) }.select { |f| File.exist? f }
end
end
@@ -69,159 +67,159 @@ class Checks
return @git if instance_variable_defined?(:@git)
@git = system "git --version >/dev/null 2>&1"
end
-############# END HELPERS
+ ############# END HELPERS
-# Sorry for the lack of an indent here, the diff would have been unreadable.
-# See https://github.com/Homebrew/homebrew/pull/9986
-def check_path_for_trailing_slashes
- bad_paths = ENV['PATH'].split(File::PATH_SEPARATOR).select { |p| p[-1..-1] == '/' }
- return if bad_paths.empty?
- s = <<-EOS.undent
+ # Sorry for the lack of an indent here, the diff would have been unreadable.
+ # See https://github.com/Homebrew/homebrew/pull/9986
+ def check_path_for_trailing_slashes
+ bad_paths = ENV["PATH"].split(File::PATH_SEPARATOR).select { |p| p[-1..-1] == "/" }
+ return if bad_paths.empty?
+ s = <<-EOS.undent
Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
EOS
- bad_paths.each{|p| s << " #{p}"}
- s
-end
+ bad_paths.each { |p| s << " #{p}" }
+ s
+ end
-# Installing MacGPG2 interferes with Homebrew in a big way
-# https://github.com/GPGTools/MacGPG2
-def check_for_macgpg2
- return if File.exist? '/usr/local/MacGPG2/share/gnupg/VERSION'
+ # Installing MacGPG2 interferes with Homebrew in a big way
+ # https://github.com/GPGTools/MacGPG2
+ def check_for_macgpg2
+ return if File.exist? "/usr/local/MacGPG2/share/gnupg/VERSION"
- suspects = %w{
- /Applications/start-gpg-agent.app
- /Library/Receipts/libiconv1.pkg
- /usr/local/MacGPG2
- }
+ suspects = %w[
+ /Applications/start-gpg-agent.app
+ /Library/Receipts/libiconv1.pkg
+ /usr/local/MacGPG2
+ ]
- if suspects.any? { |f| File.exist? f } then <<-EOS.undent
+ if suspects.any? { |f| File.exist? f } then <<-EOS.undent
You may have installed MacGPG2 via the package installer.
Several other checks in this script will turn up problems, such as stray
dylibs in /usr/local and permissions issues with share and man in /usr/local/.
EOS
+ end
end
-end
-def __check_stray_files(dir, pattern, white_list, message)
- return unless File.directory?(dir)
+ def __check_stray_files(dir, pattern, white_list, message)
+ return unless File.directory?(dir)
- files = Dir.chdir(dir) {
- Dir[pattern].select { |f| File.file?(f) && !File.symlink?(f) } - Dir.glob(white_list)
- }.map { |file| File.join(dir, file) }
+ files = Dir.chdir(dir) do
+ Dir[pattern].select { |f| File.file?(f) && !File.symlink?(f) } - Dir.glob(white_list)
+ end.map { |file| File.join(dir, file) }
- inject_file_list(files, message) unless files.empty?
-end
+ inject_file_list(files, message) unless files.empty?
+ end
-def check_for_stray_dylibs
- # Dylibs which are generally OK should be added to this list,
- # with a short description of the software they come with.
- white_list = [
- "libfuse.2.dylib", # MacFuse
- "libfuse_ino64.2.dylib", # MacFuse
- "libmacfuse_i32.2.dylib", # OSXFuse MacFuse compatibility layer
- "libmacfuse_i64.2.dylib", # OSXFuse MacFuse compatibility layer
- "libosxfuse_i32.2.dylib", # OSXFuse
- "libosxfuse_i64.2.dylib", # OSXFuse
- "libTrAPI.dylib", # TrAPI / Endpoint Security VPN
- "libntfs-3g.*.dylib", # NTFS-3G
- "libntfs.*.dylib", # NTFS-3G
- "libublio.*.dylib", # NTFS-3G
- ]
-
- __check_stray_files "/usr/local/lib", "*.dylib", white_list, <<-EOS.undent
+ def check_for_stray_dylibs
+ # Dylibs which are generally OK should be added to this list,
+ # with a short description of the software they come with.
+ white_list = [
+ "libfuse.2.dylib", # MacFuse
+ "libfuse_ino64.2.dylib", # MacFuse
+ "libmacfuse_i32.2.dylib", # OSXFuse MacFuse compatibility layer
+ "libmacfuse_i64.2.dylib", # OSXFuse MacFuse compatibility layer
+ "libosxfuse_i32.2.dylib", # OSXFuse
+ "libosxfuse_i64.2.dylib", # OSXFuse
+ "libTrAPI.dylib", # TrAPI / Endpoint Security VPN
+ "libntfs-3g.*.dylib", # NTFS-3G
+ "libntfs.*.dylib", # NTFS-3G
+ "libublio.*.dylib", # NTFS-3G
+ ]
+
+ __check_stray_files "/usr/local/lib", "*.dylib", white_list, <<-EOS.undent
Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
EOS
-end
+ end
+
+ def check_for_stray_static_libs
+ # Static libs which are generally OK should be added to this list,
+ # with a short description of the software they come with.
+ white_list = [
+ "libsecurity_agent_client.a", # OS X 10.8.2 Supplemental Update
+ "libsecurity_agent_server.a", # OS X 10.8.2 Supplemental Update
+ "libntfs-3g.a", # NTFS-3G
+ "libntfs.a", # NTFS-3G
+ "libublio.a", # NTFS-3G
+ ]
-def check_for_stray_static_libs
- # Static libs which are generally OK should be added to this list,
- # with a short description of the software they come with.
- white_list = [
- "libsecurity_agent_client.a", # OS X 10.8.2 Supplemental Update
- "libsecurity_agent_server.a", # OS X 10.8.2 Supplemental Update
- "libntfs-3g.a", # NTFS-3G
- "libntfs.a", # NTFS-3G
- "libublio.a", # NTFS-3G
- ]
-
- __check_stray_files "/usr/local/lib", "*.a", white_list, <<-EOS.undent
+ __check_stray_files "/usr/local/lib", "*.a", white_list, <<-EOS.undent
Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
EOS
-end
+ end
+
+ def check_for_stray_pcs
+ # Package-config files which are generally OK should be added to this list,
+ # with a short description of the software they come with.
+ white_list = [
+ "fuse.pc", # OSXFuse/MacFuse
+ "macfuse.pc", # OSXFuse MacFuse compatibility layer
+ "osxfuse.pc", # OSXFuse
+ "libntfs-3g.pc", # NTFS-3G
+ "libublio.pc", # NTFS-3G
+ ]
-def check_for_stray_pcs
- # Package-config files which are generally OK should be added to this list,
- # with a short description of the software they come with.
- white_list = [
- "fuse.pc", # OSXFuse/MacFuse
- "macfuse.pc", # OSXFuse MacFuse compatibility layer
- "osxfuse.pc", # OSXFuse
- "libntfs-3g.pc", # NTFS-3G
- "libublio.pc",# NTFS-3G
- ]
-
- __check_stray_files "/usr/local/lib/pkgconfig", "*.pc", white_list, <<-EOS.undent
+ __check_stray_files "/usr/local/lib/pkgconfig", "*.pc", white_list, <<-EOS.undent
Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .pc files:
EOS
-end
+ end
-def check_for_stray_las
- white_list = [
- "libfuse.la", # MacFuse
- "libfuse_ino64.la", # MacFuse
- "libosxfuse_i32.la", # OSXFuse
- "libosxfuse_i64.la", # OSXFuse
- "libntfs-3g.la", # NTFS-3G
- "libntfs.la", # NTFS-3G
- "libublio.la", # NTFS-3G
- ]
-
- __check_stray_files "/usr/local/lib", "*.la", white_list, <<-EOS.undent
+ def check_for_stray_las
+ white_list = [
+ "libfuse.la", # MacFuse
+ "libfuse_ino64.la", # MacFuse
+ "libosxfuse_i32.la", # OSXFuse
+ "libosxfuse_i64.la", # OSXFuse
+ "libntfs-3g.la", # NTFS-3G
+ "libntfs.la", # NTFS-3G
+ "libublio.la", # NTFS-3G
+ ]
+
+ __check_stray_files "/usr/local/lib", "*.la", white_list, <<-EOS.undent
Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .la files:
EOS
-end
+ end
+
+ def check_for_stray_headers
+ white_list = [
+ "fuse.h", # MacFuse
+ "fuse/**/*.h", # MacFuse
+ "macfuse/**/*.h", # OSXFuse MacFuse compatibility layer
+ "osxfuse/**/*.h", # OSXFuse
+ "ntfs/**/*.h", # NTFS-3G
+ "ntfs-3g/**/*.h", # NTFS-3G
+ ]
-def check_for_stray_headers
- white_list = [
- "fuse.h", # MacFuse
- "fuse/**/*.h", # MacFuse
- "macfuse/**/*.h", # OSXFuse MacFuse compatibility layer
- "osxfuse/**/*.h", # OSXFuse
- "ntfs/**/*.h", # NTFS-3G
- "ntfs-3g/**/*.h", # NTFS-3G
- ]
-
- __check_stray_files "/usr/local/include", "**/*.h", white_list, <<-EOS.undent
+ __check_stray_files "/usr/local/include", "**/*.h", white_list, <<-EOS.undent
Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
EOS
-end
+ end
-def check_for_other_package_managers
- ponk = MacOS.macports_or_fink
- unless ponk.empty?
- <<-EOS.undent
+ def check_for_other_package_managers
+ ponk = MacOS.macports_or_fink
+ unless ponk.empty?
+ <<-EOS.undent
You have MacPorts or Fink installed:
#{ponk.join(", ")}
@@ -230,196 +228,196 @@ def check_for_other_package_managers
sudo mv /opt/local ~/macports
EOS
+ end
end
-end
-def check_for_broken_symlinks
- broken_symlinks = []
+ def check_for_broken_symlinks
+ broken_symlinks = []
- Keg::PRUNEABLE_DIRECTORIES.select(&:directory?).each do |d|
- d.find do |path|
- if path.symlink? && !path.resolved_path_exists?
- broken_symlinks << path
+ Keg::PRUNEABLE_DIRECTORIES.select(&:directory?).each do |d|
+ d.find do |path|
+ if path.symlink? && !path.resolved_path_exists?
+ broken_symlinks << path
+ end
end
end
- end
- unless broken_symlinks.empty? then <<-EOS.undent
+ unless broken_symlinks.empty? then <<-EOS.undent
Broken symlinks were found. Remove them with `brew prune`:
#{broken_symlinks * "\n "}
EOS
+ end
end
-end
-def check_for_unsupported_osx
- if MacOS.version >= "10.11" then <<-EOS.undent
+ def check_for_unsupported_osx
+ if MacOS.version >= "10.11" then <<-EOS.undent
You are using OS X #{MacOS.version}.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
EOS
+ end
end
-end
-if MacOS.version >= "10.9"
- def check_for_installed_developer_tools
- unless MacOS::Xcode.installed? || MacOS::CLT.installed? then <<-EOS.undent
+ if MacOS.version >= "10.9"
+ def check_for_installed_developer_tools
+ unless MacOS::Xcode.installed? || MacOS::CLT.installed? then <<-EOS.undent
No developer tools installed.
Install the Command Line Tools:
xcode-select --install
EOS
+ end
end
- end
- # TODO: remove when 10.11 is released
- if MacOS.version >= "10.11"
- def check_xcode_up_to_date
- if MacOS::Xcode.installed? && MacOS::Xcode.outdated?
- <<-EOS.undent
+ # TODO: remove when 10.11 is released
+ if MacOS.version >= "10.11"
+ def check_xcode_up_to_date
+ if MacOS::Xcode.installed? && MacOS::Xcode.outdated?
+ <<-EOS.undent
Your Xcode (#{MacOS::Xcode.version}) is outdated
Please update to Xcode #{MacOS::Xcode.latest_version}.
Xcode can be updated from
https://developer.apple.com/xcode/downloads/
EOS
+ end
end
- end
- else
- def check_xcode_up_to_date
- if MacOS::Xcode.installed? && MacOS::Xcode.outdated?
- <<-EOS.undent
+ else
+ def check_xcode_up_to_date
+ if MacOS::Xcode.installed? && MacOS::Xcode.outdated?
+ <<-EOS.undent
Your Xcode (#{MacOS::Xcode.version}) is outdated
Please update to Xcode #{MacOS::Xcode.latest_version}.
Xcode can be updated from the App Store.
EOS
+ end
end
end
- end
- def check_clt_up_to_date
- if MacOS::CLT.installed? && MacOS::CLT.outdated? then <<-EOS.undent
+ def check_clt_up_to_date
+ if MacOS::CLT.installed? && MacOS::CLT.outdated? then <<-EOS.undent
A newer Command Line Tools release is available.
Update them from Software Update in the App Store.
EOS
+ end
end
- end
-elsif MacOS.version == "10.8" || MacOS.version == "10.7"
- def check_for_installed_developer_tools
- unless MacOS::Xcode.installed? || MacOS::CLT.installed? then <<-EOS.undent
+ elsif MacOS.version == "10.8" || MacOS.version == "10.7"
+ def check_for_installed_developer_tools
+ unless MacOS::Xcode.installed? || MacOS::CLT.installed? then <<-EOS.undent
No developer tools installed.
You should install the Command Line Tools.
The standalone package can be obtained from
https://developer.apple.com/downloads
or it can be installed via Xcode's preferences.
EOS
+ end
end
- end
- def check_xcode_up_to_date
- if MacOS::Xcode.installed? && MacOS::Xcode.outdated? then <<-EOS.undent
+ def check_xcode_up_to_date
+ if MacOS::Xcode.installed? && MacOS::Xcode.outdated? then <<-EOS.undent
Your Xcode (#{MacOS::Xcode.version}) is outdated
Please update to Xcode #{MacOS::Xcode.latest_version}.
Xcode can be updated from
https://developer.apple.com/xcode/downloads/
EOS
+ end
end
- end
- def check_clt_up_to_date
- if MacOS::CLT.installed? && MacOS::CLT.outdated? then <<-EOS.undent
+ def check_clt_up_to_date
+ if MacOS::CLT.installed? && MacOS::CLT.outdated? then <<-EOS.undent
A newer Command Line Tools release is available.
The standalone package can be obtained from
https://developer.apple.com/downloads
or it can be installed via Xcode's preferences.
EOS
+ end
end
- end
-else
- def check_for_installed_developer_tools
- unless MacOS::Xcode.installed? then <<-EOS.undent
+ else
+ def check_for_installed_developer_tools
+ unless MacOS::Xcode.installed? then <<-EOS.undent
Xcode is not installed. Most formulae need Xcode to build.
It can be installed from
https://developer.apple.com/xcode/downloads/
EOS
+ end
end
- end
- def check_xcode_up_to_date
- if MacOS::Xcode.installed? && MacOS::Xcode.outdated? then <<-EOS.undent
+ def check_xcode_up_to_date
+ if MacOS::Xcode.installed? && MacOS::Xcode.outdated? then <<-EOS.undent
Your Xcode (#{MacOS::Xcode.version}) is outdated
Please update to Xcode #{MacOS::Xcode.latest_version}.
Xcode can be updated from
https://developer.apple.com/xcode/downloads/
EOS
+ end
end
end
-end
-def check_for_osx_gcc_installer
- if (MacOS.version < "10.7" || MacOS::Xcode.version > "4.1") && \
- MacOS.clang_version == "2.1"
- message = <<-EOS.undent
+ def check_for_osx_gcc_installer
+ if (MacOS.version < "10.7" || MacOS::Xcode.version > "4.1") && \
+ MacOS.clang_version == "2.1"
+ message = <<-EOS.undent
You seem to have osx-gcc-installer installed.
Homebrew doesn't support osx-gcc-installer. It causes many builds to fail and
is an unlicensed distribution of really old Xcode files.
EOS
- if MacOS.version >= :mavericks
- message += <<-EOS.undent
- Please run `xcode-select --install` to install the CLT.
- EOS
- elsif MacOS.version >= :lion
- message += <<-EOS.undent
+ if MacOS.version >= :mavericks
+ message += <<-EOS.undent
+ Please run `xcode-select --install` to install the CLT.
+ EOS
+ elsif MacOS.version >= :lion
+ message += <<-EOS.undent
Please install the CLT or Xcode #{MacOS::Xcode.latest_version}.
EOS
- else
- message += <<-EOS.undent
+ else
+ message += <<-EOS.undent
Please install Xcode #{MacOS::Xcode.latest_version}.
EOS
+ end
end
end
-end
-def check_for_stray_developer_directory
- # if the uninstaller script isn't there, it's a good guess neither are
- # any troublesome leftover Xcode files
- uninstaller = Pathname.new("/Developer/Library/uninstall-developer-folder")
- if MacOS::Xcode.version >= "4.3" && uninstaller.exist? then <<-EOS.undent
+ def check_for_stray_developer_directory
+ # if the uninstaller script isn't there, it's a good guess neither are
+ # any troublesome leftover Xcode files
+ uninstaller = Pathname.new("/Developer/Library/uninstall-developer-folder")
+ if MacOS::Xcode.version >= "4.3" && uninstaller.exist? then <<-EOS.undent
You have leftover files from an older version of Xcode.
You should delete them using:
#{uninstaller}
EOS
+ end
end
-end
-def check_for_bad_install_name_tool
- return if MacOS.version < "10.9"
+ def check_for_bad_install_name_tool
+ return if MacOS.version < "10.9"
- libs = Pathname.new("/usr/bin/install_name_tool").dynamically_linked_libraries
+ libs = Pathname.new("/usr/bin/install_name_tool").dynamically_linked_libraries
- # otool may not work, for example if the Xcode license hasn't been accepted yet
- return if libs.empty?
+ # otool may not work, for example if the Xcode license hasn't been accepted yet
+ return if libs.empty?
- unless libs.include? "/usr/lib/libxcselect.dylib" then <<-EOS.undent
+ unless libs.include? "/usr/lib/libxcselect.dylib" then <<-EOS.undent
You have an outdated version of /usr/bin/install_name_tool installed.
This will cause binary package installations to fail.
This can happen if you install osx-gcc-installer or RailsInstaller.
To restore it, you must reinstall OS X or restore the binary from
the OS packages.
EOS
+ end
end
-end
-def __check_subdir_access base
- target = HOMEBREW_PREFIX+base
- return unless target.exist?
+ def __check_subdir_access(base)
+ target = HOMEBREW_PREFIX+base
+ return unless target.exist?
- cant_read = []
+ cant_read = []
- target.find do |d|
- next unless d.directory?
- cant_read << d unless d.writable_real?
- end
+ target.find do |d|
+ next unless d.directory?
+ cant_read << d unless d.writable_real?
+ end
- cant_read.sort!
- if cant_read.length > 0 then
- s = <<-EOS.undent
+ cant_read.sort!
+ if cant_read.length > 0
+ s = <<-EOS.undent
Some directories in #{target} aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
@@ -427,23 +425,23 @@ def __check_subdir_access base
You should probably `chown` them:
EOS
- cant_read.each{ |f| s << " #{f}\n" }
- s
+ cant_read.each { |f| s << " #{f}\n" }
+ s
+ end
end
-end
-def check_access_share_locale
- __check_subdir_access 'share/locale'
-end
+ def check_access_share_locale
+ __check_subdir_access "share/locale"
+ end
-def check_access_share_man
- __check_subdir_access 'share/man'
-end
+ def check_access_share_man
+ __check_subdir_access "share/man"
+ end
-def check_access_usr_local
- return unless HOMEBREW_PREFIX.to_s == '/usr/local'
+ def check_access_usr_local
+ return unless HOMEBREW_PREFIX.to_s == "/usr/local"
- unless File.writable_real?("/usr/local") then <<-EOS.undent
+ unless File.writable_real?("/usr/local") then <<-EOS.undent
The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
@@ -452,23 +450,22 @@ def check_access_usr_local
You should probably change the ownership and permissions of /usr/local
back to your user account.
EOS
+ end
end
-end
-def check_tmpdir_sticky_bit
- world_writable = HOMEBREW_TEMP.stat.mode & 0777 == 0777
- if world_writable && !HOMEBREW_TEMP.sticky? then <<-EOS.undent
+ def check_tmpdir_sticky_bit
+ world_writable = HOMEBREW_TEMP.stat.mode & 0777 == 0777
+ if world_writable && !HOMEBREW_TEMP.sticky? then <<-EOS.undent
#{HOMEBREW_TEMP} is world-writable but does not have the sticky bit set.
Please run "Repair Disk Permissions" in Disk Utility.
EOS
+ end
end
-end
-
-(Keg::TOP_LEVEL_DIRECTORIES + ["lib/pkgconfig"]).each do |d|
- define_method("check_access_#{d.sub("/", "_")}") do
- dir = HOMEBREW_PREFIX.join(d)
- if dir.exist? && !dir.writable_real? then <<-EOS.undent
+ (Keg::TOP_LEVEL_DIRECTORIES + ["lib/pkgconfig"]).each do |d|
+ define_method("check_access_#{d.sub("/", "_")}") do
+ dir = HOMEBREW_PREFIX.join(d)
+ if dir.exist? && !dir.writable_real? then <<-EOS.undent
#{dir} isn't writable.
This can happen if you "sudo make install" software that isn't managed by
@@ -477,13 +474,13 @@ end
You should probably `chown` #{dir}
EOS
+ end
end
end
-end
-def check_access_site_packages
- if Language::Python.homebrew_site_packages.exist? && !Language::Python.homebrew_site_packages.writable_real?
- <<-EOS.undent
+ def check_access_site_packages
+ if Language::Python.homebrew_site_packages.exist? && !Language::Python.homebrew_site_packages.writable_real?
+ <<-EOS.undent
#{Language::Python.homebrew_site_packages} isn't writable.
This can happen if you "sudo pip install" software that isn't managed
by Homebrew. If you install a formula with Python modules, the install
@@ -491,123 +488,123 @@ def check_access_site_packages
You should probably `chown` #{Language::Python.homebrew_site_packages}
EOS
+ end
end
-end
-def check_access_logs
- if HOMEBREW_LOGS.exist? and not HOMEBREW_LOGS.writable_real?
- <<-EOS.undent
+ def check_access_logs
+ if HOMEBREW_LOGS.exist? && !HOMEBREW_LOGS.writable_real?
+ <<-EOS.undent
#{HOMEBREW_LOGS} isn't writable.
Homebrew writes debugging logs to this location.
You should probably `chown` #{HOMEBREW_LOGS}
EOS
+ end
end
-end
-def check_access_cache
- if HOMEBREW_CACHE.exist? && !HOMEBREW_CACHE.writable_real?
- <<-EOS.undent
+ def check_access_cache
+ if HOMEBREW_CACHE.exist? && !HOMEBREW_CACHE.writable_real?
+ <<-EOS.undent
#{HOMEBREW_CACHE} isn't writable.
This can happen if you run `brew install` or `brew fetch` as another user.
Homebrew caches downloaded files to this location.
You should probably `chown` #{HOMEBREW_CACHE}
EOS
+ end
end
-end
-def check_access_cellar
- if HOMEBREW_CELLAR.exist? && !HOMEBREW_CELLAR.writable_real?
- <<-EOS.undent
+ def check_access_cellar
+ if HOMEBREW_CELLAR.exist? && !HOMEBREW_CELLAR.writable_real?
+ <<-EOS.undent
#{HOMEBREW_CELLAR} isn't writable.
You should `chown` #{HOMEBREW_CELLAR}
EOS
+ end
end
-end
-def check_access_prefix_opt
- opt = HOMEBREW_PREFIX.join("opt")
- if opt.exist? && !opt.writable_real?
- <<-EOS.undent
+ def check_access_prefix_opt
+ opt = HOMEBREW_PREFIX.join("opt")
+ if opt.exist? && !opt.writable_real?
+ <<-EOS.undent
#{opt} isn't writable.
You should `chown` #{opt}
EOS
+ end
end
-end
-def check_ruby_version
- ruby_version = MacOS.version >= "10.9" ? "2.0" : "1.8"
- if RUBY_VERSION[/\d\.\d/] != ruby_version then <<-EOS.undent
+ def check_ruby_version
+ ruby_version = MacOS.version >= "10.9" ? "2.0" : "1.8"
+ if RUBY_VERSION[/\d\.\d/] != ruby_version then <<-EOS.undent
Ruby version #{RUBY_VERSION} is unsupported on #{MacOS.version}. Homebrew
is developed and tested on Ruby #{ruby_version}, and may not work correctly
on other Rubies. Patches are accepted as long as they don't cause breakage
on supported Rubies.
EOS
+ end
end
-end
-def check_homebrew_prefix
- unless HOMEBREW_PREFIX.to_s == '/usr/local'
- <<-EOS.undent
+ def check_homebrew_prefix
+ unless HOMEBREW_PREFIX.to_s == "/usr/local"
+ <<-EOS.undent
Your Homebrew is not installed to /usr/local
You can install Homebrew anywhere you want, but some brews may only build
correctly if you install in /usr/local. Sorry!
EOS
+ end
end
-end
-def check_xcode_prefix
- prefix = MacOS::Xcode.prefix
- return if prefix.nil?
- if prefix.to_s.match(' ')
- <<-EOS.undent
+ def check_xcode_prefix
+ prefix = MacOS::Xcode.prefix
+ return if prefix.nil?
+ if prefix.to_s.match(" ")
+ <<-EOS.undent
Xcode is installed to a directory with a space in the name.
This will cause some formulae to fail to build.
EOS
+ end
end
-end
-def check_xcode_prefix_exists
- prefix = MacOS::Xcode.prefix
- return if prefix.nil?
- unless prefix.exist?
- <<-EOS.undent
+ def check_xcode_prefix_exists
+ prefix = MacOS::Xcode.prefix
+ return if prefix.nil?
+ unless prefix.exist?
+ <<-EOS.undent
The directory Xcode is reportedly installed to doesn't exist:
#{prefix}
You may need to `xcode-select` the proper path if you have moved Xcode.
EOS
+ end
end
-end
-def check_xcode_select_path
- if not MacOS::CLT.installed? and not File.file? "#{MacOS.active_developer_dir}/usr/bin/xcodebuild"
- path = MacOS::Xcode.bundle_path
- path = '/Developer' if path.nil? or not path.directory?
- <<-EOS.undent
+ def check_xcode_select_path
+ if !MacOS::CLT.installed? and !File.file? "#{MacOS.active_developer_dir}/usr/bin/xcodebuild"
+ path = MacOS::Xcode.bundle_path
+ path = "/Developer" if path.nil? || !path.directory?
+ <<-EOS.undent
Your Xcode is configured with an invalid path.
You should change it to the correct path:
sudo xcode-select -switch #{path}
EOS
+ end
end
-end
-def check_user_path_1
- $seen_prefix_bin = false
- $seen_prefix_sbin = false
+ def check_user_path_1
+ $seen_prefix_bin = false
+ $seen_prefix_sbin = false
- out = nil
+ out = nil
- paths.each do |p|
- case p
- when '/usr/bin'
- unless $seen_prefix_bin
- # only show the doctor message if there are any conflicts
- # rationale: a default install should not trigger any brew doctor messages
- conflicts = Dir["#{HOMEBREW_PREFIX}/bin/*"].
- map{ |fn| File.basename fn }.
- select{ |bn| File.exist? "/usr/bin/#{bn}" }
+ paths.each do |p|
+ case p
+ when "/usr/bin"
+ unless $seen_prefix_bin
+ # only show the doctor message if there are any conflicts
+ # rationale: a default install should not trigger any brew doctor messages
+ conflicts = Dir["#{HOMEBREW_PREFIX}/bin/*"].
+ map { |fn| File.basename fn }.
+ select { |bn| File.exist? "/usr/bin/#{bn}" }
- if conflicts.size > 0
- out = <<-EOS.undent
+ if conflicts.size > 0
+ out = <<-EOS.undent
/usr/bin occurs before #{HOMEBREW_PREFIX}/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
@@ -618,59 +615,59 @@ def check_user_path_1
occurs before /usr/bin. Here is a one-liner:
echo 'export PATH="#{HOMEBREW_PREFIX}/bin:$PATH"' >> #{shell_profile}
EOS
+ end
end
+ when "#{HOMEBREW_PREFIX}/bin"
+ $seen_prefix_bin = true
+ when "#{HOMEBREW_PREFIX}/sbin"
+ $seen_prefix_sbin = true
end
- when "#{HOMEBREW_PREFIX}/bin"
- $seen_prefix_bin = true
- when "#{HOMEBREW_PREFIX}/sbin"
- $seen_prefix_sbin = true
end
+ out
end
- out
-end
-def check_user_path_2
- unless $seen_prefix_bin
- <<-EOS.undent
+ def check_user_path_2
+ unless $seen_prefix_bin
+ <<-EOS.undent
Homebrew's bin was not found in your PATH.
Consider setting the PATH for example like so
echo 'export PATH="#{HOMEBREW_PREFIX}/bin:$PATH"' >> #{shell_profile}
EOS
+ end
end
-end
-def check_user_path_3
- # Don't complain about sbin not being in the path if it doesn't exist
- sbin = (HOMEBREW_PREFIX+'sbin')
- if sbin.directory? and sbin.children.length > 0
- unless $seen_prefix_sbin
- <<-EOS.undent
+ def check_user_path_3
+ # Don't complain about sbin not being in the path if it doesn't exist
+ sbin = (HOMEBREW_PREFIX+"sbin")
+ if sbin.directory? && sbin.children.length > 0
+ unless $seen_prefix_sbin
+ <<-EOS.undent
Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in #{HOMEBREW_PREFIX}/sbin.
Consider setting the PATH for example like so
echo 'export PATH="#{HOMEBREW_PREFIX}/sbin:$PATH"' >> #{shell_profile}
EOS
+ end
end
end
-end
-def check_user_curlrc
- if %w[CURL_HOME HOME].any?{|key| ENV[key] and File.exist? "#{ENV[key]}/.curlrc" } then <<-EOS.undent
+ def check_user_curlrc
+ if %w[CURL_HOME HOME].any? { |key| ENV[key] && File.exist?("#{ENV[key]}/.curlrc") } then <<-EOS.undent
You have a curlrc file
If you have trouble downloading packages with Homebrew, then maybe this
is the problem? If the following command doesn't work, then try removing
your curlrc:
curl http://github.com
EOS
+ end
end
-end
-def check_which_pkg_config
- binary = which 'pkg-config'
- return if binary.nil?
+ def check_which_pkg_config
+ binary = which "pkg-config"
+ return if binary.nil?
- mono_config = Pathname.new("/usr/bin/pkg-config")
- if mono_config.exist? && mono_config.realpath.to_s.include?("Mono.framework") then <<-EOS.undent
+ mono_config = Pathname.new("/usr/bin/pkg-config")
+ if mono_config.exist? && mono_config.realpath.to_s.include?("Mono.framework") then <<-EOS.undent
You have a non-Homebrew 'pkg-config' in your PATH:
/usr/bin/pkg-config => #{mono_config.realpath}
@@ -680,49 +677,47 @@ def check_which_pkg_config
Mono no longer installs this file as of 3.0.4. You should
`sudo rm /usr/bin/pkg-config` and upgrade to the latest version of Mono.
EOS
- elsif binary.to_s != "#{HOMEBREW_PREFIX}/bin/pkg-config" then <<-EOS.undent
+ elsif binary.to_s != "#{HOMEBREW_PREFIX}/bin/pkg-config" then <<-EOS.undent
You have a non-Homebrew 'pkg-config' in your PATH:
#{binary}
`./configure` may have problems finding brew-installed packages using
this other pkg-config.
EOS
+ end
end
-end
-def check_for_gettext
- find_relative_paths("lib/libgettextlib.dylib",
- "lib/libintl.dylib",
- "include/libintl.h")
+ def check_for_gettext
+ find_relative_paths("lib/libgettextlib.dylib",
+ "lib/libintl.dylib",
+ "include/libintl.h")
- return if @found.empty?
+ return if @found.empty?
- # Our gettext formula will be caught by check_linked_keg_only_brews
- f = Formulary.factory("gettext") rescue nil
- return if f and f.linked_keg.directory? and @found.all? do |path|
- Pathname.new(path).realpath.to_s.start_with? "#{HOMEBREW_CELLAR}/gettext"
- end
+ # Our gettext formula will be caught by check_linked_keg_only_brews
+ f = Formulary.factory("gettext") rescue nil
+ return if f && f.linked_keg.directory? && @found.all? do |path|
+ Pathname.new(path).realpath.to_s.start_with? "#{HOMEBREW_CELLAR}/gettext"
+ end
- s = <<-EOS.undent_________________________________________________________72
+ s = <<-EOS.undent_________________________________________________________72
gettext files detected at a system prefix
These files can cause compilation and link failures, especially if they
are compiled with improper architectures. Consider removing these files:
EOS
- inject_file_list(@found, s)
-end
+ inject_file_list(@found, s)
+ end
-def check_for_iconv
- unless find_relative_paths("lib/libiconv.dylib", "include/iconv.h").empty?
- if (f = Formulary.factory("libiconv") rescue nil) and f.linked_keg.directory?
- if not f.keg_only? then <<-EOS.undent
+ def check_for_iconv
+ unless find_relative_paths("lib/libiconv.dylib", "include/iconv.h").empty?
+ if (f = Formulary.factory("libiconv") rescue nil) && f.linked_keg.directory?
+ unless f.keg_only? then <<-EOS.undent
A libiconv formula is installed and linked
This will break stuff. For serious. Unlink it.
EOS
+ end
else
- # NOOP because: check_for_linked_keg_only_brews
- end
- else
- s = <<-EOS.undent_________________________________________________________72
+ s = <<-EOS.undent_________________________________________________________72
libiconv files detected at a system prefix other than /usr
Homebrew doesn't provide a libiconv formula, and expects to link against
the system version in /usr. libiconv in other prefixes can cause
@@ -732,36 +727,36 @@ def check_for_iconv
tl;dr: delete these files:
EOS
- inject_file_list(@found, s)
+ inject_file_list(@found, s)
+ end
end
end
-end
-def check_for_config_scripts
- return unless HOMEBREW_CELLAR.exist?
- real_cellar = HOMEBREW_CELLAR.realpath
+ def check_for_config_scripts
+ return unless HOMEBREW_CELLAR.exist?
+ real_cellar = HOMEBREW_CELLAR.realpath
- scripts = []
+ scripts = []
- whitelist = %W[
- /usr/bin /usr/sbin
- /usr/X11/bin /usr/X11R6/bin /opt/X11/bin
- #{HOMEBREW_PREFIX}/bin #{HOMEBREW_PREFIX}/sbin
- /Applications/Server.app/Contents/ServerRoot/usr/bin
- /Applications/Server.app/Contents/ServerRoot/usr/sbin
- ].map(&:downcase)
+ whitelist = %W[
+ /usr/bin /usr/sbin
+ /usr/X11/bin /usr/X11R6/bin /opt/X11/bin
+ #{HOMEBREW_PREFIX}/bin #{HOMEBREW_PREFIX}/sbin
+ /Applications/Server.app/Contents/ServerRoot/usr/bin
+ /Applications/Server.app/Contents/ServerRoot/usr/sbin
+ ].map(&:downcase)
- paths.each do |p|
- next if whitelist.include?(p.downcase) || !File.directory?(p)
+ paths.each do |p|
+ next if whitelist.include?(p.downcase) || !File.directory?(p)
- realpath = Pathname.new(p).realpath.to_s
- next if realpath.start_with?(real_cellar.to_s, HOMEBREW_CELLAR.to_s)
+ realpath = Pathname.new(p).realpath.to_s
+ next if realpath.start_with?(real_cellar.to_s, HOMEBREW_CELLAR.to_s)
- scripts += Dir.chdir(p) { Dir["*-config"] }.map { |c| File.join(p, c) }
- end
+ scripts += Dir.chdir(p) { Dir["*-config"] }.map { |c| File.join(p, c) }
+ end
- unless scripts.empty?
- s = <<-EOS.undent
+ unless scripts.empty?
+ s = <<-EOS.undent
"config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
@@ -773,34 +768,34 @@ def check_for_config_scripts
EOS
- s << scripts.map { |f| " #{f}" }.join("\n")
+ s << scripts.map { |f| " #{f}" }.join("\n")
+ end
end
-end
-def check_DYLD_vars
- found = ENV.keys.grep(/^DYLD_/)
- unless found.empty?
- s = <<-EOS.undent
+ def check_DYLD_vars
+ found = ENV.keys.grep(/^DYLD_/)
+ unless found.empty?
+ s = <<-EOS.undent
Setting DYLD_* vars can break dynamic linking.
Set variables:
EOS
- s << found.map { |e| " #{e}: #{ENV.fetch(e)}\n" }.join
- if found.include? 'DYLD_INSERT_LIBRARIES'
- s += <<-EOS.undent
+ s << found.map { |e| " #{e}: #{ENV.fetch(e)}\n" }.join
+ if found.include? "DYLD_INSERT_LIBRARIES"
+ s += <<-EOS.undent
Setting DYLD_INSERT_LIBRARIES can cause Go builds to fail.
Having this set is common if you use this software:
http://asepsis.binaryage.com/
EOS
+ end
+ s
end
- s
end
-end
-def check_for_symlinked_cellar
- return unless HOMEBREW_CELLAR.exist?
- if HOMEBREW_CELLAR.symlink?
- <<-EOS.undent
+ def check_for_symlinked_cellar
+ return unless HOMEBREW_CELLAR.exist?
+ if HOMEBREW_CELLAR.symlink?
+ <<-EOS.undent
Symlinked Cellars can cause problems.
Your Homebrew Cellar is a symlink: #{HOMEBREW_CELLAR}
which resolves to: #{HOMEBREW_CELLAR.realpath}
@@ -813,25 +808,25 @@ def check_for_symlinked_cellar
cause problems when two formula install to locations that are mapped on top of each
other during the linking step.
EOS
+ end
end
-end
-def check_for_multiple_volumes
- return unless HOMEBREW_CELLAR.exist?
- volumes = Volumes.new
+ def check_for_multiple_volumes
+ return unless HOMEBREW_CELLAR.exist?
+ volumes = Volumes.new
- # Find the volumes for the TMP folder & HOMEBREW_CELLAR
- real_cellar = HOMEBREW_CELLAR.realpath
+ # Find the volumes for the TMP folder & HOMEBREW_CELLAR
+ real_cellar = HOMEBREW_CELLAR.realpath
- tmp = Pathname.new(Dir.mktmpdir("doctor", HOMEBREW_TEMP))
- real_temp = tmp.realpath.parent
+ tmp = Pathname.new(Dir.mktmpdir("doctor", HOMEBREW_TEMP))
+ real_temp = tmp.realpath.parent
- where_cellar = volumes.which real_cellar
- where_temp = volumes.which real_temp
+ where_cellar = volumes.which real_cellar
+ where_temp = volumes.which real_temp
- Dir.delete tmp
+ Dir.delete tmp
- unless where_cellar == where_temp then <<-EOS.undent
+ unless where_cellar == where_temp then <<-EOS.undent
Your Cellar and TEMP directories are on different volumes.
OS X won't move relative symlinks across volumes unless the target file already
exists. Brews known to be affected by this are Git and Narwhal.
@@ -839,60 +834,60 @@ def check_for_multiple_volumes
You should set the "HOMEBREW_TEMP" environmental variable to a suitable
directory on the same volume as your Cellar.
EOS
+ end
end
-end
-def check_filesystem_case_sensitive
- volumes = Volumes.new
- case_sensitive_vols = [HOMEBREW_PREFIX, HOMEBREW_REPOSITORY, HOMEBREW_CELLAR, HOMEBREW_TEMP].select do |dir|
- # We select the dir as being case-sensitive if either the UPCASED or the
- # downcased variant is missing.
- # Of course, on a case-insensitive fs, both exist because the os reports so.
- # In the rare situation when the user has indeed a downcased and an upcased
- # dir (e.g. /TMP and /tmp) this check falsely thinks it is case-insensitive
- # but we don't care beacuse: 1. there is more than one dir checked, 2. the
- # check is not vital and 3. we would have to touch files otherwise.
- upcased = Pathname.new(dir.to_s.upcase)
- downcased = Pathname.new(dir.to_s.downcase)
- dir.exist? && !(upcased.exist? && downcased.exist?)
- end.map { |case_sensitive_dir| volumes.get_mounts(case_sensitive_dir) }.uniq
- return if case_sensitive_vols.empty?
- <<-EOS.undent
+ def check_filesystem_case_sensitive
+ volumes = Volumes.new
+ case_sensitive_vols = [HOMEBREW_PREFIX, HOMEBREW_REPOSITORY, HOMEBREW_CELLAR, HOMEBREW_TEMP].select do |dir|
+ # We select the dir as being case-sensitive if either the UPCASED or the
+ # downcased variant is missing.
+ # Of course, on a case-insensitive fs, both exist because the os reports so.
+ # In the rare situation when the user has indeed a downcased and an upcased
+ # dir (e.g. /TMP and /tmp) this check falsely thinks it is case-insensitive
+ # but we don't care beacuse: 1. there is more than one dir checked, 2. the
+ # check is not vital and 3. we would have to touch files otherwise.
+ upcased = Pathname.new(dir.to_s.upcase)
+ downcased = Pathname.new(dir.to_s.downcase)
+ dir.exist? && !(upcased.exist? && downcased.exist?)
+ end.map { |case_sensitive_dir| volumes.get_mounts(case_sensitive_dir) }.uniq
+ return if case_sensitive_vols.empty?
+ <<-EOS.undent
The filesystem on #{case_sensitive_vols.join(",")} appears to be case-sensitive.
The default OS X filesystem is case-insensitive. Please report any apparent problems.
EOS
-end
+ end
-def __check_git_version
- # https://help.github.com/articles/https-cloning-errors
- `git --version`.chomp =~ /git version ((?:\d+\.?)+)/
+ def __check_git_version
+ # https://help.github.com/articles/https-cloning-errors
+ `git --version`.chomp =~ /git version ((?:\d+\.?)+)/
- if $1 and Version.new($1) < Version.new("1.7.10") then <<-EOS.undent
+ if $1 && Version.new($1) < Version.new("1.7.10") then <<-EOS.undent
An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git
EOS
+ end
end
-end
-def check_for_git
- if git?
- __check_git_version
- else <<-EOS.undent
+ def check_for_git
+ if git?
+ __check_git_version
+ else <<-EOS.undent
Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:
brew install git
EOS
+ end
end
-end
-def check_git_newline_settings
- return unless git?
+ def check_git_newline_settings
+ return unless git?
- autocrlf = `git config --get core.autocrlf`.chomp
+ autocrlf = `git config --get core.autocrlf`.chomp
- if autocrlf == 'true' then <<-EOS.undent
+ if autocrlf == "true" then <<-EOS.undent
Suspicious Git newline settings found.
The detected Git newline settings will cause checkout problems:
@@ -902,16 +897,16 @@ def check_git_newline_settings
consider removing these by running:
`git config --global core.autocrlf input`
EOS
+ end
end
-end
-def check_git_origin
- return unless git? && (HOMEBREW_REPOSITORY/'.git').exist?
+ def check_git_origin
+ return unless git? && (HOMEBREW_REPOSITORY/".git").exist?
- HOMEBREW_REPOSITORY.cd do
- origin = `git config --get remote.origin.url`.strip
+ HOMEBREW_REPOSITORY.cd do
+ origin = `git config --get remote.origin.url`.strip
- if origin.empty? then <<-EOS.undent
+ if origin.empty? then <<-EOS.undent
Missing git origin remote.
Without a correctly configured origin, Homebrew won't update
@@ -919,7 +914,7 @@ def check_git_origin
cd #{HOMEBREW_REPOSITORY}
git remote add origin https://github.com/Homebrew/homebrew.git
EOS
- elsif origin !~ /(mxcl|Homebrew)\/homebrew(\.git)?$/ then <<-EOS.undent
+ elsif origin !~ /(mxcl|Homebrew)\/homebrew(\.git)?$/ then <<-EOS.undent
Suspicious git origin remote found.
With a non-standard origin, Homebrew won't pull updates from
@@ -930,45 +925,45 @@ def check_git_origin
origin remote to point at the main repository, located at:
https://github.com/Homebrew/homebrew.git
EOS
+ end
end
end
-end
-def check_for_autoconf
- return unless MacOS::Xcode.provides_autotools?
+ def check_for_autoconf
+ return unless MacOS::Xcode.provides_autotools?
- autoconf = which('autoconf')
- safe_autoconfs = %w[/usr/bin/autoconf /Developer/usr/bin/autoconf]
- unless autoconf.nil? or safe_autoconfs.include? autoconf.to_s then <<-EOS.undent
+ autoconf = which("autoconf")
+ safe_autoconfs = %w[/usr/bin/autoconf /Developer/usr/bin/autoconf]
+ unless autoconf.nil? || safe_autoconfs.include?(autoconf.to_s) then <<-EOS.undent
An "autoconf" in your path blocks the Xcode-provided version at:
#{autoconf}
This custom autoconf may cause some Homebrew formulae to fail to compile.
EOS
+ end
end
-end
-def __check_linked_brew f
- f.rack.subdirs.each do |prefix|
- prefix.find do |src|
- next if src == prefix
- dst = HOMEBREW_PREFIX + src.relative_path_from(prefix)
- return true if dst.symlink? && src == dst.resolved_path
+ def __check_linked_brew(f)
+ f.rack.subdirs.each do |prefix|
+ prefix.find do |src|
+ next if src == prefix
+ dst = HOMEBREW_PREFIX + src.relative_path_from(prefix)
+ return true if dst.symlink? && src == dst.resolved_path
+ end
end
- end
- false
-end
+ false
+ end
-def check_for_linked_keg_only_brews
- return unless HOMEBREW_CELLAR.exist?
+ def check_for_linked_keg_only_brews
+ return unless HOMEBREW_CELLAR.exist?
- linked = Formula.installed.select { |f|
- f.keg_only? && __check_linked_brew(f)
- }
+ linked = Formula.installed.select do |f|
+ f.keg_only? && __check_linked_brew(f)
+ end
- unless linked.empty?
- s = <<-EOS.undent
+ unless linked.empty?
+ s = <<-EOS.undent
Some keg-only formula are linked into the Cellar.
Linking a keg-only formula, such as gettext, into the cellar with
`brew link <formula>` will cause other formulae to detect them during
@@ -981,37 +976,38 @@ def check_for_linked_keg_only_brews
You may wish to `brew unlink` these brews:
EOS
- linked.each { |f| s << " #{f.full_name}\n" }
- s
+ linked.each { |f| s << " #{f.full_name}\n" }
+ s
+ end
end
-end
-def check_for_other_frameworks
- # Other frameworks that are known to cause problems when present
- %w{expat.framework libexpat.framework libcurl.framework}.
- map{ |frmwrk| "/Library/Frameworks/#{frmwrk}" }.
- select{ |frmwrk| File.exist? frmwrk }.
- map do |frmwrk| <<-EOS.undent
+ def check_for_other_frameworks
+ # Other frameworks that are known to cause problems when present
+ %w[expat.framework libexpat.framework libcurl.framework].
+ map { |frmwrk| "/Library/Frameworks/#{frmwrk}" }.
+ select { |frmwrk| File.exist? frmwrk }.
+ map do |frmwrk|
+ <<-EOS.undent
#{frmwrk} detected
This can be picked up by CMake's build system and likely cause the build to
fail. You may need to move this file out of the way to compile CMake.
EOS
- end.join
-end
-
-def check_tmpdir
- tmpdir = ENV['TMPDIR']
- "TMPDIR #{tmpdir.inspect} doesn't exist." unless tmpdir.nil? or File.directory? tmpdir
-end
+ end.join
+ end
-def check_missing_deps
- return unless HOMEBREW_CELLAR.exist?
- missing = Set.new
- Homebrew.missing_deps(Formula.installed).each_value do |deps|
- missing.merge(deps)
+ def check_tmpdir
+ tmpdir = ENV["TMPDIR"]
+ "TMPDIR #{tmpdir.inspect} doesn't exist." unless tmpdir.nil? || File.directory?(tmpdir)
end
- if missing.any? then <<-EOS.undent
+ def check_missing_deps
+ return unless HOMEBREW_CELLAR.exist?
+ missing = Set.new
+ Homebrew.missing_deps(Formula.installed).each_value do |deps|
+ missing.merge(deps)
+ end
+
+ if missing.any? then <<-EOS.undent
Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:
@@ -1019,54 +1015,54 @@ def check_missing_deps
Run `brew missing` for more details.
EOS
+ end
end
-end
-def check_git_status
- return unless git?
- HOMEBREW_REPOSITORY.cd do
- unless `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.chomp.empty?
- <<-EOS.undent_________________________________________________________72
+ def check_git_status
+ return unless git?
+ HOMEBREW_REPOSITORY.cd do
+ unless `git status --untracked-files=all --porcelain -- Library/Homebrew/ 2>/dev/null`.chomp.empty?
+ <<-EOS.undent_________________________________________________________72
You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
cd #{HOMEBREW_LIBRARY} && git stash && git clean -d -f
EOS
+ end
end
end
-end
-def check_for_enthought_python
- if which "enpkg" then <<-EOS.undent
+ def check_for_enthought_python
+ if which "enpkg" then <<-EOS.undent
Enthought Python was found in your PATH.
This can cause build problems, as this software installs its own
copies of iconv and libxml2 into directories that are picked up by
other build systems.
EOS
+ end
end
-end
-def check_for_library_python
- if File.exist?("/Library/Frameworks/Python.framework") then <<-EOS.undent
+ def check_for_library_python
+ if File.exist?("/Library/Frameworks/Python.framework") then <<-EOS.undent
Python is installed at /Library/Frameworks/Python.framework
Homebrew only supports building against the System-provided Python or a
brewed Python. In particular, Pythons installed to /Library can interfere
with other software installs.
EOS
+ end
end
-end
-def check_for_old_homebrew_share_python_in_path
- s = ''
- ['', '3'].map do |suffix|
- if paths.include?((HOMEBREW_PREFIX/"share/python#{suffix}").to_s)
- s += "#{HOMEBREW_PREFIX}/share/python#{suffix} is not needed in PATH.\n"
+ def check_for_old_homebrew_share_python_in_path
+ s = ""
+ ["", "3"].map do |suffix|
+ if paths.include?((HOMEBREW_PREFIX/"share/python#{suffix}").to_s)
+ s += "#{HOMEBREW_PREFIX}/share/python#{suffix} is not needed in PATH.\n"
+ end
end
- end
- unless s.empty?
- s += <<-EOS.undent
+ unless s.empty?
+ s += <<-EOS.undent
Formerly homebrew put Python scripts you installed via `pip` or `pip3`
(or `easy_install`) into that directory above but now it can be removed
from your PATH variable.
@@ -1075,103 +1071,103 @@ def check_for_old_homebrew_share_python_in_path
(and #{HOMEBREW_PREFIX}/share/python3) dir and install affected Python packages
anew with `pip install --upgrade`.
EOS
+ end
end
-end
-def check_for_bad_python_symlink
- return unless which "python"
- `python -V 2>&1` =~ /Python (\d+)\./
- # This won't be the right warning if we matched nothing at all
- return if $1.nil?
- unless $1 == "2" then <<-EOS.undent
- python is symlinked to python#$1
+ def check_for_bad_python_symlink
+ return unless which "python"
+ `python -V 2>&1` =~ /Python (\d+)\./
+ # This won't be the right warning if we matched nothing at all
+ return if $1.nil?
+ unless $1 == "2" then <<-EOS.undent
+ python is symlinked to python#{$1}
This will confuse build scripts and in general lead to subtle breakage.
EOS
+ end
end
-end
-def check_for_non_prefixed_coreutils
- gnubin = "#{Formulary.factory('coreutils').prefix}/libexec/gnubin"
- if paths.include? gnubin then <<-EOS.undent
- Putting non-prefixed coreutils in your path can cause gmp builds to fail.
- EOS
+ def check_for_non_prefixed_coreutils
+ gnubin = "#{Formulary.factory("coreutils").prefix}/libexec/gnubin"
+ if paths.include? gnubin then <<-EOS.undent
+ Putting non-prefixed coreutils in your path can cause gmp builds to fail.
+ EOS
+ end
end
-end
-def check_for_non_prefixed_findutils
- default_names = Tab.for_name('findutils').with? "default-names"
- if default_names then <<-EOS.undent
- Putting non-prefixed findutils in your path can cause python builds to fail.
- EOS
+ def check_for_non_prefixed_findutils
+ default_names = Tab.for_name("findutils").with? "default-names"
+ if default_names then <<-EOS.undent
+ Putting non-prefixed findutils in your path can cause python builds to fail.
+ EOS
+ end
end
-end
-def check_for_pydistutils_cfg_in_home
- if File.exist? "#{ENV['HOME']}/.pydistutils.cfg" then <<-EOS.undent
+ def check_for_pydistutils_cfg_in_home
+ if File.exist? "#{ENV["HOME"]}/.pydistutils.cfg" then <<-EOS.undent
A .pydistutils.cfg file was found in $HOME, which may cause Python
builds to fail. See:
https://bugs.python.org/issue6138
https://bugs.python.org/issue4655
EOS
+ end
end
-end
-def check_for_outdated_homebrew
- return unless git?
- HOMEBREW_REPOSITORY.cd do
- if File.directory? ".git"
- local = `git rev-parse -q --verify refs/remotes/origin/master`.chomp
- remote = /^([a-f0-9]{40})/.match(`git ls-remote origin refs/heads/master 2>/dev/null`)
- if remote.nil? || local == remote[0]
- return
+ def check_for_outdated_homebrew
+ return unless git?
+ HOMEBREW_REPOSITORY.cd do
+ if File.directory? ".git"
+ local = `git rev-parse -q --verify refs/remotes/origin/master`.chomp
+ remote = /^([a-f0-9]{40})/.match(`git ls-remote origin refs/heads/master 2>/dev/null`)
+ if remote.nil? || local == remote[0]
+ return
+ end
end
- end
- timestamp = if File.directory? ".git"
- `git log -1 --format="%ct" HEAD`.to_i
- else
- HOMEBREW_LIBRARY.mtime.to_i
- end
+ timestamp = if File.directory? ".git"
+ `git log -1 --format="%ct" HEAD`.to_i
+ else
+ HOMEBREW_LIBRARY.mtime.to_i
+ end
- if Time.now.to_i - timestamp > 60 * 60 * 24 then <<-EOS.undent
+ if Time.now.to_i - timestamp > 60 * 60 * 24 then <<-EOS.undent
Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.
EOS
+ end
end
end
-end
-def check_for_unlinked_but_not_keg_only
- return unless HOMEBREW_CELLAR.exist?
- unlinked = HOMEBREW_CELLAR.children.reject do |rack|
- if not rack.directory?
- true
- elsif not (HOMEBREW_REPOSITORY/"Library/LinkedKegs"/rack.basename).directory?
- begin
- Formulary.from_rack(rack).keg_only?
- rescue FormulaUnavailableError, TapFormulaAmbiguityError
- false
+ def check_for_unlinked_but_not_keg_only
+ return unless HOMEBREW_CELLAR.exist?
+ unlinked = HOMEBREW_CELLAR.children.reject do |rack|
+ if !rack.directory?
+ true
+ elsif !(HOMEBREW_REPOSITORY/"Library/LinkedKegs"/rack.basename).directory?
+ begin
+ Formulary.from_rack(rack).keg_only?
+ rescue FormulaUnavailableError, TapFormulaAmbiguityError
+ false
+ end
+ else
+ true
end
- else
- true
- end
- end.map{ |pn| pn.basename }
+ end.map(&:basename)
- if not unlinked.empty? then <<-EOS.undent
+ unless unlinked.empty? then <<-EOS.undent
You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
#{unlinked * "\n "}
EOS
+ end
end
-end
def check_xcode_license_approved
# If the user installs Xcode-only, they have to approve the
# license or no "xc*" tool will work.
- if `/usr/bin/xcrun clang 2>&1` =~ /license/ and not $?.success? then <<-EOS.undent
+ if `/usr/bin/xcrun clang 2>&1` =~ /license/ && !$?.success? then <<-EOS.undent
You have not agreed to the Xcode license.
Builds will fail! Agree to the license by opening Xcode.app or running:
sudo xcodebuild -license
@@ -1232,7 +1228,7 @@ end
cmd_map[cmd_name] ||= []
cmd_map[cmd_name] << cmd
end
- cmd_map.reject! { |cmd_name, cmd_paths| cmd_paths.size == 1 }
+ cmd_map.reject! { |_cmd_name, cmd_paths| cmd_paths.size == 1 }
return if cmd_map.empty?
s = "You have external commands with conflicting names."
cmd_map.each do |cmd_name, cmd_paths|
@@ -1251,12 +1247,12 @@ module Homebrew
def doctor
checks = Checks.new
- if ARGV.include? '--list-checks'
+ if ARGV.include? "--list-checks"
puts checks.all.sort
exit
end
- inject_dump_stats(checks) if ARGV.switch? 'D'
+ inject_dump_stats(checks) if ARGV.switch? "D"
if ARGV.named.empty?
methods = checks.all.sort
@@ -1275,7 +1271,7 @@ module Homebrew
puts "No check available by the name: #{method}"
next
end
- unless out.nil? or out.empty?
+ unless out.nil? || out.empty?
if first_warning
puts <<-EOS.undent
#{Tty.white}Please note that these warnings are just used to help the Homebrew maintainers
@@ -1294,7 +1290,7 @@ module Homebrew
puts "Your system is ready to brew." unless Homebrew.failed?
end
- def inject_dump_stats checks
+ def inject_dump_stats(checks)
checks.extend Module.new {
def send(method, *)
time = Time.now
@@ -1304,8 +1300,8 @@ module Homebrew
end
}
$times = {}
- at_exit {
- puts $times.sort_by{|k, v| v }.map{|k, v| "#{k}: #{v}"}
- }
+ at_exit do
+ puts $times.sort_by { |_k, v| v }.map { |k, v| "#{k}: #{v}" }
+ end
end
end
diff --git a/Library/Homebrew/cmd/edit.rb b/Library/Homebrew/cmd/edit.rb
index 534fcba33..c683de0dc 100644
--- a/Library/Homebrew/cmd/edit.rb
+++ b/Library/Homebrew/cmd/edit.rb
@@ -1,8 +1,8 @@
-require 'formula'
+require "formula"
module Homebrew
def edit
- unless (HOMEBREW_REPOSITORY/'.git').directory?
+ unless (HOMEBREW_REPOSITORY/".git").directory?
raise <<-EOS.undent
Changes will be lost!
The first time you `brew update', all local changes will be lost, you should
@@ -13,11 +13,11 @@ module Homebrew
# If no brews are listed, open the project root in an editor.
if ARGV.named.empty?
editor = File.basename which_editor
- if editor == "mate" or editor == "subl"
+ if editor == "mate" || editor == "subl"
# If the user is using TextMate or Sublime Text,
# give a nice project view instead.
exec_editor HOMEBREW_REPOSITORY+"bin/brew",
- HOMEBREW_REPOSITORY+'README.md',
+ HOMEBREW_REPOSITORY+"README.md",
HOMEBREW_REPOSITORY+".gitignore",
*library_folders
else
@@ -38,7 +38,7 @@ module Homebrew
def library_folders
Dir["#{HOMEBREW_LIBRARY}/*"].reject do |d|
- case File.basename(d) when 'LinkedKegs', 'Aliases' then true end
+ case File.basename(d) when "LinkedKegs", "Aliases" then true end
end
end
end
diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb
index 3a7a5147c..edf9c7f76 100644
--- a/Library/Homebrew/cmd/fetch.rb
+++ b/Library/Homebrew/cmd/fetch.rb
@@ -1,10 +1,10 @@
-require 'formula'
+require "formula"
module Homebrew
def fetch
raise FormulaUnspecifiedError if ARGV.named.empty?
- if ARGV.include? '--deps'
+ if ARGV.include? "--deps"
bucket = []
ARGV.formulae.each do |f|
bucket << f
@@ -15,7 +15,7 @@ module Homebrew
bucket = ARGV.formulae
end
- puts "Fetching: #{bucket * ', '}" if bucket.size > 1
+ puts "Fetching: #{bucket * ", "}" if bucket.size > 1
bucket.each do |f|
f.print_tap_action :verb => "Fetching"
@@ -29,7 +29,7 @@ module Homebrew
end
end
- def fetch_bottle? f
+ def fetch_bottle?(f)
return true if ARGV.force_bottle? && f.bottle
return false unless f.bottle && f.pour_bottle?
return false if ARGV.build_from_source? || ARGV.build_bottle?
@@ -41,10 +41,10 @@ module Homebrew
return false
end
return false unless f.bottle.compatible_cellar?
- return true
+ true
end
- def fetch_resource r
+ def fetch_resource(r)
puts "Resource: #{r.name}"
fetch_fetchable r
rescue ChecksumMismatchError => e
@@ -52,14 +52,14 @@ module Homebrew
opoo "Resource #{r.name} reports different #{e.hash_type}: #{e.expected}"
end
- def fetch_formula f
+ def fetch_formula(f)
fetch_fetchable f
rescue ChecksumMismatchError => e
retry if retry_fetch? f
opoo "Formula reports different #{e.hash_type}: #{e.expected}"
end
- def fetch_patch p
+ def fetch_patch(p)
fetch_fetchable p
rescue ChecksumMismatchError => e
Homebrew.failed = true
@@ -68,7 +68,7 @@ module Homebrew
private
- def retry_fetch? f
+ def retry_fetch?(f)
@fetch_failed ||= Set.new
if ARGV.include?("--retry") && @fetch_failed.add?(f)
ohai "Retrying download"
@@ -80,7 +80,7 @@ module Homebrew
end
end
- def fetch_fetchable f
+ def fetch_fetchable(f)
f.clear_cache if ARGV.force?
already_fetched = f.cached_download.exist?
diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb
index ffd02ab52..db89f8e2e 100644
--- a/Library/Homebrew/cmd/gist-logs.rb
+++ b/Library/Homebrew/cmd/gist-logs.rb
@@ -1,11 +1,11 @@
-require 'formula'
-require 'cmd/config'
-require 'net/http'
-require 'net/https'
-require 'stringio'
+require "formula"
+require "cmd/config"
+require "net/http"
+require "net/https"
+require "stringio"
module Homebrew
- def gistify_logs f
+ def gistify_logs(f)
files = load_logs(f.logs)
s = StringIO.new
@@ -23,12 +23,12 @@ module Homebrew
url = create_gist(files)
- if ARGV.include?('--new-issue') || ARGV.switch?('n')
+ if ARGV.include?("--new-issue") || ARGV.switch?("n")
auth = :AUTH_TOKEN
unless HOMEBREW_GITHUB_API_TOKEN
- puts 'You can create a personal access token: https://github.com/settings/tokens'
- puts 'and then set HOMEBREW_GITHUB_API_TOKEN as authentication method.'
+ puts "You can create a personal access token: https://github.com/settings/tokens"
+ puts "and then set HOMEBREW_GITHUB_API_TOKEN as authentication method."
puts
auth = :AUTH_BASIC
@@ -40,19 +40,19 @@ module Homebrew
puts url if url
end
- #Hack for ruby < 1.9.3
+ # Hack for ruby < 1.9.3
def noecho_gets
- system 'stty -echo'
+ system "stty -echo"
result = $stdin.gets
- system 'stty echo'
+ system "stty echo"
puts
result
end
- def login request
- print 'GitHub User: '
+ def login(request)
+ print "GitHub User: "
user = $stdin.gets.chomp
- print 'Password: '
+ print "Password: "
password = noecho_gets.chomp
puts
request.basic_auth(user, password)
@@ -64,23 +64,23 @@ module Homebrew
contents = file.size? ? file.read : "empty log"
logs[file.basename.to_s] = { :content => contents }
end if dir.exist?
- raise 'No logs.' if logs.empty?
+ raise "No logs." if logs.empty?
logs
end
- def create_gist files
- post("/gists", { "public" => true, "files" => files })["html_url"]
+ def create_gist(files)
+ post("/gists", "public" => true, "files" => files)["html_url"]
end
- def new_issue repo, title, body, auth
+ def new_issue(repo, title, body, auth)
post("/repos/#{repo}/issues", { "title" => title, "body" => body }, auth)["html_url"]
end
def http
@http ||= begin
- uri = URI.parse('https://api.github.com')
- p = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : nil
- if p.class == URI::HTTP or p.class == URI::HTTPS
+ uri = URI.parse("https://api.github.com")
+ p = ENV["http_proxy"] ? URI.parse(ENV["http_proxy"]) : nil
+ if p.class == URI::HTTP || p.class == URI::HTTPS
@http = Net::HTTP.new(uri.host, uri.port, p.host, p.port, p.user, p.password)
else
@http = Net::HTTP.new(uri.host, uri.port)
@@ -94,10 +94,10 @@ module Homebrew
headers = {
"User-Agent" => HOMEBREW_USER_AGENT,
"Accept" => "application/vnd.github.v3+json",
- "Content-Type" => "application/json",
+ "Content-Type" => "application/json"
}
- if auth == :AUTH_TOKEN || (auth == nil && HOMEBREW_GITHUB_API_TOKEN)
+ if auth == :AUTH_TOKEN || (auth.nil? && HOMEBREW_GITHUB_API_TOKEN)
headers["Authorization"] = "token #{HOMEBREW_GITHUB_API_TOKEN}"
end
diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb
index 858ccaf85..474bda0d6 100644
--- a/Library/Homebrew/cmd/help.rb
+++ b/Library/Homebrew/cmd/help.rb
@@ -35,6 +35,7 @@ module Homebrew
def help
puts HOMEBREW_HELP
end
+
def help_s
HOMEBREW_HELP
end
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 332168ee7..3117ebf2c 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -12,7 +12,7 @@ module Homebrew
# awhile around for compatibility
if ARGV.json == "v1"
print_json
- elsif ARGV.flag? '--github'
+ elsif ARGV.flag? "--github"
exec_browser(*ARGV.formulae.map { |f| github_info(f) })
else
print_info
@@ -26,7 +26,7 @@ module Homebrew
puts "#{count} keg#{plural(count)}, #{HOMEBREW_CELLAR.abv}"
end
else
- ARGV.named.each_with_index do |f,i|
+ ARGV.named.each_with_index do |f, i|
puts unless i == 0
begin
info_formula Formulary.factory(f)
@@ -44,13 +44,13 @@ module Homebrew
def print_json
ff = if ARGV.include? "--all"
- Formula
- elsif ARGV.include? "--installed"
- Formula.installed
- else
- ARGV.formulae
- end
- json = ff.map {|f| f.to_hash}
+ Formula
+ elsif ARGV.include? "--installed"
+ Formula.installed
+ else
+ ARGV.formulae
+ end
+ json = ff.map(&:to_hash)
puts Utils::JSON.dump(json)
end
@@ -62,7 +62,7 @@ module Homebrew
end
end
- def github_info f
+ def github_info(f)
if f.tap?
user, repo = f.tap.split("/", 2)
path = f.path.relative_path_from(HOMEBREW_LIBRARY.join("Taps", f.tap))
@@ -76,7 +76,7 @@ module Homebrew
end
end
- def info_formula f
+ def info_formula(f)
specs = []
if stable = f.stable
@@ -93,7 +93,7 @@ module Homebrew
specs << "HEAD" if f.head
- puts "#{f.full_name}: #{specs*', '}#{' (pinned)' if f.pinned?}"
+ puts "#{f.full_name}: #{specs*", "}#{" (pinned)" if f.pinned?}"
puts f.desc if f.desc
@@ -107,12 +107,12 @@ module Homebrew
end
conflicts = f.conflicts.map(&:name).sort!
- puts "Conflicts with: #{conflicts*', '}" unless conflicts.empty?
+ puts "Conflicts with: #{conflicts*", "}" unless conflicts.empty?
if f.rack.directory?
kegs = f.rack.subdirs.map { |keg| Keg.new(keg) }.sort_by(&:version)
kegs.each do |keg|
- puts "#{keg} (#{keg.abv})#{' *' if keg.linked?}"
+ puts "#{keg} (#{keg.abv})#{" *" if keg.linked?}"
tab = Tab.for_keg(keg).to_s
puts " #{tab}" unless tab.empty?
end
@@ -125,7 +125,7 @@ module Homebrew
unless f.deps.empty?
ohai "Dependencies"
- %w{build required recommended optional}.map do |type|
+ %w[build required recommended optional].map do |type|
deps = f.deps.send(type).uniq
puts "#{type.capitalize}: #{decorate_dependencies deps}" unless deps.empty?
end
@@ -137,10 +137,10 @@ module Homebrew
end
c = Caveats.new(f)
- ohai 'Caveats', c.caveats unless c.empty?
+ ohai "Caveats", c.caveats unless c.empty?
end
- def decorate_dependencies dependencies
+ def decorate_dependencies(dependencies)
# necessary for 1.8.7 unicode handling since many installs are on 1.8.7
tick = ["2714".hex].pack("U*")
cross = ["2718".hex].pack("U*")
@@ -153,7 +153,7 @@ module Homebrew
color = Tty.red
symbol = cross
end
- if ENV['HOMEBREW_NO_EMOJI']
+ if ENV["HOMEBREW_NO_EMOJI"]
colored_dep = "#{color}#{dep}"
else
colored_dep = "#{dep} #{color}#{symbol}"
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 124fa0527..7091b9bfc 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -9,7 +9,7 @@ module Homebrew
def install
raise FormulaUnspecifiedError if ARGV.named.empty?
- if ARGV.include? '--head'
+ if ARGV.include? "--head"
raise "Specify `--HEAD` in uppercase to build from trunk."
end
@@ -40,7 +40,7 @@ module Homebrew
ARGV.formulae.each do |f|
# head-only without --HEAD is an error
- if not ARGV.build_head? and f.stable.nil? and f.devel.nil?
+ if !ARGV.build_head? && f.stable.nil? && f.devel.nil?
raise <<-EOS.undent
#{f.full_name} is a head-only formula
Install with `brew install --HEAD #{f.full_name}`
@@ -48,30 +48,30 @@ module Homebrew
end
# devel-only without --devel is an error
- if not ARGV.build_devel? and f.stable.nil? and f.head.nil?
+ if !ARGV.build_devel? && f.stable.nil? && f.head.nil?
raise <<-EOS.undent
#{f.full_name} is a devel-only formula
Install with `brew install --devel #{f.full_name}`
EOS
end
- if ARGV.build_stable? and f.stable.nil?
+ if ARGV.build_stable? && f.stable.nil?
raise "#{f.full_name} has no stable download, please choose --devel or --HEAD"
end
# --HEAD, fail with no head defined
- if ARGV.build_head? and f.head.nil?
+ if ARGV.build_head? && f.head.nil?
raise "No head is defined for #{f.full_name}"
end
# --devel, fail with no devel defined
- if ARGV.build_devel? and f.devel.nil?
+ if ARGV.build_devel? && f.devel.nil?
raise "No devel block is defined for #{f.full_name}"
end
if f.installed?
msg = "#{f.full_name}-#{f.installed_version} already installed"
- msg << ", it's just not linked" unless f.linked_keg.symlink? or f.keg_only?
+ msg << ", it's just not linked" unless f.linked_keg.symlink? || f.keg_only?
opoo msg
else
formulae << f
@@ -107,17 +107,18 @@ module Homebrew
end
def check_ppc
- case Hardware::CPU.type when :ppc, :dunno
+ case Hardware::CPU.type
+ when :ppc, :dunno
abort <<-EOS.undent
Sorry, Homebrew does not support your computer's CPU architecture.
For PPC support, see: https://github.com/mistydemeo/tigerbrew
- EOS
+ EOS
end
end
def check_writable_install_location
- raise "Cannot write to #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.exist? and not HOMEBREW_CELLAR.writable_real?
- raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable_real? or HOMEBREW_PREFIX.to_s == '/usr/local'
+ raise "Cannot write to #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.exist? && !HOMEBREW_CELLAR.writable_real?
+ raise "Cannot write to #{HOMEBREW_PREFIX}" unless HOMEBREW_PREFIX.writable_real? || HOMEBREW_PREFIX.to_s == "/usr/local"
end
def check_xcode
@@ -143,7 +144,7 @@ module Homebrew
end
def check_cellar
- FileUtils.mkdir_p HOMEBREW_CELLAR if not File.exist? HOMEBREW_CELLAR
+ FileUtils.mkdir_p HOMEBREW_CELLAR unless File.exist? HOMEBREW_CELLAR
rescue
raise <<-EOS.undent
Could not create #{HOMEBREW_CELLAR}
@@ -158,7 +159,7 @@ module Homebrew
check_cellar
end
- def install_formula f
+ def install_formula(f)
f.print_tap_action
fi = FormulaInstaller.new(f)
diff --git a/Library/Homebrew/cmd/irb.rb b/Library/Homebrew/cmd/irb.rb
index 3e6102dd2..1a272a684 100644
--- a/Library/Homebrew/cmd/irb.rb
+++ b/Library/Homebrew/cmd/irb.rb
@@ -1,6 +1,6 @@
-require 'formula'
-require 'keg'
-require 'irb'
+require "formula"
+require "keg"
+require "irb"
class Symbol
def f(*args)
diff --git a/Library/Homebrew/cmd/leaves.rb b/Library/Homebrew/cmd/leaves.rb
index 335872309..48be4b70c 100644
--- a/Library/Homebrew/cmd/leaves.rb
+++ b/Library/Homebrew/cmd/leaves.rb
@@ -1,6 +1,6 @@
-require 'formula'
-require 'tab'
-require 'set'
+require "formula"
+require "tab"
+require "set"
module Homebrew
def leaves
diff --git a/Library/Homebrew/cmd/link.rb b/Library/Homebrew/cmd/link.rb
index 98b10cb0f..9ff449e7f 100644
--- a/Library/Homebrew/cmd/link.rb
+++ b/Library/Homebrew/cmd/link.rb
@@ -1,4 +1,4 @@
-require 'ostruct'
+require "ostruct"
module Homebrew
def link
@@ -6,7 +6,7 @@ module Homebrew
mode = OpenStruct.new
- mode.overwrite = true if ARGV.include? '--overwrite'
+ mode.overwrite = true if ARGV.include? "--overwrite"
mode.dry_run = true if ARGV.dry_run?
ARGV.kegs.each do |keg|
diff --git a/Library/Homebrew/cmd/linkapps.rb b/Library/Homebrew/cmd/linkapps.rb
index b21cbcd1f..f484d9850 100644
--- a/Library/Homebrew/cmd/linkapps.rb
+++ b/Library/Homebrew/cmd/linkapps.rb
@@ -1,5 +1,5 @@
# Links any Applications (.app) found in installed prefixes to /Applications
-require 'keg'
+require "keg"
module Homebrew
def linkapps
@@ -16,7 +16,7 @@ module Homebrew
kegs = racks.map do |rack|
keg = rack.subdirs.map { |d| Keg.new(d) }
next if keg.empty?
- keg.detect(&:linked?) || keg.max {|a,b| a.version <=> b.version}
+ keg.detect(&:linked?) || keg.max { |a, b| a.version <=> b.version }
end
else
kegs = ARGV.kegs
diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb
index 81a5caf4d..53985d113 100644
--- a/Library/Homebrew/cmd/list.rb
+++ b/Library/Homebrew/cmd/list.rb
@@ -3,9 +3,8 @@ require "formula"
module Homebrew
def list
-
# Use of exec means we don't explicitly exit
- list_unbrewed if ARGV.flag? '--unbrewed'
+ list_unbrewed if ARGV.flag? "--unbrewed"
# Unbrewed uses the PREFIX, which will exist
# Things below use the CELLAR, which doesn't until the first formula is installed.
@@ -14,7 +13,7 @@ module Homebrew
return
end
- if ARGV.include? '--pinned' or ARGV.include? '--versions'
+ if ARGV.include?("--pinned") || ARGV.include?("--versions")
filtered_list
elsif ARGV.named.empty?
if ARGV.include? "--full-name"
@@ -29,13 +28,13 @@ module Homebrew
end
puts_columns full_names
else
- ENV['CLICOLOR'] = nil
- exec 'ls', *ARGV.options_only << HOMEBREW_CELLAR
+ ENV["CLICOLOR"] = nil
+ exec "ls", *ARGV.options_only << HOMEBREW_CELLAR
end
- elsif ARGV.verbose? or not $stdout.tty?
+ elsif ARGV.verbose? || !$stdout.tty?
exec "find", *ARGV.kegs.map(&:to_s) + %w[-not -type d -print]
else
- ARGV.kegs.each{ |keg| PrettyListing.new keg }
+ ARGV.kegs.each { |keg| PrettyListing.new keg }
end
end
@@ -65,8 +64,8 @@ module Homebrew
# Exclude the repository and cache, if they are located under the prefix
dirs.delete HOMEBREW_CACHE.relative_path_from(HOMEBREW_PREFIX).to_s
dirs.delete HOMEBREW_REPOSITORY.relative_path_from(HOMEBREW_PREFIX).to_s
- dirs.delete 'etc'
- dirs.delete 'var'
+ dirs.delete "etc"
+ dirs.delete "var"
args = dirs + %w[-type f (]
args.concat UNBREWED_EXCLUDE_FILES.map { |f| %W[! -name #{f}] }.flatten
@@ -74,46 +73,46 @@ module Homebrew
args.concat %w[)]
cd HOMEBREW_PREFIX
- exec 'find', *args
+ exec "find", *args
end
def filtered_list
names = if ARGV.named.empty?
HOMEBREW_CELLAR.subdirs
else
- ARGV.named.map{ |n| HOMEBREW_CELLAR+n }.select{ |pn| pn.exist? }
+ ARGV.named.map { |n| HOMEBREW_CELLAR+n }.select(&:exist?)
end
- if ARGV.include? '--pinned'
+ if ARGV.include? "--pinned"
pinned_versions = {}
names.each do |d|
keg_pin = (HOMEBREW_LIBRARY/"PinnedKegs"/d.basename.to_s)
- if keg_pin.exist? or keg_pin.symlink?
+ if keg_pin.exist? || keg_pin.symlink?
pinned_versions[d] = keg_pin.readlink.basename.to_s
end
end
pinned_versions.each do |d, version|
- puts "#{d.basename}".concat(ARGV.include?('--versions') ? " #{version}" : '')
+ puts "#{d.basename}".concat(ARGV.include?("--versions") ? " #{version}" : "")
end
else # --versions without --pinned
names.each do |d|
versions = d.subdirs.map { |pn| pn.basename.to_s }
- next if ARGV.include?('--multiple') && versions.count < 2
- puts "#{d.basename} #{versions*' '}"
+ next if ARGV.include?("--multiple") && versions.count < 2
+ puts "#{d.basename} #{versions*" "}"
end
end
end
end
class PrettyListing
- def initialize path
+ def initialize(path)
Pathname.new(path).children.sort_by { |p| p.to_s.downcase }.each do |pn|
case pn.basename.to_s
- when 'bin', 'sbin'
+ when "bin", "sbin"
pn.find { |pnn| puts pnn unless pnn.directory? }
- when 'lib'
+ when "lib"
print_dir pn do |pnn|
# dylibs have multiple symlinks and we don't care about them
- (pnn.extname == '.dylib' or pnn.extname == '.pc') and not pnn.symlink?
+ (pnn.extname == ".dylib" || pnn.extname == ".pc") && !pnn.symlink?
end
else
if pn.directory?
@@ -129,19 +128,19 @@ class PrettyListing
end
end
- def print_dir root
+ def print_dir(root)
dirs = []
remaining_root_files = []
- other = ''
+ other = ""
root.children.sort.each do |pn|
if pn.directory?
dirs << pn
elsif block_given? and yield pn
puts pn
- other = 'other '
+ other = "other "
else
- remaining_root_files << pn unless pn.basename.to_s == '.DS_Store'
+ remaining_root_files << pn unless pn.basename.to_s == ".DS_Store"
end
end
@@ -154,7 +153,7 @@ class PrettyListing
print_remaining_files remaining_root_files, root, other
end
- def print_remaining_files files, root, other = ''
+ def print_remaining_files(files, root, other = "")
case files.length
when 0
# noop
diff --git a/Library/Homebrew/cmd/man.rb b/Library/Homebrew/cmd/man.rb
index bba81efa5..5c4abbe39 100644
--- a/Library/Homebrew/cmd/man.rb
+++ b/Library/Homebrew/cmd/man.rb
@@ -1,4 +1,4 @@
-require 'formula'
+require "formula"
module Homebrew
SOURCE_PATH=HOMEBREW_REPOSITORY/"Library/Homebrew/manpages"
diff --git a/Library/Homebrew/cmd/missing.rb b/Library/Homebrew/cmd/missing.rb
index 9c675b8fe..14d76f54e 100644
--- a/Library/Homebrew/cmd/missing.rb
+++ b/Library/Homebrew/cmd/missing.rb
@@ -1,8 +1,8 @@
-require 'formula'
-require 'tab'
+require "formula"
+require "tab"
module Homebrew
- def missing_deps ff
+ def missing_deps(ff)
missing = {}
ff.each do |f|
missing_deps = f.recursive_dependencies do |dependent, dep|
@@ -36,7 +36,7 @@ module Homebrew
missing_deps(ff) do |name, missing|
print "#{name}: " if ff.size > 1
- puts "#{missing * ' '}"
+ puts "#{missing * " "}"
end
end
end
diff --git a/Library/Homebrew/cmd/options.rb b/Library/Homebrew/cmd/options.rb
index 4e7fe0a42..9db4f2f9c 100644
--- a/Library/Homebrew/cmd/options.rb
+++ b/Library/Homebrew/cmd/options.rb
@@ -1,10 +1,10 @@
-require 'formula'
+require "formula"
module Homebrew
def options
- if ARGV.include? '--all'
+ if ARGV.include? "--all"
puts_options Formula.to_a
- elsif ARGV.include? '--installed'
+ elsif ARGV.include? "--installed"
puts_options Formula.installed
else
raise FormulaUnspecifiedError if ARGV.named.empty?
@@ -15,7 +15,7 @@ module Homebrew
def puts_options(formulae)
formulae.each do |f|
next if f.options.empty?
- if ARGV.include? '--compact'
+ if ARGV.include? "--compact"
puts f.options.as_flags.sort * " "
else
puts f.full_name if formulae.length > 1
@@ -25,7 +25,7 @@ module Homebrew
end
end
- def dump_options_for_formula f
+ def dump_options_for_formula(f)
f.options.sort_by(&:flag).each do |opt|
puts "#{opt.flag}\n\t#{opt.description}"
end
diff --git a/Library/Homebrew/cmd/outdated.rb b/Library/Homebrew/cmd/outdated.rb
index caf4b2cf7..673ea966c 100644
--- a/Library/Homebrew/cmd/outdated.rb
+++ b/Library/Homebrew/cmd/outdated.rb
@@ -1,5 +1,5 @@
-require 'formula'
-require 'keg'
+require "formula"
+require "keg"
module Homebrew
def outdated
@@ -40,7 +40,7 @@ module Homebrew
outdated_brews(formulae) do |f, versions|
if verbose
- puts "#{f.full_name} (#{versions*', '} < #{f.pkg_version})"
+ puts "#{f.full_name} (#{versions*", "} < #{f.pkg_version})"
else
puts f.full_name
end
@@ -50,9 +50,9 @@ module Homebrew
def print_outdated_json(formulae)
json = []
outdated = outdated_brews(formulae) do |f, versions|
- json << {:name => f.full_name,
- :installed_versions => versions.collect(&:to_s),
- :current_version => f.pkg_version.to_s}
+ json << { :name => f.full_name,
+ :installed_versions => versions.collect(&:to_s),
+ :current_version => f.pkg_version.to_s }
end
puts Utils::JSON.dump(json)
diff --git a/Library/Homebrew/cmd/pin.rb b/Library/Homebrew/cmd/pin.rb
index bc8fcad5d..0b6dfa30b 100644
--- a/Library/Homebrew/cmd/pin.rb
+++ b/Library/Homebrew/cmd/pin.rb
@@ -1,4 +1,4 @@
-require 'formula'
+require "formula"
module Homebrew
def pin
diff --git a/Library/Homebrew/cmd/prune.rb b/Library/Homebrew/cmd/prune.rb
index 6fa47c11c..d6ece8305 100644
--- a/Library/Homebrew/cmd/prune.rb
+++ b/Library/Homebrew/cmd/prune.rb
@@ -1,5 +1,5 @@
-require 'keg'
-require 'cmd/tap'
+require "keg"
+require "cmd/tap"
module Homebrew
def prune
@@ -44,7 +44,7 @@ module Homebrew
n, d = ObserverPathnameExtension.counts
print "Pruned #{n} symbolic links "
print "and #{d} directories " if d > 0
- puts "from #{HOMEBREW_PREFIX}"
+ puts "from #{HOMEBREW_PREFIX}"
end unless ARGV.dry_run?
end
end
diff --git a/Library/Homebrew/cmd/pull.rb b/Library/Homebrew/cmd/pull.rb
index 983278ab2..809e4b5a4 100644
--- a/Library/Homebrew/cmd/pull.rb
+++ b/Library/Homebrew/cmd/pull.rb
@@ -1,33 +1,33 @@
# Gets a patch from a GitHub commit or pull request and applies it to Homebrew.
# Optionally, installs it too.
-require 'utils'
-require 'formula'
-require 'cmd/tap'
+require "utils"
+require "formula"
+require "cmd/tap"
module Homebrew
HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/homebrew(-[\w-]+)?/pulls/(\d+)}
- def tap arg
- match = arg.match(%r[homebrew-([\w-]+)/])
+ def tap(arg)
+ match = arg.match(%r{homebrew-([\w-]+)/})
match[1].downcase if match
end
- def pull_url url
+ def pull_url(url)
# GitHub provides commits/pull-requests raw patches using this URL.
- url += '.patch'
+ url += ".patch"
patchpath = HOMEBREW_CACHE + File.basename(url)
- curl url, '-o', patchpath
+ curl url, "-o", patchpath
- ohai 'Applying patch'
+ ohai "Applying patch"
patch_args = []
# Normally we don't want whitespace errors, but squashing them can break
# patches so an option is provided to skip this step.
- if ARGV.include? '--ignore-whitespace' or ARGV.include? '--clean'
- patch_args << '--whitespace=nowarn'
+ if ARGV.include?("--ignore-whitespace") || ARGV.include?("--clean")
+ patch_args << "--whitespace=nowarn"
else
- patch_args << '--whitespace=fix'
+ patch_args << "--whitespace=fix"
end
# Fall back to three-way merge if patch does not apply cleanly
@@ -35,13 +35,13 @@ module Homebrew
patch_args << patchpath
begin
- safe_system 'git', 'am', *patch_args
+ safe_system "git", "am", *patch_args
rescue ErrorDuringExecution
if ARGV.include? "--resolve"
odie "Patch failed to apply: try to resolve it."
else
- system 'git', 'am', '--abort'
- odie 'Patch failed to apply: aborted.'
+ system "git", "am", "--abort"
+ odie "Patch failed to apply: aborted."
end
ensure
patchpath.unlink
@@ -50,11 +50,11 @@ module Homebrew
def pull
if ARGV.empty?
- odie 'This command requires at least one argument containing a URL or pull request number'
+ odie "This command requires at least one argument containing a URL or pull request number"
end
- if ARGV[0] == '--rebase'
- odie 'You meant `git pull --rebase`.'
+ if ARGV[0] == "--rebase"
+ odie "You meant `git pull --rebase`."
end
ARGV.named.each do |arg|
@@ -64,7 +64,7 @@ module Homebrew
elsif (testing_match = arg.match %r{brew.sh/job/Homebrew%20Testing/(\d+)/})
_, testing_job = *testing_match
url = "https://github.com/Homebrew/homebrew/compare/master...BrewTestBot:testing-#{testing_job}"
- odie "Testing URLs require `--bottle`!" unless ARGV.include?('--bottle')
+ odie "Testing URLs require `--bottle`!" unless ARGV.include?("--bottle")
else
if (api_match = arg.match HOMEBREW_PULL_API_REGEX)
_, user, tap, pull = *api_match
@@ -126,19 +126,19 @@ module Homebrew
end
end
- unless ARGV.include? '--bottle'
+ unless ARGV.include? "--bottle"
changed_formulae.each do |f|
next unless f.bottle
opoo "#{f.full_name} has a bottle: do you need to update it with --bottle?"
end
end
- if issue && !ARGV.include?('--clean')
+ if issue && !ARGV.include?("--clean")
ohai "Patch closes issue ##{issue}"
message = `git log HEAD^.. --format=%B`
- if ARGV.include? '--bump'
- odie 'Can only bump one changed formula' unless changed_formulae.length == 1
+ if ARGV.include? "--bump"
+ odie "Can only bump one changed formula" unless changed_formulae.length == 1
formula = changed_formulae.first
subject = "#{formula.name} #{formula.version}"
ohai "New bump commit subject: #{subject}"
@@ -149,7 +149,7 @@ module Homebrew
# If this is a pull request, append a close message.
unless message.include? "Closes ##{issue}."
message += "\nCloses ##{issue}."
- safe_system 'git', 'commit', '--amend', '--signoff', '--allow-empty', '-q', '-m', message
+ safe_system "git", "commit", "--amend", "--signoff", "--allow-empty", "-q", "-m", message
end
end
@@ -202,14 +202,14 @@ module Homebrew
end
end
- ohai 'Patch changed:'
+ ohai "Patch changed:"
safe_system "git", "diff-tree", "-r", "--stat", revision, "HEAD"
- if ARGV.include? '--install'
+ if ARGV.include? "--install"
changed_formulae.each do |f|
ohai "Installing #{f.full_name}"
- install = f.installed? ? 'upgrade' : 'install'
- safe_system 'brew', install, '--debug', f.full_name
+ install = f.installed? ? "upgrade" : "install"
+ safe_system "brew", install, "--debug", f.full_name
end
end
end
diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb
index 1bdaf373f..bf49282ae 100644
--- a/Library/Homebrew/cmd/reinstall.rb
+++ b/Library/Homebrew/cmd/reinstall.rb
@@ -5,7 +5,7 @@ module Homebrew
ARGV.resolved_formulae.each { |f| reinstall_formula(f) }
end
- def reinstall_formula f
+ def reinstall_formula(f)
tab = Tab.for_formula(f)
options = tab.used_options | f.build.used_options
@@ -38,12 +38,12 @@ module Homebrew
backup_path(keg).rmtree if backup_path(keg).exist?
end
- def backup keg
+ def backup(keg)
keg.unlink
keg.rename backup_path(keg)
end
- def restore_backup keg, formula
+ def restore_backup(keg, formula)
path = backup_path(keg)
if path.directory?
path.rename keg
@@ -51,7 +51,7 @@ module Homebrew
end
end
- def backup_path path
+ def backup_path(path)
Pathname.new "#{path}.reinstall"
end
end
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index 8812d093b..c3d1597c3 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -1,27 +1,26 @@
-require 'formula'
-require 'blacklist'
-require 'utils'
-require 'thread'
+require "formula"
+require "blacklist"
+require "utils"
+require "thread"
require "official_taps"
module Homebrew
-
SEARCH_ERROR_QUEUE = Queue.new
def search
- if ARGV.include? '--macports'
+ if ARGV.include? "--macports"
exec_browser "https://www.macports.org/ports.php?by=name&substr=#{ARGV.next}"
- elsif ARGV.include? '--fink'
+ elsif ARGV.include? "--fink"
exec_browser "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}"
- elsif ARGV.include? '--debian'
+ elsif ARGV.include? "--debian"
exec_browser "https://packages.debian.org/search?keywords=#{ARGV.next}&searchon=names&suite=all&section=all"
- elsif ARGV.include? '--opensuse'
+ elsif ARGV.include? "--opensuse"
exec_browser "https://software.opensuse.org/search?q=#{ARGV.next}"
- elsif ARGV.include? '--fedora'
+ elsif ARGV.include? "--fedora"
exec_browser "https://admin.fedoraproject.org/pkgdb/packages/%2A#{ARGV.next}%2A/"
- elsif ARGV.include? '--ubuntu'
+ elsif ARGV.include? "--ubuntu"
exec_browser "http://packages.ubuntu.com/search?keywords=#{ARGV.next}&searchon=names&suite=all&section=all"
- elsif ARGV.include? '--desc'
+ elsif ARGV.include? "--desc"
query = ARGV.next
rx = query_regexp(query)
Formula.each do |formula|
@@ -48,7 +47,7 @@ module Homebrew
local_results = search_formulae(rx)
puts_columns(local_results)
- if not query.empty? and $stdout.tty? and msg = blacklisted?(query)
+ if !query.empty? && $stdout.tty? && msg = blacklisted?(query)
unless local_results.empty?
puts
puts "If you meant #{query.inspect} precisely:"
@@ -61,7 +60,7 @@ module Homebrew
puts_columns(tap_results)
count = local_results.length + tap_results.length
- if count == 0 and not blacklisted? query
+ if count == 0 and !blacklisted? query
puts "No formula found for #{query.inspect}."
begin
GitHub.print_pull_requests_matching(query)
@@ -73,7 +72,7 @@ module Homebrew
metacharacters = %w[\\ | ( ) [ ] { } ^ $ * + ? .]
bad_regex = metacharacters.any? do |char|
ARGV.any? do |arg|
- arg.include?(char) && !arg.start_with?('/')
+ arg.include?(char) && !arg.start_with?("/")
end
end
if ARGV.any? && bad_regex
@@ -84,7 +83,7 @@ module Homebrew
end
SEARCHABLE_TAPS = OFFICIAL_TAPS.map { |tap| ["Homebrew", tap] } + [
- %w{Caskroom cask},
+ %w[Caskroom cask]
]
def query_regexp(query)
@@ -102,7 +101,7 @@ module Homebrew
end
end
- def search_tap user, repo, rx
+ def search_tap(user, repo, rx)
if (HOMEBREW_LIBRARY/"Taps/#{user.downcase}/homebrew-#{repo.downcase}").directory? && \
"#{user}/#{repo}" != "Caskroom/cask"
return []
@@ -140,7 +139,7 @@ module Homebrew
[]
end
- def search_formulae rx
+ def search_formulae(rx)
aliases = Formula.aliases
results = (Formula.full_names+aliases).grep(rx).sort
diff --git a/Library/Homebrew/cmd/sh.rb b/Library/Homebrew/cmd/sh.rb
index e48313a77..bc09d4850 100644
--- a/Library/Homebrew/cmd/sh.rb
+++ b/Library/Homebrew/cmd/sh.rb
@@ -1,5 +1,5 @@
-require 'extend/ENV'
-require 'formula'
+require "extend/ENV"
+require "formula"
module Homebrew
def sh
@@ -12,10 +12,10 @@ module Homebrew
ENV.setup_build_environment
if superenv?
# superenv stopped adding brew's bin but generally user's will want it
- ENV['PATH'] = ENV['PATH'].split(File::PATH_SEPARATOR).insert(1, "#{HOMEBREW_PREFIX}/bin").join(File::PATH_SEPARATOR)
+ ENV["PATH"] = ENV["PATH"].split(File::PATH_SEPARATOR).insert(1, "#{HOMEBREW_PREFIX}/bin").join(File::PATH_SEPARATOR)
end
- ENV['PS1'] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ '
- ENV['VERBOSE'] = '1'
+ ENV["PS1"] = 'brew \[\033[1;32m\]\w\[\033[0m\]$ '
+ ENV["VERBOSE"] = "1"
puts <<-EOS.undent_________________________________________________________72
Your shell has been configured to use Homebrew's build environment:
this should help you build stuff. Notably though, the system versions of
@@ -24,6 +24,6 @@ module Homebrew
ignore our configuration.
When done, type `exit'.
EOS
- exec ENV['SHELL']
+ exec ENV["SHELL"]
end
end
diff --git a/Library/Homebrew/cmd/switch.rb b/Library/Homebrew/cmd/switch.rb
index 8c058fdd1..5efebd7e5 100644
--- a/Library/Homebrew/cmd/switch.rb
+++ b/Library/Homebrew/cmd/switch.rb
@@ -25,7 +25,7 @@ module Homebrew
onoe "#{name} does not have a version \"#{version}\" in the Cellar."
versions = rack.subdirs.map { |d| Keg.new(d).version }
- puts "Versions available: #{versions.join(', ')}"
+ puts "Versions available: #{versions.join(", ")}"
exit 3
end
diff --git a/Library/Homebrew/cmd/tap-readme.rb b/Library/Homebrew/cmd/tap-readme.rb
index 3ec901bee..c6c5b262f 100644
--- a/Library/Homebrew/cmd/tap-readme.rb
+++ b/Library/Homebrew/cmd/tap-readme.rb
@@ -25,7 +25,7 @@ module Homebrew
EOS
puts template if ARGV.verbose?
- path = Pathname.new('./README.md')
+ path = Pathname.new("./README.md")
raise "#{path} already exists" if path.exist?
path.write template
end
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb
index 43e47711e..c7fb0733e 100644
--- a/Library/Homebrew/cmd/tap.rb
+++ b/Library/Homebrew/cmd/tap.rb
@@ -13,7 +13,7 @@ module Homebrew
end
end
- def install_tap user, repo, clone_target=nil
+ def install_tap(user, repo, clone_target = nil)
tap = Tap.new user, repo
return false if tap.installed?
ohai "Tapping #{tap}"
@@ -23,7 +23,7 @@ module Homebrew
safe_system "git", *args
formula_count = tap.formula_files.size
- puts "Tapped #{formula_count} formula#{plural(formula_count, 'e')} (#{tap.path.abv})"
+ puts "Tapped #{formula_count} formula#{plural(formula_count, "e")} (#{tap.path.abv})"
if !clone_target && tap.private?
puts <<-EOS.undent
@@ -40,7 +40,7 @@ module Homebrew
end
# Migrate tapped formulae from symlink-based to directory-based structure.
- def migrate_taps(options={})
+ def migrate_taps(options = {})
ignore = HOMEBREW_LIBRARY/"Formula/.gitignore"
return unless ignore.exist? || options.fetch(:force, false)
(HOMEBREW_LIBRARY/"Formula").children.select(&:symlink?).each(&:unlink)
@@ -49,7 +49,7 @@ module Homebrew
private
- def tap_args(tap_name=ARGV.named.first)
+ def tap_args(tap_name = ARGV.named.first)
tap_name =~ HOMEBREW_TAP_ARGS_REGEX
raise "Invalid tap name" unless $1 && $3
[$1, $3]
diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb
index 6a14c3d05..0336796ca 100644
--- a/Library/Homebrew/cmd/test-bot.rb
+++ b/Library/Homebrew/cmd/test-bot.rb
@@ -23,19 +23,19 @@
# --ci-upload: Homebrew CI bottle upload.
# --ci-reset-and-update: Homebrew CI repository and tap reset and update.
-require 'formula'
-require 'utils'
-require 'date'
-require 'rexml/document'
-require 'rexml/xmldecl'
-require 'rexml/cdata'
-require 'cmd/tap'
+require "formula"
+require "utils"
+require "date"
+require "rexml/document"
+require "rexml/xmldecl"
+require "rexml/cdata"
+require "cmd/tap"
module Homebrew
EMAIL_SUBJECT_FILE = "brew-test-bot.#{MacOS.cat}.email.txt"
BYTES_IN_1_MEGABYTE = 1024*1024
- def homebrew_git_repo tap=nil
+ def homebrew_git_repo(tap = nil)
if tap
user, repo = tap.split "/"
HOMEBREW_LIBRARY/"Taps/#{user}/homebrew-#{repo}"
@@ -47,7 +47,7 @@ module Homebrew
class Step
attr_reader :command, :name, :status, :output, :time
- def initialize test, command, options={}
+ def initialize(test, command, options = {})
@test = test
@category = test.category
@command = command
@@ -92,7 +92,7 @@ module Homebrew
cmd = @command.join(" ")
print "#{Tty.blue}==>#{Tty.white} #{cmd}#{Tty.reset}"
tabs = (80 - "PASSED".length + 1 - cmd.length) / 8
- tabs.times{ print "\t" }
+ tabs.times { print "\t" }
$stdout.flush
end
@@ -129,8 +129,8 @@ module Homebrew
end
write.close
while line = read.gets
- puts line if verbose
- @output += line
+ puts line if verbose
+ @output += line
end
ensure
read.close
@@ -143,7 +143,7 @@ module Homebrew
if has_output?
@output = fix_encoding(@output)
- puts @output if (failed? or @puts_output_on_success) && !verbose
+ puts @output if (failed? || @puts_output_on_success) && !verbose
File.write(log_file_path, @output) if ARGV.include? "--keep-logs"
end
@@ -174,7 +174,7 @@ module Homebrew
class Test
attr_reader :log_root, :category, :name, :steps
- def initialize argument, tap=nil
+ def initialize(argument, tap = nil)
@hash = nil
@url = nil
@formulae = []
@@ -208,7 +208,7 @@ module Homebrew
end
def no_args?
- @hash == 'HEAD'
+ @hash == "HEAD"
end
def git(*args)
@@ -231,23 +231,23 @@ module Homebrew
end
def download
- def shorten_revision revision
+ def shorten_revision(revision)
git("rev-parse", "--short", revision).strip
end
def current_sha1
- shorten_revision 'HEAD'
+ shorten_revision "HEAD"
end
def current_branch
git("symbolic-ref", "HEAD").gsub("refs/heads/", "").strip
end
- def single_commit? start_revision, end_revision
+ def single_commit?(start_revision, end_revision)
git("rev-list", "--count", "#{start_revision}..#{end_revision}").to_i == 1
end
- def diff_formulae start_revision, end_revision, path, filter
+ def diff_formulae(start_revision, end_revision, path, filter)
git(
"diff-tree", "-r", "--name-only", "--diff-filter=#{filter}",
start_revision, end_revision, "--", path
@@ -266,10 +266,10 @@ module Homebrew
@start_branch = current_branch
# Use Jenkins environment variables if present.
- if no_args? and ENV['GIT_PREVIOUS_COMMIT'] and ENV['GIT_COMMIT'] \
- and not ENV['ghprbPullLink']
- diff_start_sha1 = shorten_revision ENV['GIT_PREVIOUS_COMMIT']
- diff_end_sha1 = shorten_revision ENV['GIT_COMMIT']
+ if no_args? && ENV["GIT_PREVIOUS_COMMIT"] && ENV["GIT_COMMIT"] \
+ && !ENV["ghprbPullLink"]
+ diff_start_sha1 = shorten_revision ENV["GIT_PREVIOUS_COMMIT"]
+ diff_end_sha1 = shorten_revision ENV["GIT_COMMIT"]
brew_update
elsif @hash
diff_start_sha1 = current_sha1
@@ -280,14 +280,14 @@ module Homebrew
end
# Handle Jenkins pull request builder plugin.
- if ENV['ghprbPullLink']
- @url = ENV['ghprbPullLink']
+ if ENV["ghprbPullLink"]
+ @url = ENV["ghprbPullLink"]
@hash = nil
end
if no_args?
- if diff_start_sha1 == diff_end_sha1 or \
- single_commit?(diff_start_sha1, diff_end_sha1)
+ if diff_start_sha1 == diff_end_sha1 || \
+ single_commit?(diff_start_sha1, diff_end_sha1)
@name = diff_end_sha1
else
@name = "#{diff_start_sha1}-#{diff_end_sha1}"
@@ -302,8 +302,8 @@ module Homebrew
test "git", "checkout", diff_start_sha1
test "brew", "pull", "--clean", @url
diff_end_sha1 = current_sha1
- @short_url = @url.gsub('https://github.com/', '')
- if @short_url.include? '/commit/'
+ @short_url = @url.gsub("https://github.com/", "")
+ if @short_url.include? "/commit/"
# 7 characters should be enough for a commit (not 40).
@short_url.gsub!(/(commit\/\w{7}).*/, '\1')
@name = @short_url
@@ -319,7 +319,7 @@ module Homebrew
FileUtils.mkdir_p @log_root
return unless diff_start_sha1 != diff_end_sha1
- return if @url and not steps.last.passed?
+ return if @url && !steps.last.passed?
if @tap
formula_path = %w[Formula HomebrewFormula].find { |dir| (@repository/dir).directory? } || ""
@@ -332,11 +332,11 @@ module Homebrew
@formulae += @added_formulae + @modified_formula
end
- def skip formula_name
+ def skip(formula_name)
puts "#{Tty.blue}==>#{Tty.white} SKIPPING: #{formula_name}#{Tty.reset}"
end
- def satisfied_requirements? formula, spec, dependency=nil
+ def satisfied_requirements?(formula, spec, dependency = nil)
requirements = formula.send(spec).requirements
unsatisfied_requirements = requirements.reject do |requirement|
@@ -370,7 +370,7 @@ module Homebrew
test "brew", "config"
end
- def formula formula_name
+ def formula(formula_name)
@category = "#{__method__}.#{formula_name}"
canonical_formula_name = if @tap
@@ -384,7 +384,7 @@ module Homebrew
formula = Formulary.factory(canonical_formula_name)
formula.conflicts.map { |c| Formulary.factory(c.name) }.
- select { |f| f.installed? }.each do |conflict|
+ select(&:installed?).each do |conflict|
test "brew", "unlink", conflict.name
end
@@ -402,7 +402,7 @@ module Homebrew
return unless satisfied_requirements?(formula, :devel)
end
- if formula.devel && !ARGV.include?('--HEAD')
+ if formula.devel && !ARGV.include?("--HEAD")
deps |= formula.devel.deps.to_a
reqs |= formula.devel.requirements.to_a
end
@@ -448,8 +448,8 @@ module Homebrew
(installed & dependencies).each do |installed_dependency|
installed_dependency_formula = Formulary.factory(installed_dependency)
if installed_dependency_formula.installed? &&
- !installed_dependency_formula.keg_only? &&
- !installed_dependency_formula.linked_keg.exist?
+ !installed_dependency_formula.keg_only? &&
+ !installed_dependency_formula.linked_keg.exist?
test "brew", "link", installed_dependency
end
end
@@ -466,7 +466,7 @@ module Homebrew
dependents = Utils.popen_read("brew", "uses", "--skip-build", "--skip-optional", canonical_formula_name).split("\n")
dependents -= @formulae
- dependents = dependents.map {|d| Formulary.factory(d)}
+ dependents = dependents.map { |d| Formulary.factory(d) }
testable_dependents = dependents.select { |d| d.test_defined? && d.bottled? }
@@ -507,12 +507,12 @@ module Homebrew
audit_args << "--strict" << "--online" if @added_formulae.include? formula_name
test "brew", "audit", *audit_args
if install_passed
- if formula.stable? && !ARGV.include?('--no-bottle')
+ if formula.stable? && !ARGV.include?("--no-bottle")
bottle_args = ["--verbose", "--rb", canonical_formula_name]
bottle_args << { :puts_output_on_success => true }
test "brew", "bottle", *bottle_args
bottle_step = steps.last
- if bottle_step.passed? and bottle_step.has_output?
+ if bottle_step.passed? && bottle_step.has_output?
bottle_filename =
bottle_step.output.gsub(/.*(\.\/\S+#{bottle_native_regex}).*/m, '\1')
test "brew", "uninstall", "--force", canonical_formula_name
@@ -528,7 +528,7 @@ module Homebrew
unless dependent.installed?
test "brew", "fetch", "--retry", dependent.name
next if steps.last.failed?
- conflicts = dependent.conflicts.map { |c| Formulary.factory(c.name) }.select { |f| f.installed? }
+ conflicts = dependent.conflicts.map { |c| Formulary.factory(c.name) }.select(&:installed?)
conflicts.each do |conflict|
test "brew", "unlink", conflict.name
end
@@ -542,7 +542,7 @@ module Homebrew
test "brew", "uninstall", "--force", canonical_formula_name
end
- if formula.devel && formula.stable? && !ARGV.include?('--HEAD') \
+ if formula.devel && formula.stable? && !ARGV.include?("--HEAD") \
&& satisfied_requirements?(formula, :devel)
test "brew", "fetch", "--retry", "--devel", *formula_fetch_options
run_as_not_developer { test "brew", "install", "--devel", "--verbose", canonical_formula_name }
@@ -568,7 +568,7 @@ module Homebrew
def cleanup_before
@category = __method__
- return unless ARGV.include? '--cleanup'
+ return unless ARGV.include? "--cleanup"
git "stash"
git "am", "--abort"
git "rebase", "--abort"
@@ -576,25 +576,25 @@ module Homebrew
git "checkout", "-f", "master"
git "clean", "-ffdx"
pr_locks = "#{HOMEBREW_REPOSITORY}/.git/refs/remotes/*/pr/*/*.lock"
- Dir.glob(pr_locks) {|lock| FileUtils.rm_rf lock }
+ Dir.glob(pr_locks) { |lock| FileUtils.rm_rf lock }
end
def cleanup_after
@category = __method__
checkout_args = []
- if ARGV.include? '--cleanup'
+ if ARGV.include? "--cleanup"
test "git", "clean", "-ffdx"
checkout_args << "-f"
end
checkout_args << @start_branch
- if ARGV.include? '--cleanup' or @url or @hash
+ if ARGV.include?("--cleanup") || @url || @hash
test "git", "checkout", *checkout_args
end
- if ARGV.include? '--cleanup'
+ if ARGV.include? "--cleanup"
test "git", "reset", "--hard"
git "stash", "pop"
test "brew", "cleanup", "--prune=30"
@@ -635,7 +635,7 @@ module Homebrew
end
end
- changed_formulae = changed_formulae_dependents.sort do |a1,a2|
+ changed_formulae = changed_formulae_dependents.sort do |a1, a2|
a2[1].to_i <=> a1[1].to_i
end
changed_formulae.map!(&:first)
@@ -643,11 +643,11 @@ module Homebrew
changed_formulae + unchanged_formulae
end
- def head_only_tap? formula
+ def head_only_tap?(formula)
formula.head && formula.devel.nil? && formula.stable.nil? && formula.tap == "homebrew/homebrew-head-only"
end
- def devel_only_tap? formula
+ def devel_only_tap?(formula)
formula.devel && formula.stable.nil? && formula.tap == "homebrew/homebrew-devel-only"
end
@@ -665,17 +665,17 @@ module Homebrew
end
def test_bot
- tap = ARGV.value('tap')
+ tap = ARGV.value("tap")
- if !tap && ENV['UPSTREAM_BOT_PARAMS']
- bot_argv = ENV['UPSTREAM_BOT_PARAMS'].split " "
+ if !tap && ENV["UPSTREAM_BOT_PARAMS"]
+ bot_argv = ENV["UPSTREAM_BOT_PARAMS"].split " "
bot_argv.extend HomebrewArgvExtension
- tap ||= bot_argv.value('tap')
+ tap ||= bot_argv.value("tap")
end
tap.gsub!(/homebrew\/homebrew-/i, "Homebrew/") if tap
- git_url = ENV['UPSTREAM_GIT_URL'] || ENV['GIT_URL']
+ git_url = ENV["UPSTREAM_GIT_URL"] || ENV["GIT_URL"]
if !tap && git_url
# Also can get tap from Jenkins GIT_URL.
url_path = git_url.gsub(%r{^https?://github\.com/}, "").gsub(%r{/$}, "")
@@ -683,33 +683,33 @@ module Homebrew
tap = "#{$1}/#{$3}" if $1 && $3
end
- if Pathname.pwd == HOMEBREW_PREFIX and ARGV.include? "--cleanup"
- odie 'cannot use --cleanup from HOMEBREW_PREFIX as it will delete all output.'
+ if Pathname.pwd == HOMEBREW_PREFIX && ARGV.include?("--cleanup")
+ odie "cannot use --cleanup from HOMEBREW_PREFIX as it will delete all output."
end
if ARGV.include? "--email"
- File.open EMAIL_SUBJECT_FILE, 'w' do |file|
+ File.open EMAIL_SUBJECT_FILE, "w" do |file|
# The file should be written at the end but in case we don't get to that
# point ensure that we have something valid.
file.write "#{MacOS.version}: internal error."
end
end
- ENV['HOMEBREW_DEVELOPER'] = '1'
- ENV['HOMEBREW_NO_EMOJI'] = '1'
- if ARGV.include? '--ci-master' or ARGV.include? '--ci-pr' \
- or ARGV.include? '--ci-testing'
+ ENV["HOMEBREW_DEVELOPER"] = "1"
+ ENV["HOMEBREW_NO_EMOJI"] = "1"
+ if ARGV.include?("--ci-master") || ARGV.include?("--ci-pr") \
+ || ARGV.include?("--ci-testing")
ARGV << "--cleanup" if ENV["JENKINS_HOME"] || ENV["TRAVIS_COMMIT"]
ARGV << "--junit" << "--local"
end
- if ARGV.include? '--ci-master'
- ARGV << '--no-bottle' << '--email'
+ if ARGV.include? "--ci-master"
+ ARGV << "--no-bottle" << "--email"
end
- if ARGV.include? '--local'
- ENV['HOME'] = "#{Dir.pwd}/home"
- mkdir_p ENV['HOME']
- ENV['HOMEBREW_LOGS'] = "#{Dir.pwd}/logs"
+ if ARGV.include? "--local"
+ ENV["HOME"] = "#{Dir.pwd}/home"
+ mkdir_p ENV["HOME"]
+ ENV["HOMEBREW_LOGS"] = "#{Dir.pwd}/logs"
end
if ARGV.include? "--ci-reset-and-update"
@@ -733,10 +733,10 @@ module Homebrew
safe_system "brew", "tap", tap
end
- if ARGV.include? '--ci-upload'
- jenkins = ENV['JENKINS_HOME']
- job = ENV['UPSTREAM_JOB_NAME']
- id = ENV['UPSTREAM_BUILD_ID']
+ if ARGV.include? "--ci-upload"
+ jenkins = ENV["JENKINS_HOME"]
+ job = ENV["UPSTREAM_JOB_NAME"]
+ id = ENV["UPSTREAM_BUILD_ID"]
raise "Missing Jenkins variables!" if !jenkins || !job || !id
bintray_user = ENV["BINTRAY_USER"]
@@ -751,7 +751,7 @@ module Homebrew
ENV["JENKINS_SERVER_COOKIE"] = nil
ENV["HUDSON_COOKIE"] = nil
- ARGV << '--verbose'
+ ARGV << "--verbose"
bottles = Dir["#{jenkins}/jobs/#{job}/configurations/axis-version/*/builds/#{id}/archive/*.bottle*.*"]
return if bottles.empty?
@@ -762,8 +762,8 @@ module Homebrew
ENV["GIT_WORK_TREE"] = repository
ENV["GIT_DIR"] = "#{ENV["GIT_WORK_TREE"]}/.git"
- pr = ENV['UPSTREAM_PULL_REQUEST']
- number = ENV['UPSTREAM_BUILD_NUMBER']
+ pr = ENV["UPSTREAM_PULL_REQUEST"]
+ number = ENV["UPSTREAM_BUILD_NUMBER"]
system "git am --abort 2>/dev/null"
system "git rebase --abort 2>/dev/null"
@@ -839,7 +839,7 @@ module Homebrew
any_errors = false
if ARGV.named.empty?
# With no arguments just build the most recent commit.
- head_test = Test.new('HEAD', tap)
+ head_test = Test.new("HEAD", tap)
any_errors = !head_test.run
tests << head_test
else
@@ -913,12 +913,12 @@ module Homebrew
end
if failed_steps.empty?
- email_subject = ''
+ email_subject = ""
else
- email_subject = "#{MacOS.version}: #{failed_steps.join ', '}."
+ email_subject = "#{MacOS.version}: #{failed_steps.join ", "}."
end
- File.open EMAIL_SUBJECT_FILE, 'w' do |file|
+ File.open EMAIL_SUBJECT_FILE, "w" do |file|
file.write email_subject
end
end
diff --git a/Library/Homebrew/cmd/test.rb b/Library/Homebrew/cmd/test.rb
index 7c3641426..fd3c7c4e6 100644
--- a/Library/Homebrew/cmd/test.rb
+++ b/Library/Homebrew/cmd/test.rb
@@ -4,7 +4,6 @@ require "sandbox"
require "timeout"
module Homebrew
-
def test
raise FormulaUnspecifiedError if ARGV.named.empty?
diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb
index 22cafd9dd..ab2938c75 100644
--- a/Library/Homebrew/cmd/uninstall.rb
+++ b/Library/Homebrew/cmd/uninstall.rb
@@ -1,11 +1,11 @@
-require 'keg'
-require 'formula'
+require "keg"
+require "formula"
module Homebrew
def uninstall
raise KegUnspecifiedError if ARGV.named.empty?
- if not ARGV.force?
+ if !ARGV.force?
ARGV.kegs.each do |keg|
keg.lock do
puts "Uninstalling #{keg}... (#{keg.abv})"
@@ -43,7 +43,7 @@ module Homebrew
puts "Use `brew remove --force #{e.name}` to remove all versions."
end
- def rm_pin rack
+ def rm_pin(rack)
Formulary.from_rack(rack).unpin rescue nil
end
end
diff --git a/Library/Homebrew/cmd/unlinkapps.rb b/Library/Homebrew/cmd/unlinkapps.rb
index ef11db602..2674b2854 100644
--- a/Library/Homebrew/cmd/unlinkapps.rb
+++ b/Library/Homebrew/cmd/unlinkapps.rb
@@ -1,5 +1,5 @@
# Unlinks any Applications (.app) found in installed prefixes from /Applications
-require 'keg'
+require "keg"
module Homebrew
def unlinkapps
@@ -23,7 +23,7 @@ module Homebrew
private
- def should_unlink? file
+ def should_unlink?(file)
if ARGV.named.empty?
file.match(HOMEBREW_CELLAR) || file.match("#{HOMEBREW_PREFIX}/opt")
else
diff --git a/Library/Homebrew/cmd/unpack.rb b/Library/Homebrew/cmd/unpack.rb
index 2eed6b4a4..3a0630d6a 100644
--- a/Library/Homebrew/cmd/unpack.rb
+++ b/Library/Homebrew/cmd/unpack.rb
@@ -25,12 +25,12 @@ module Homebrew
oh1 "Unpacking #{f.full_name} to: #{stage_dir}"
- ENV['VERBOSE'] = '1' # show messages about tar
+ ENV["VERBOSE"] = "1" # show messages about tar
f.brew do
f.patch if ARGV.flag?("--patch")
cp_r getwd, stage_dir
end
- ENV['VERBOSE'] = nil
+ ENV["VERBOSE"] = nil
if ARGV.git?
ohai "Setting up git repository"
diff --git a/Library/Homebrew/cmd/unpin.rb b/Library/Homebrew/cmd/unpin.rb
index 0738f5869..3b66da03a 100644
--- a/Library/Homebrew/cmd/unpin.rb
+++ b/Library/Homebrew/cmd/unpin.rb
@@ -1,4 +1,4 @@
-require 'formula'
+require "formula"
module Homebrew
def unpin
diff --git a/Library/Homebrew/cmd/untap.rb b/Library/Homebrew/cmd/untap.rb
index f1040bb05..793ad299d 100644
--- a/Library/Homebrew/cmd/untap.rb
+++ b/Library/Homebrew/cmd/untap.rb
@@ -1,4 +1,4 @@
-require 'cmd/tap' # for tap_args
+require "cmd/tap" # for tap_args
module Homebrew
def untap
@@ -13,7 +13,7 @@ module Homebrew
formula_count = tap.formula_files.size
tap.path.rmtree
tap.path.dirname.rmdir_if_possible
- puts "Untapped #{formula_count} formula#{plural(formula_count, 'e')}"
+ puts "Untapped #{formula_count} formula#{plural(formula_count, "e")}"
end
end
end
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb
index 189a911db..e50443fad 100644
--- a/Library/Homebrew/cmd/update.rb
+++ b/Library/Homebrew/cmd/update.rb
@@ -1,4 +1,4 @@
-require 'cmd/tap'
+require "cmd/tap"
module Homebrew
def update
@@ -10,7 +10,7 @@ module Homebrew
end
# ensure GIT_CONFIG is unset as we need to operate on .git/config
- ENV.delete('GIT_CONFIG')
+ ENV.delete("GIT_CONFIG")
cd HOMEBREW_REPOSITORY
git_init_if_necessary
@@ -36,7 +36,7 @@ module Homebrew
rescue
onoe "Failed to update tap: #{tap}"
else
- report.update(updater.report) do |key, oldval, newval|
+ report.update(updater.report) do |_key, oldval, newval|
oldval.concat(newval)
end
end
@@ -48,14 +48,14 @@ module Homebrew
next unless (HOMEBREW_CELLAR/f).exist?
migration = TAP_MIGRATIONS[f]
next unless migration
- tap_user, tap_repo = migration.split '/'
+ tap_user, tap_repo = migration.split "/"
install_tap tap_user, tap_repo
end if load_tap_migrations
if report.empty?
puts "Already up-to-date."
else
- puts "Updated Homebrew from #{master_updater.initial_revision[0,8]} to #{master_updater.current_revision[0,8]}."
+ puts "Updated Homebrew from #{master_updater.initial_revision[0, 8]} to #{master_updater.current_revision[0, 8]}."
report.dump
end
end
@@ -111,7 +111,7 @@ module Homebrew
end
def load_tap_migrations
- require 'tap_migrations'
+ require "tap_migrations"
rescue LoadError
false
end
@@ -125,7 +125,7 @@ class Updater
@stashed = false
end
- def pull!(options={})
+ def pull!(options = {})
quiet = []
quiet << "--quiet" unless ARGV.verbose?
@@ -184,12 +184,13 @@ class Updater
end
def report
- map = Hash.new{ |h,k| h[k] = [] }
+ map = Hash.new { |h, k| h[k] = [] }
if initial_revision && initial_revision != current_revision
diff.each_line do |line|
status, *paths = line.split
- src, dst = paths.first, paths.last
+ src = paths.first
+ dst = paths.last
next unless File.extname(dst) == ".rb"
next unless paths.any? { |p| File.dirname(p) == formula_directory }
@@ -255,7 +256,6 @@ class Updater
end
end
-
class Report
def initialize
@hash = {}
@@ -281,7 +281,7 @@ class Report
dump_formula_report :D, "Deleted Formulae"
end
- def select_formula key
+ def select_formula(key)
fetch(key, []).map do |path|
case path.to_s
when HOMEBREW_TAP_PATH_REGEX
@@ -292,7 +292,7 @@ class Report
end.sort
end
- def dump_formula_report key, title
+ def dump_formula_report(key, title)
formula = select_formula(key)
unless formula.empty?
ohai title
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index 3c90c0c95..8ae231002 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -1,5 +1,5 @@
-require 'cmd/install'
-require 'cmd/outdated'
+require "cmd/install"
+require "cmd/outdated"
module Homebrew
def upgrade
@@ -29,24 +29,24 @@ module Homebrew
unless outdated.empty?
oh1 "Upgrading #{outdated.length} outdated package#{plural(outdated.length)}, with result:"
- puts outdated.map{ |f| "#{f.full_name} #{f.pkg_version}" } * ", "
+ puts outdated.map { |f| "#{f.full_name} #{f.pkg_version}" } * ", "
else
oh1 "No packages to upgrade"
end
unless upgrade_pinned? || pinned.empty?
oh1 "Not upgrading #{pinned.length} pinned package#{plural(pinned.length)}:"
- puts pinned.map{ |f| "#{f.full_name} #{f.pkg_version}" } * ", "
+ puts pinned.map { |f| "#{f.full_name} #{f.pkg_version}" } * ", "
end
outdated.each { |f| upgrade_formula(f) }
end
def upgrade_pinned?
- not ARGV.named.empty?
+ !ARGV.named.empty?
end
- def upgrade_formula f
+ def upgrade_formula(f)
outdated_keg = Keg.new(f.linked_keg.resolved_path) if f.linked_keg.directory?
tab = Tab.for_formula(f)
@@ -89,7 +89,6 @@ module Homebrew
ofail e
ensure
# restore previous installation state if build failed
- outdated_keg.link if outdated_keg and not f.installed? rescue nil
+ outdated_keg.link if outdated_keg && !f.installed? rescue nil
end
-
end
diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb
index 8738db894..28abcf28e 100644
--- a/Library/Homebrew/cmd/uses.rb
+++ b/Library/Homebrew/cmd/uses.rb
@@ -1,4 +1,4 @@
-require 'formula'
+require "formula"
# `brew uses foo bar` returns formulae that use both foo and bar
# If you want the union, run the command twice and concatenate the results.
@@ -26,7 +26,7 @@ module Homebrew
Requirement.prune if ignores.any? { |ignore| req.send(ignore) } && !dependent.build.with?(req)
end
deps.any? { |dep| dep.to_formula.full_name == ff.full_name rescue dep.name == ff.name } ||
- reqs.any? { |req| req.name == ff.name || [ff.name, ff.full_name].include?(req.default_formula) }
+ reqs.any? { |req| req.name == ff.name || [ff.name, ff.full_name].include?(req.default_formula) }
else
deps = f.deps.reject do |dep|
ignores.any? { |ignore| dep.send(ignore) }
@@ -35,7 +35,7 @@ module Homebrew
ignores.any? { |ignore| req.send(ignore) }
end
deps.any? { |dep| dep.to_formula.full_name == ff.full_name rescue dep.name == ff.name } ||
- reqs.any? { |req| req.name == ff.name || [ff.name, ff.full_name].include?(req.default_formula) }
+ reqs.any? { |req| req.name == ff.name || [ff.name, ff.full_name].include?(req.default_formula) }
end
rescue FormulaUnavailableError
# Silently ignore this case as we don't care about things used in