Re-revert "Fix operator spacing."

This commit is contained in:
Markus Reiter 2017-06-01 16:06:51 +02:00
parent 0731a68cde
commit 2d6ae61314
36 changed files with 124 additions and 120 deletions

View File

@ -1,8 +1,6 @@
AllCops: AllCops:
TargetRubyVersion: 2.0 TargetRubyVersion: 2.0
Exclude: Exclude:
- '**/Rakefile'
- '**/.*'
- '**/Casks/**/*' - '**/Casks/**/*'
- '**/vendor/**/*' - '**/vendor/**/*'

View File

@ -59,10 +59,10 @@ begin
ENV["PATH"] = path ENV["PATH"] = path
if cmd if cmd
internal_cmd = require? HOMEBREW_LIBRARY_PATH.join("cmd", cmd) internal_cmd = require? HOMEBREW_LIBRARY_PATH/"cmd"/cmd
unless internal_cmd unless internal_cmd
internal_cmd = require? HOMEBREW_LIBRARY_PATH.join("dev-cmd", cmd) internal_cmd = require? HOMEBREW_LIBRARY_PATH/"dev-cmd"/cmd
if internal_cmd && !ARGV.homebrew_developer? if internal_cmd && !ARGV.homebrew_developer?
system "git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config", system "git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config",
"--replace-all", "homebrew.devcmdrun", "true" "--replace-all", "homebrew.devcmdrun", "true"

View File

@ -43,7 +43,7 @@ module Hbc
if checkpoint.nil? if checkpoint.nil?
onoe "Could not retrieve `appcast` checkpoint for cask '#{cask}': #{result[:command_result].stderr}" onoe "Could not retrieve `appcast` checkpoint for cask '#{cask}': #{result[:command_result].stderr}"
else else
puts((cask_tokens.count > 1) ? "#{checkpoint} #{cask}": checkpoint) puts((cask_tokens.count > 1) ? "#{checkpoint} #{cask}" : checkpoint)
count += 1 count += 1
end end
end end

View File

@ -216,7 +216,7 @@ module Hbc
end end
def repo_valid? def repo_valid?
@clone.join(".svn").directory? (@clone/".svn").directory?
end end
def repo_url def repo_url

View File

@ -129,7 +129,7 @@ module Homebrew
names.each do |d| names.each do |d|
versions = d.subdirs.map { |pn| pn.basename.to_s } versions = d.subdirs.map { |pn| pn.basename.to_s }
next if ARGV.include?("--multiple") && versions.length < 2 next if ARGV.include?("--multiple") && versions.length < 2
puts "#{d.basename} #{versions*" "}" puts "#{d.basename} #{versions * " "}"
end end
end end
end end

View File

@ -114,7 +114,7 @@ module Homebrew
def search_formulae(regex) def search_formulae(regex)
aliases = Formula.alias_full_names aliases = Formula.alias_full_names
results = (Formula.full_names+aliases).grep(regex).sort results = (Formula.full_names + aliases).grep(regex).sort
results.map do |name| results.map do |name|
begin begin

View File

@ -25,7 +25,7 @@ module Homebrew
end end
# Does the target version exist? # Does the target version exist?
unless (rack+version).directory? unless (rack/version).directory?
onoe "#{name} does not have a version \"#{version}\" in the Cellar." onoe "#{name} does not have a version \"#{version}\" in the Cellar."
versions = rack.subdirs.map { |d| Keg.new(d).version } versions = rack.subdirs.map { |d| Keg.new(d).version }
@ -41,7 +41,7 @@ module Homebrew
keg.unlink keg.unlink
end end
keg = Keg.new(rack+version) keg = Keg.new(rack/version)
# Link new version, if not keg-only # Link new version, if not keg-only
if keg_only?(rack) if keg_only?(rack)

View File

@ -29,7 +29,7 @@ module Homebrew
raise "Cannot write to #{unpack_dir}" unless unpack_dir.writable_real? raise "Cannot write to #{unpack_dir}" unless unpack_dir.writable_real?
formulae.each do |f| formulae.each do |f|
stage_dir = unpack_dir.join("#{f.name}-#{f.version}") stage_dir = unpack_dir/"#{f.name}-#{f.version}"
if stage_dir.exist? if stage_dir.exist?
raise "Destination #{stage_dir} already exists!" unless ARGV.force? raise "Destination #{stage_dir} already exists!" unless ARGV.force?

View File

@ -50,7 +50,7 @@ module Debrew
choice = nil choice = nil
while choice.nil? while choice.nil?
menu.entries.each_with_index { |e, i| puts "#{i+1}. #{e.name}" } menu.entries.each_with_index { |e, i| puts "#{i + 1}. #{e.name}" }
print menu.prompt unless menu.prompt.nil? print menu.prompt unless menu.prompt.nil?
input = $stdin.gets || exit input = $stdin.gets || exit
@ -58,7 +58,7 @@ module Debrew
i = input.to_i i = input.to_i
if i > 0 if i > 0
choice = menu.entries[i-1] choice = menu.entries[i - 1]
else else
possible = menu.entries.find_all { |e| e.name.start_with?(input) } possible = menu.entries.find_all { |e| e.name.start_with?(input) }

View File

@ -868,7 +868,7 @@ class FormulaAuditor
def audit_lines def audit_lines
text.without_patch.split("\n").each_with_index do |line, lineno| text.without_patch.split("\n").each_with_index do |line, lineno|
line_problems(line, lineno+1) line_problems(line, lineno + 1)
end end
end end

View File

@ -248,7 +248,7 @@ module Homebrew
mv "#{relocatable_tar_path}.gz", bottle_path mv "#{relocatable_tar_path}.gz", bottle_path
end end
if bottle_path.size > 1*1024*1024 if bottle_path.size > 1 * 1024 * 1024
ohai "Detecting if #{filename} is relocatable..." ohai "Detecting if #{filename} is relocatable..."
end end

View File

@ -24,9 +24,9 @@ module Homebrew
if ["mate", "subl"].include?(editor) if ["mate", "subl"].include?(editor)
# If the user is using TextMate or Sublime Text, # If the user is using TextMate or Sublime Text,
# give a nice project view instead. # give a nice project view instead.
exec_editor HOMEBREW_REPOSITORY+"bin/brew", exec_editor HOMEBREW_REPOSITORY/"bin/brew",
HOMEBREW_REPOSITORY+"README.md", HOMEBREW_REPOSITORY/"README.md",
HOMEBREW_REPOSITORY+".gitignore", HOMEBREW_REPOSITORY/".gitignore",
*library_folders *library_folders
else else
exec_editor HOMEBREW_REPOSITORY exec_editor HOMEBREW_REPOSITORY

View File

@ -50,8 +50,8 @@ class DevelopmentTools
def gcc_4_2_build_version def gcc_4_2_build_version
@gcc_4_2_build_version ||= begin @gcc_4_2_build_version ||= begin
gcc = locate("gcc-4.2") || HOMEBREW_PREFIX.join("opt/apple-gcc42/bin/gcc-4.2") gcc = locate("gcc-4.2") || HOMEBREW_PREFIX/"opt/apple-gcc42/bin/gcc-4.2"
if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm")&& if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm") &&
build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1] build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
Version.new build_version Version.new build_version
else else
@ -96,7 +96,7 @@ class DevelopmentTools
def non_apple_gcc_version(cc) def non_apple_gcc_version(cc)
(@non_apple_gcc_version ||= {}).fetch(cc) do (@non_apple_gcc_version ||= {}).fetch(cc) do
path = HOMEBREW_PREFIX.join("opt", "gcc", "bin", cc) path = HOMEBREW_PREFIX/"opt/gcc/bin"/cc
path = locate(cc) unless path.exist? path = locate(cc) unless path.exist?
version = if path && version = if path &&
build_version = `#{path} --version`[/gcc(?:-\d(?:\.\d)? \(.+\))? (\d\.\d\.\d)/, 1] build_version = `#{path} --version`[/gcc(?:-\d(?:\.\d)? \(.+\))? (\d\.\d\.\d)/, 1]

View File

@ -158,7 +158,7 @@ module Homebrew
"libosxfuse_i32.2.dylib", # OSXFuse "libosxfuse_i32.2.dylib", # OSXFuse
"libosxfuse_i64.2.dylib", # OSXFuse "libosxfuse_i64.2.dylib", # OSXFuse
"libosxfuse.2.dylib", # OSXFuse "libosxfuse.2.dylib", # OSXFuse
"libTrAPI.dylib", # TrAPI / Endpoint Security VPN "libTrAPI.dylib", # TrAPI/Endpoint Security VPN
"libntfs-3g.*.dylib", # NTFS-3G "libntfs-3g.*.dylib", # NTFS-3G
"libntfs.*.dylib", # NTFS-3G "libntfs.*.dylib", # NTFS-3G
"libublio.*.dylib", # NTFS-3G "libublio.*.dylib", # NTFS-3G
@ -470,7 +470,7 @@ module Homebrew
return if $seen_prefix_sbin return if $seen_prefix_sbin
# Don't complain about sbin not being in the path if it doesn't exist # Don't complain about sbin not being in the path if it doesn't exist
sbin = (HOMEBREW_PREFIX+"sbin") sbin = HOMEBREW_PREFIX/"sbin"
return unless sbin.directory? && !sbin.children.empty? return unless sbin.directory? && !sbin.children.empty?
<<-EOS.undent <<-EOS.undent

View File

@ -139,7 +139,7 @@ class VCSDownloadStrategy < AbstractDownloadStrategy
super super
@ref_type, @ref = extract_ref(meta) @ref_type, @ref = extract_ref(meta)
@revision = meta[:revision] @revision = meta[:revision]
@clone = HOMEBREW_CACHE.join(cache_filename) @clone = HOMEBREW_CACHE/cache_filename
end end
def fetch def fetch
@ -322,7 +322,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
def initialize(name, resource) def initialize(name, resource)
super super
@mirrors = resource.mirrors.dup @mirrors = resource.mirrors.dup
@tarball_path = HOMEBREW_CACHE.join("#{name}-#{version}#{ext}") @tarball_path = HOMEBREW_CACHE/"#{name}-#{version}#{ext}"
@temporary_path = Pathname.new("#{cached_location}.incomplete") @temporary_path = Pathname.new("#{cached_location}.incomplete")
end end
@ -698,7 +698,7 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
end end
def repo_valid? def repo_valid?
cached_location.join(".svn").directory? (cached_location/".svn").directory?
end end
def clone_repo def clone_repo
@ -711,7 +711,7 @@ class SubversionDownloadStrategy < VCSDownloadStrategy
fetch_repo cached_location, @url, main_revision, true fetch_repo cached_location, @url, main_revision, true
externals do |external_name, external_url| externals do |external_name, external_url|
fetch_repo cached_location+external_name, external_url, @ref[external_name], true fetch_repo cached_location/external_name, external_url, @ref[external_name], true
end end
else else
fetch_repo cached_location, @url fetch_repo cached_location, @url
@ -773,7 +773,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
end end
def shallow_dir? def shallow_dir?
git_dir.join("shallow").exist? (git_dir/"shallow").exist?
end end
def support_depth? def support_depth?
@ -781,7 +781,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
end end
def git_dir def git_dir
cached_location.join(".git") cached_location/".git"
end end
def ref? def ref?
@ -797,7 +797,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
end end
def submodules? def submodules?
cached_location.join(".gitmodules").exist? (cached_location/".gitmodules").exist?
end end
def clone_args def clone_args
@ -987,7 +987,7 @@ class CVSDownloadStrategy < VCSDownloadStrategy
end end
def repo_valid? def repo_valid?
cached_location.join("CVS").directory? (cached_location/"CVS").directory?
end end
def clone_repo def clone_repo
@ -1004,8 +1004,8 @@ class CVSDownloadStrategy < VCSDownloadStrategy
def split_url(in_url) def split_url(in_url)
parts = in_url.split(/:/) parts = in_url.split(/:/)
mod=parts.pop mod = parts.pop
url=parts.join(":") url = parts.join(":")
[mod, url] [mod, url]
end end
end end
@ -1045,7 +1045,7 @@ class MercurialDownloadStrategy < VCSDownloadStrategy
end end
def repo_valid? def repo_valid?
cached_location.join(".hg").directory? (cached_location/".hg").directory?
end end
def clone_repo def clone_repo
@ -1085,7 +1085,7 @@ class BazaarDownloadStrategy < VCSDownloadStrategy
end end
def repo_valid? def repo_valid?
cached_location.join(".bzr").directory? (cached_location/".bzr").directory?
end end
def clone_repo def clone_repo

View File

@ -328,7 +328,7 @@ class FormulaConflictError < RuntimeError
message << "Cannot install #{formula.full_name} because conflicting formulae are installed." message << "Cannot install #{formula.full_name} because conflicting formulae are installed."
message.concat conflicts.map { |c| conflict_message(c) } << "" message.concat conflicts.map { |c| conflict_message(c) } << ""
message << <<-EOS.undent message << <<-EOS.undent
Please `brew unlink #{conflicts.map(&:name)*" "}` before continuing. Please `brew unlink #{conflicts.map(&:name) * " "}` before continuing.
Unlinking removes a formula's symlinks from #{HOMEBREW_PREFIX}. You can Unlinking removes a formula's symlinks from #{HOMEBREW_PREFIX}. You can
link the formula again after the install finishes. You can --force this link the formula again after the install finishes. You can --force this

View File

@ -138,7 +138,7 @@ module HomebrewArgvExtension
end end
def next def next
at(@n+1) || raise(UsageError) at(@n + 1) || raise(UsageError)
end end
def value(name) def value(name)

View File

@ -98,7 +98,7 @@ module Stdenv
# @private # @private
def determine_cxx def determine_cxx
dir, base = determine_cc.split dir, base = determine_cc.split
dir / base.to_s.sub("gcc", "g++").sub("clang", "clang++") dir/base.to_s.sub("gcc", "g++").sub("clang", "clang++")
end end
def gcc_4_0 def gcc_4_0

View File

@ -7,7 +7,7 @@ module Stdenv
# Mountain Lion's sed is stricter, and errors out when # Mountain Lion's sed is stricter, and errors out when
# it encounters files with mixed character sets # it encounters files with mixed character sets
delete("LC_ALL") delete("LC_ALL")
self["LC_CTYPE"]="C" self["LC_CTYPE"] = "C"
end end
# Add lib and include etc. from the current macosxsdk to compiler flags: # Add lib and include etc. from the current macosxsdk to compiler flags:

View File

@ -89,7 +89,7 @@ class Keg
# the basename of the file itself. # the basename of the file itself.
basename = File.basename(file.dylib_id) basename = File.basename(file.dylib_id)
relative_dirname = file.dirname.relative_path_from(path) relative_dirname = file.dirname.relative_path_from(path)
opt_record.join(relative_dirname, basename).to_s (opt_record/relative_dirname/basename).to_s
end end
# Matches framework references like `XXX.framework/Versions/YYY/XXX` and # Matches framework references like `XXX.framework/Versions/YYY/XXX` and

View File

@ -246,7 +246,7 @@ class Pathname
rmdir rmdir
true true
rescue Errno::ENOTEMPTY rescue Errno::ENOTEMPTY
if (ds_store = self+".DS_Store").exist? && children.length == 1 if (ds_store = join(".DS_Store")).exist? && children.length == 1
ds_store.unlink ds_store.unlink
retry retry
else else
@ -343,7 +343,7 @@ class Pathname
# @private # @private
def resolved_path def resolved_path
symlink? ? dirname+readlink : self symlink? ? dirname.join(readlink) : self
end end
# @private # @private
@ -353,7 +353,7 @@ class Pathname
# The link target contains NUL bytes # The link target contains NUL bytes
false false
else else
(dirname+link).exist? dirname.join(link).exist?
end end
# @private # @private
@ -367,7 +367,7 @@ class Pathname
if !other.respond_to?(:to_str) && !other.respond_to?(:to_path) if !other.respond_to?(:to_str) && !other.respond_to?(:to_path)
odeprecated "Pathname#/ with #{other.class}", "a String or a Pathname" odeprecated "Pathname#/ with #{other.class}", "a String or a Pathname"
end end
self + other.to_s join(other.to_s)
end end
end end
@ -403,7 +403,7 @@ class Pathname
mkpath mkpath
targets.each do |target| targets.each do |target|
target = Pathname.new(target) # allow pathnames or strings target = Pathname.new(target) # allow pathnames or strings
(self+target.basename).write <<-EOS.undent join(target.basename).write <<-EOS.undent
#!/bin/bash #!/bin/bash
exec "#{target}" "$@" exec "#{target}" "$@"
EOS EOS
@ -427,7 +427,7 @@ class Pathname
Pathname.glob("#{self}/*") do |file| Pathname.glob("#{self}/*") do |file|
next if file.directory? next if file.directory?
dst.install(file) dst.install(file)
new_file = dst+file.basename new_file = dst.join(file.basename)
file.write_env_script(new_file, env) file.write_env_script(new_file, env)
end end
end end
@ -435,7 +435,7 @@ class Pathname
# Writes an exec script that invokes a java jar # Writes an exec script that invokes a java jar
def write_jar_script(target_jar, script_name, java_opts = "") def write_jar_script(target_jar, script_name, java_opts = "")
mkpath mkpath
(self+script_name).write <<-EOS.undent join(script_name).write <<-EOS.undent
#!/bin/bash #!/bin/bash
exec java #{java_opts} -jar #{target_jar} "$@" exec java #{java_opts} -jar #{target_jar} "$@"
EOS EOS

View File

@ -621,14 +621,14 @@ class Formula
# No `make install` available? # No `make install` available?
# <pre>bin.install "binary1"</pre> # <pre>bin.install "binary1"</pre>
def bin def bin
prefix+"bin" prefix/"bin"
end end
# The directory where the formula's documentation should be installed. # The directory where the formula's documentation should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def doc def doc
share+"doc"+name share/"doc"/name
end end
# The directory where the formula's headers should be installed. # The directory where the formula's headers should be installed.
@ -638,14 +638,14 @@ class Formula
# No `make install` available? # No `make install` available?
# <pre>include.install "example.h"</pre> # <pre>include.install "example.h"</pre>
def include def include
prefix+"include" prefix/"include"
end end
# The directory where the formula's info files should be installed. # The directory where the formula's info files should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def info def info
share+"info" share/"info"
end end
# The directory where the formula's libraries should be installed. # The directory where the formula's libraries should be installed.
@ -655,7 +655,7 @@ class Formula
# No `make install` available? # No `make install` available?
# <pre>lib.install "example.dylib"</pre> # <pre>lib.install "example.dylib"</pre>
def lib def lib
prefix+"lib" prefix/"lib"
end end
# The directory where the formula's binaries should be installed. # The directory where the formula's binaries should be installed.
@ -664,7 +664,7 @@ class Formula
# symlinked into HOMEBREW_PREFIX from one of the other directories and # symlinked into HOMEBREW_PREFIX from one of the other directories and
# instead manually create symlinks or wrapper scripts into e.g. {#bin}. # instead manually create symlinks or wrapper scripts into e.g. {#bin}.
def libexec def libexec
prefix+"libexec" prefix/"libexec"
end end
# The root directory where the formula's manual pages should be installed. # The root directory where the formula's manual pages should be installed.
@ -673,7 +673,7 @@ class Formula
# Often one of the more specific `man` functions should be used instead # Often one of the more specific `man` functions should be used instead
# e.g. {#man1} # e.g. {#man1}
def man def man
share+"man" share/"man"
end end
# The directory where the formula's man1 pages should be installed. # The directory where the formula's man1 pages should be installed.
@ -683,14 +683,14 @@ class Formula
# No `make install` available? # No `make install` available?
# <pre>man1.install "example.1"</pre> # <pre>man1.install "example.1"</pre>
def man1 def man1
man+"man1" man/"man1"
end end
# The directory where the formula's man2 pages should be installed. # The directory where the formula's man2 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def man2 def man2
man+"man2" man/"man2"
end end
# The directory where the formula's man3 pages should be installed. # The directory where the formula's man3 pages should be installed.
@ -700,42 +700,42 @@ class Formula
# No `make install` available? # No `make install` available?
# <pre>man3.install "man.3"</pre> # <pre>man3.install "man.3"</pre>
def man3 def man3
man+"man3" man/"man3"
end end
# The directory where the formula's man4 pages should be installed. # The directory where the formula's man4 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def man4 def man4
man+"man4" man/"man4"
end end
# The directory where the formula's man5 pages should be installed. # The directory where the formula's man5 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def man5 def man5
man+"man5" man/"man5"
end end
# The directory where the formula's man6 pages should be installed. # The directory where the formula's man6 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def man6 def man6
man+"man6" man/"man6"
end end
# The directory where the formula's man7 pages should be installed. # The directory where the formula's man7 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def man7 def man7
man+"man7" man/"man7"
end end
# The directory where the formula's man8 pages should be installed. # The directory where the formula's man8 pages should be installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def man8 def man8
man+"man8" man/"man8"
end end
# The directory where the formula's `sbin` binaries should be installed. # The directory where the formula's `sbin` binaries should be installed.
@ -743,7 +743,7 @@ class Formula
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
# Generally we try to migrate these to {#bin} instead. # Generally we try to migrate these to {#bin} instead.
def sbin def sbin
prefix+"sbin" prefix/"sbin"
end end
# The directory where the formula's shared files should be installed. # The directory where the formula's shared files should be installed.
@ -762,7 +762,7 @@ class Formula
# Install `./example_code/simple/ones` to share/demos/examples # Install `./example_code/simple/ones` to share/demos/examples
# <pre>(share/"demos").install "example_code/simple/ones" => "examples"</pre> # <pre>(share/"demos").install "example_code/simple/ones" => "examples"</pre>
def share def share
prefix+"share" prefix/"share"
end end
# The directory where the formula's shared files should be installed, # The directory where the formula's shared files should be installed,
@ -773,7 +773,7 @@ class Formula
# No `make install` available? # No `make install` available?
# <pre>pkgshare.install "examples"</pre> # <pre>pkgshare.install "examples"</pre>
def pkgshare def pkgshare
prefix+"share"+name prefix/"share"/name
end end
# The directory where Emacs Lisp files should be installed, with the # The directory where Emacs Lisp files should be installed, with the
@ -782,7 +782,7 @@ class Formula
# Install an Emacs mode included with a software package: # Install an Emacs mode included with a software package:
# <pre>elisp.install "contrib/emacs/example-mode.el"</pre> # <pre>elisp.install "contrib/emacs/example-mode.el"</pre>
def elisp def elisp
prefix+"share/emacs/site-lisp"+name prefix/"share/emacs/site-lisp"/name
end end
# The directory where the formula's Frameworks should be installed. # The directory where the formula's Frameworks should be installed.
@ -790,7 +790,7 @@ class Formula
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
# This is not symlinked into `HOMEBREW_PREFIX`. # This is not symlinked into `HOMEBREW_PREFIX`.
def frameworks def frameworks
prefix+"Frameworks" prefix/"Frameworks"
end end
# The directory where the formula's kernel extensions should be installed. # The directory where the formula's kernel extensions should be installed.
@ -798,7 +798,7 @@ class Formula
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
# This is not symlinked into `HOMEBREW_PREFIX`. # This is not symlinked into `HOMEBREW_PREFIX`.
def kext_prefix def kext_prefix
prefix+"Library/Extensions" prefix/"Library/Extensions"
end end
# The directory where the formula's configuration files should be installed. # The directory where the formula's configuration files should be installed.
@ -807,14 +807,14 @@ class Formula
# This directory is not inside the `HOMEBREW_CELLAR` so it is persisted # This directory is not inside the `HOMEBREW_CELLAR` so it is persisted
# across upgrades. # across upgrades.
def etc def etc
(HOMEBREW_PREFIX+"etc").extend(InstallRenamed) (HOMEBREW_PREFIX/"etc").extend(InstallRenamed)
end end
# The directory where the formula's variable files should be installed. # The directory where the formula's variable files should be installed.
# This directory is not inside the `HOMEBREW_CELLAR` so it is persisted # This directory is not inside the `HOMEBREW_CELLAR` so it is persisted
# across upgrades. # across upgrades.
def var def var
HOMEBREW_PREFIX+"var" HOMEBREW_PREFIX/"var"
end end
# The directory where the formula's ZSH function files should be # The directory where the formula's ZSH function files should be
@ -822,7 +822,7 @@ class Formula
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def zsh_function def zsh_function
share+"zsh/site-functions" share/"zsh/site-functions"
end end
# The directory where the formula's fish function files should be # The directory where the formula's fish function files should be
@ -830,7 +830,7 @@ class Formula
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def fish_function def fish_function
share+"fish/vendor_functions.d" share/"fish/vendor_functions.d"
end end
# The directory where the formula's Bash completion files should be # The directory where the formula's Bash completion files should be
@ -838,7 +838,7 @@ class Formula
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def bash_completion def bash_completion
prefix+"etc/bash_completion.d" prefix/"etc/bash_completion.d"
end end
# The directory where the formula's ZSH completion files should be # The directory where the formula's ZSH completion files should be
@ -846,7 +846,7 @@ class Formula
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def zsh_completion def zsh_completion
share+"zsh/site-functions" share/"zsh/site-functions"
end end
# The directory where the formula's fish completion files should be # The directory where the formula's fish completion files should be
@ -854,7 +854,7 @@ class Formula
# This is symlinked into `HOMEBREW_PREFIX` after installation or with # This is symlinked into `HOMEBREW_PREFIX` after installation or with
# `brew link` for formulae that are not keg-only. # `brew link` for formulae that are not keg-only.
def fish_completion def fish_completion
share+"fish/vendor_completions.d" share/"fish/vendor_completions.d"
end end
# The directory used for as the prefix for {#etc} and {#var} files on # The directory used for as the prefix for {#etc} and {#var} files on
@ -862,13 +862,13 @@ class Formula
# there after pouring a bottle. # there after pouring a bottle.
# @private # @private
def bottle_prefix def bottle_prefix
prefix+".bottle" prefix/".bottle"
end end
# The directory where the formula's installation or test logs will be written. # The directory where the formula's installation or test logs will be written.
# @private # @private
def logs def logs
HOMEBREW_LOGS+name HOMEBREW_LOGS + name
end end
# The prefix, if any, to use in filenames for logging current activity # The prefix, if any, to use in filenames for logging current activity
@ -921,12 +921,12 @@ class Formula
# The generated launchd {.plist} service name. # The generated launchd {.plist} service name.
def plist_name def plist_name
"homebrew.mxcl."+name "homebrew.mxcl." + name
end end
# The generated launchd {.plist} file path. # The generated launchd {.plist} file path.
def plist_path def plist_path
prefix+(plist_name+".plist") prefix + (plist_name + ".plist")
end end
# @private # @private
@ -951,39 +951,39 @@ class Formula
end end
def opt_bin def opt_bin
opt_prefix+"bin" opt_prefix/"bin"
end end
def opt_include def opt_include
opt_prefix+"include" opt_prefix/"include"
end end
def opt_lib def opt_lib
opt_prefix+"lib" opt_prefix/"lib"
end end
def opt_libexec def opt_libexec
opt_prefix+"libexec" opt_prefix/"libexec"
end end
def opt_sbin def opt_sbin
opt_prefix+"sbin" opt_prefix/"sbin"
end end
def opt_share def opt_share
opt_prefix+"share" opt_prefix/"share"
end end
def opt_pkgshare def opt_pkgshare
opt_prefix+"share"+name opt_prefix/"share"/name
end end
def opt_elisp def opt_elisp
opt_prefix+"share/emacs/site-lisp"+name opt_prefix/"share/emacs/site-lisp"/name
end end
def opt_frameworks def opt_frameworks
opt_prefix+"Frameworks" opt_prefix/"Frameworks"
end end
# Indicates that this formula supports bottles. (Not necessarily that one # Indicates that this formula supports bottles. (Not necessarily that one
@ -1722,7 +1722,7 @@ class Formula
# @private # @private
def test_fixtures(file) def test_fixtures(file)
HOMEBREW_LIBRARY_PATH.join("test", "support", "fixtures", file) HOMEBREW_LIBRARY_PATH/"test/support/fixtures"/file
end end
# This method is overridden in {Formula} subclasses to provide the installation instructions. # This method is overridden in {Formula} subclasses to provide the installation instructions.
@ -1787,7 +1787,7 @@ class Formula
pretty_args[i] = "import setuptools..." pretty_args[i] = "import setuptools..."
end end
end end
ohai "#{cmd} #{pretty_args*" "}".strip ohai "#{cmd} #{pretty_args * " "}".strip
@exec_count ||= 0 @exec_count ||= 0
@exec_count += 1 @exec_count += 1

View File

@ -20,7 +20,7 @@ module FormulaCellarChecks
def check_manpages def check_manpages
# Check for man pages that aren't in share/man # Check for man pages that aren't in share/man
return unless (formula.prefix+"man").directory? return unless (formula.prefix/"man").directory?
<<-EOS.undent <<-EOS.undent
A top-level "man" directory was found A top-level "man" directory was found
@ -31,7 +31,7 @@ module FormulaCellarChecks
def check_infopages def check_infopages
# Check for info pages that aren't in share/info # Check for info pages that aren't in share/info
return unless (formula.prefix+"info").directory? return unless (formula.prefix/"info").directory?
<<-EOS.undent <<-EOS.undent
A top-level "info" directory was found A top-level "info" directory was found

View File

@ -197,7 +197,7 @@ class FormulaInstaller
return if pinned_unsatisfied_deps.empty? return if pinned_unsatisfied_deps.empty?
raise CannotInstallFormulaError, raise CannotInstallFormulaError,
"You must `brew unpin #{pinned_unsatisfied_deps*" "}` as installing #{formula.full_name} requires the latest version of pinned dependencies" "You must `brew unpin #{pinned_unsatisfied_deps * " "}` as installing #{formula.full_name} requires the latest version of pinned dependencies"
end end
def build_bottle_preinstall def build_bottle_preinstall

View File

@ -11,7 +11,7 @@ class FormulaPin
def pin_at(version) def pin_at(version)
HOMEBREW_PINNED_KEGS.mkpath HOMEBREW_PINNED_KEGS.mkpath
version_path = @f.rack.join(version) version_path = @f.rack/version
path.make_relative_symlink(version_path) unless pinned? || !version_path.exist? path.make_relative_symlink(version_path) unless pinned? || !version_path.exist?
end end

View File

@ -259,7 +259,7 @@ class Keg
dirs = [] dirs = []
TOP_LEVEL_DIRECTORIES.map { |d| path.join(d) }.each do |dir| TOP_LEVEL_DIRECTORIES.map { |d| path/d }.each do |dir|
next unless dir.exist? next unless dir.exist?
dir.find do |src| dir.find do |src|
dst = HOMEBREW_PREFIX + src.relative_path_from(path) dst = HOMEBREW_PREFIX + src.relative_path_from(path)
@ -301,7 +301,7 @@ class Keg
def completion_installed?(shell) def completion_installed?(shell)
dir = case shell dir = case shell
when :bash then path.join("etc", "bash_completion.d") when :bash then path/"etc/bash_completion.d"
when :zsh when :zsh
dir = path/"share/zsh/site-functions" dir = path/"share/zsh/site-functions"
dir if dir.directory? && dir.children.any? { |f| f.basename.to_s.start_with?("_") } dir if dir.directory? && dir.children.any? { |f| f.basename.to_s.start_with?("_") }
@ -328,7 +328,7 @@ class Keg
end end
def python_site_packages_installed? def python_site_packages_installed?
path.join("lib", "python2.7", "site-packages").directory? (path/"lib/python2.7/site-packages").directory?
end end
def python_pth_files_installed? def python_pth_files_installed?
@ -568,7 +568,7 @@ class Keg
# symlinks the contents of path+relative_dir recursively into #{HOMEBREW_PREFIX}/relative_dir # symlinks the contents of path+relative_dir recursively into #{HOMEBREW_PREFIX}/relative_dir
def link_dir(relative_dir, mode) def link_dir(relative_dir, mode)
root = path+relative_dir root = path/relative_dir
return unless root.exist? return unless root.exist?
root.find do |src| root.find do |src|
next if src == root next if src == root

View File

@ -108,7 +108,7 @@ class Keg
end end
def lib def lib
path.join("lib") path/"lib"
end end
def text_files def text_files

View File

@ -248,7 +248,7 @@ class Migrator
# Pathname#make_relative_symlink, where Pathname#relative_path_from # Pathname#make_relative_symlink, where Pathname#relative_path_from
# is used to find relative path from source to destination parent and # is used to find relative path from source to destination parent and
# it assumes no symlinks. # it assumes no symlinks.
src_oldname = old_pin_record.dirname.join(old_pin_link_record).expand_path src_oldname = (old_pin_record.dirname/old_pin_link_record).expand_path
new_pin_record.make_relative_symlink(src_oldname.sub(oldname, newname)) new_pin_record.make_relative_symlink(src_oldname.sub(oldname, newname))
old_pin_record.delete old_pin_record.delete
end end
@ -363,7 +363,7 @@ class Migrator
backup_old_tabs backup_old_tabs
if pinned? && !old_pin_record.symlink? if pinned? && !old_pin_record.symlink?
src_oldname = old_pin_record.dirname.join(old_pin_link_record).expand_path src_oldname = (old_pin_record.dirname/old_pin_link_record).expand_path
old_pin_record.make_relative_symlink(src_oldname) old_pin_record.make_relative_symlink(src_oldname)
new_pin_record.delete new_pin_record.delete
end end

View File

@ -28,12 +28,12 @@ module ArchitectureListExtension
end end
def ppc? def ppc?
(Hardware::CPU::PPC_32BIT_ARCHS+Hardware::CPU::PPC_64BIT_ARCHS).any? { |a| include? a } (Hardware::CPU::PPC_32BIT_ARCHS + Hardware::CPU::PPC_64BIT_ARCHS).any? { |a| include? a }
end end
# @private # @private
def remove_ppc! def remove_ppc!
(Hardware::CPU::PPC_32BIT_ARCHS+Hardware::CPU::PPC_64BIT_ARCHS).each { |a| delete a } (Hardware::CPU::PPC_32BIT_ARCHS + Hardware::CPU::PPC_64BIT_ARCHS).each { |a| delete a }
end end
def as_arch_flags def as_arch_flags

View File

@ -46,7 +46,7 @@ class JavaRequirement < Requirement
if exact_version? if exact_version?
@version @version
else else
@version[0, @version.length-1] @version[0, @version.length - 1]
end end
end end

View File

@ -52,9 +52,9 @@ module RuboCop
end end
# Check if each present_components is above rest of the present_components # Check if each present_components is above rest of the present_components
@present_components.take(@present_components.size-1).each_with_index do |preceding_component, p_idx| @present_components.take(@present_components.size - 1).each_with_index do |preceding_component, p_idx|
next if preceding_component.empty? next if preceding_component.empty?
@present_components.drop(p_idx+1).each do |succeeding_component| @present_components.drop(p_idx + 1).each do |succeeding_component|
next if succeeding_component.empty? next if succeeding_component.empty?
@offensive_nodes = check_precedence(preceding_component, succeeding_component) @offensive_nodes = check_precedence(preceding_component, succeeding_component)
component_problem @offensive_nodes[0], @offensive_nodes[1] if @offensive_nodes component_problem @offensive_nodes[0], @offensive_nodes[1] if @offensive_nodes
@ -88,16 +88,16 @@ module RuboCop
order_idx, curr_p_idx, preceding_comp_arr = get_state(node1) order_idx, curr_p_idx, preceding_comp_arr = get_state(node1)
# curr_p_idx > 0 means node1 needs to be grouped with its own kind # curr_p_idx > 0 means node1 needs to be grouped with its own kind
if curr_p_idx>0 if curr_p_idx > 0
node2 = preceding_comp_arr[curr_p_idx-1] node2 = preceding_comp_arr[curr_p_idx - 1]
indentation = " " * (start_column(node2) - line_start_column(node2)) indentation = " " * (start_column(node2) - line_start_column(node2))
line_breaks = node2.multiline? ? "\n\n" : "\n" line_breaks = node2.multiline? ? "\n\n" : "\n"
corrector.insert_after(node2.source_range, line_breaks+indentation+node1.source) corrector.insert_after(node2.source_range, line_breaks + indentation + node1.source)
else else
indentation = " " * (start_column(node2) - line_start_column(node2)) indentation = " " * (start_column(node2) - line_start_column(node2))
# No line breaks upto version_scheme, order_idx == 8 # No line breaks upto version_scheme, order_idx == 8
line_breaks = (order_idx>8) ? "\n\n" : "\n" line_breaks = (order_idx > 8) ? "\n\n" : "\n"
corrector.insert_before(node2.source_range, node1.source+line_breaks+indentation) corrector.insert_before(node2.source_range, node1.source + line_breaks + indentation)
end end
corrector.remove(range_with_surrounding_space(node1.source_range, :left)) corrector.remove(range_with_surrounding_space(node1.source_range, :left))
end end

View File

@ -176,7 +176,7 @@ class Sandbox
def add_rule(rule) def add_rule(rule)
s = "(" s = "("
s << ((rule[:allow]) ? "allow": "deny") s << ((rule[:allow]) ? "allow" : "deny")
s << " #{rule[:operation]}" s << " #{rule[:operation]}"
s << " (#{rule[:filter]})" if rule[:filter] s << " (#{rule[:filter]})" if rule[:filter]
s << " (with #{rule[:modifier]})" if rule[:modifier] s << " (with #{rule[:modifier]})" if rule[:modifier]

View File

@ -23,7 +23,7 @@ class Tab < OpenStruct
"homebrew_version" => HOMEBREW_VERSION, "homebrew_version" => HOMEBREW_VERSION,
"used_options" => build.used_options.as_flags, "used_options" => build.used_options.as_flags,
"unused_options" => build.unused_options.as_flags, "unused_options" => build.unused_options.as_flags,
"tabfile" => formula.prefix.join(FILENAME), "tabfile" => formula.prefix/FILENAME,
"built_as_bottle" => build.bottle?, "built_as_bottle" => build.bottle?,
"installed_as_dependency" => false, "installed_as_dependency" => false,
"installed_on_request" => true, "installed_on_request" => true,
@ -98,7 +98,7 @@ class Tab < OpenStruct
end end
def self.for_keg(keg) def self.for_keg(keg)
path = keg.join(FILENAME) path = keg/FILENAME
tab = if path.exist? tab = if path.exist?
from_file(path) from_file(path)
@ -145,7 +145,7 @@ class Tab < OpenStruct
paths << f.installed_prefix paths << f.installed_prefix
path = paths.map { |pn| pn.join(FILENAME) }.find(&:file?) path = paths.map { |pn| pn/FILENAME }.find(&:file?)
if path if path
tab = from_file(path) tab = from_file(path)

View File

@ -8,7 +8,7 @@ require "formula_assertions"
require "fcntl" require "fcntl"
require "socket" require "socket"
TEST_TIMEOUT_SECONDS = 5*60 TEST_TIMEOUT_SECONDS = 5 * 60
begin begin
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io) error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)

View File

@ -31,7 +31,7 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do
source = <<-EOS.undent source = <<-EOS.undent
class Foo < Formula class Foo < Formula
url 'http://example.com/foo-1.0.tgz' url 'http://example.com/foo-1.0.tgz'
desc '#{"bar"*30}' desc '#{"bar" * 30}'
end end
EOS EOS
@ -55,8 +55,8 @@ describe RuboCop::Cop::FormulaAuditStrict::Desc do
source = <<-EOS.undent source = <<-EOS.undent
class Foo < Formula class Foo < Formula
url 'http://example.com/foo-1.0.tgz' url 'http://example.com/foo-1.0.tgz'
desc '#{"bar"*10}'\ desc '#{"bar" * 10}'\
'#{"foo"*21}' '#{"foo" * 21}'
end end
EOS EOS

View File

@ -175,7 +175,7 @@ module Homebrew
end end
def system(cmd, *args) def system(cmd, *args)
puts "#{cmd} #{args*" "}" if ARGV.verbose? puts "#{cmd} #{args * " "}" if ARGV.verbose?
_system(cmd, *args) _system(cmd, *args)
end end
@ -336,6 +336,12 @@ def which_editor
editor = candidate if which(candidate, ENV["HOMEBREW_PATH"]) editor = candidate if which(candidate, ENV["HOMEBREW_PATH"])
end end
# Find Textmate
editor = which("mate", ENV["HOMEBREW_PATH"])
# Find BBEdit/TextWrangler
editor ||= which("edit", ENV["HOMEBREW_PATH"])
# Find vim
editor ||= which("vim", ENV["HOMEBREW_PATH"])
# Default to standard vim # Default to standard vim
editor ||= "/usr/bin/vim" editor ||= "/usr/bin/vim"