Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-revert "Fix operator spacing." #2716

Merged
merged 1 commit into from
Jun 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions Library/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
AllCops:
TargetRubyVersion: 2.0
Exclude:
- '**/Rakefile'
- '**/.*'
- '**/Casks/**/*'
- '**/vendor/**/*'

Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/brew.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ def require?(path)
ENV["PATH"] = path

if cmd
internal_cmd = require? HOMEBREW_LIBRARY_PATH.join("cmd", cmd)
internal_cmd = require? HOMEBREW_LIBRARY_PATH/"cmd"/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?
system "git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config",
"--replace-all", "homebrew.devcmdrun", "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def self.appcask_checkpoint(cask_tokens, calculate)
if checkpoint.nil?
onoe "Could not retrieve `appcast` checkpoint for cask '#{cask}': #{result[:command_result].stderr}"
else
puts((cask_tokens.count > 1) ? "#{checkpoint} #{cask}": checkpoint)
puts((cask_tokens.count > 1) ? "#{checkpoint} #{cask}" : checkpoint)
count += 1
end
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cask/lib/hbc/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def cache_tag
end

def repo_valid?
@clone.join(".svn").directory?
(@clone/".svn").directory?
end

def repo_url
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def filtered_list
names.each do |d|
versions = d.subdirs.map { |pn| pn.basename.to_s }
next if ARGV.include?("--multiple") && versions.length < 2
puts "#{d.basename} #{versions*" "}"
puts "#{d.basename} #{versions * " "}"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def search_taps(query)

def search_formulae(regex)
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|
begin
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/cmd/switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def switch
end

# Does the target version exist?
unless (rack+version).directory?
unless (rack/version).directory?
onoe "#{name} does not have a version \"#{version}\" in the Cellar."

versions = rack.subdirs.map { |d| Keg.new(d).version }
Expand All @@ -41,7 +41,7 @@ def switch
keg.unlink
end

keg = Keg.new(rack+version)
keg = Keg.new(rack/version)

# Link new version, if not keg-only
if keg_only?(rack)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/unpack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def unpack
raise "Cannot write to #{unpack_dir}" unless unpack_dir.writable_real?

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?
raise "Destination #{stage_dir} already exists!" unless ARGV.force?
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/debrew.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ def self.choose

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?

input = $stdin.gets || exit
input.chomp!

i = input.to_i
if i > 0
choice = menu.entries[i-1]
choice = menu.entries[i - 1]
else
possible = menu.entries.find_all { |e| e.name.start_with?(input) }

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ def audit_text

def audit_lines
text.without_patch.split("\n").each_with_index do |line, lineno|
line_problems(line, lineno+1)
line_problems(line, lineno + 1)
end
end

Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/bottle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def bottle_formula(f)
mv "#{relocatable_tar_path}.gz", bottle_path
end

if bottle_path.size > 1*1024*1024
if bottle_path.size > 1 * 1024 * 1024
ohai "Detecting if #{filename} is relocatable..."
end

Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/dev-cmd/edit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def edit
if ["mate", "subl"].include?(editor)
# 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+".gitignore",
exec_editor HOMEBREW_REPOSITORY/"bin/brew",
HOMEBREW_REPOSITORY/"README.md",
HOMEBREW_REPOSITORY/".gitignore",
*library_folders
else
exec_editor HOMEBREW_REPOSITORY
Expand Down
6 changes: 3 additions & 3 deletions Library/Homebrew/development_tools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def gcc_4_0_build_version

def gcc_4_2_build_version
@gcc_4_2_build_version ||= begin
gcc = locate("gcc-4.2") || HOMEBREW_PREFIX.join("opt/apple-gcc42/bin/gcc-4.2")
if gcc.exist? && !gcc.realpath.basename.to_s.start_with?("llvm")&&
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") &&
build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
Version.new build_version
else
Expand Down Expand Up @@ -96,7 +96,7 @@ def llvm_clang_build_version

def non_apple_gcc_version(cc)
(@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?
version = if path &&
build_version = `#{path} --version`[/gcc(?:-\d(?:\.\d)? \(.+\))? (\d\.\d\.\d)/, 1]
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def check_for_stray_dylibs
"libosxfuse_i32.2.dylib", # OSXFuse
"libosxfuse_i64.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.*.dylib", # NTFS-3G
"libublio.*.dylib", # NTFS-3G
Expand Down Expand Up @@ -470,7 +470,7 @@ def check_user_path_3
return if $seen_prefix_sbin

# 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?

<<-EOS.undent
Expand Down
24 changes: 12 additions & 12 deletions Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def initialize(name, resource)
super
@ref_type, @ref = extract_ref(meta)
@revision = meta[:revision]
@clone = HOMEBREW_CACHE.join(cache_filename)
@clone = HOMEBREW_CACHE/cache_filename
end

def fetch
Expand Down Expand Up @@ -322,7 +322,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
def initialize(name, resource)
super
@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")
end

Expand Down Expand Up @@ -698,7 +698,7 @@ def cache_tag
end

def repo_valid?
cached_location.join(".svn").directory?
(cached_location/".svn").directory?
end

def clone_repo
Expand All @@ -711,7 +711,7 @@ def clone_repo
fetch_repo cached_location, @url, main_revision, true

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
else
fetch_repo cached_location, @url
Expand Down Expand Up @@ -773,15 +773,15 @@ def shallow_clone?
end

def shallow_dir?
git_dir.join("shallow").exist?
(git_dir/"shallow").exist?
end

def support_depth?
@ref_type != :revision && SHALLOW_CLONE_WHITELIST.any? { |regex| @url =~ regex }
end

def git_dir
cached_location.join(".git")
cached_location/".git"
end

def ref?
Expand All @@ -797,7 +797,7 @@ def repo_valid?
end

def submodules?
cached_location.join(".gitmodules").exist?
(cached_location/".gitmodules").exist?
end

def clone_args
Expand Down Expand Up @@ -987,7 +987,7 @@ def cache_tag
end

def repo_valid?
cached_location.join("CVS").directory?
(cached_location/"CVS").directory?
end

def clone_repo
Expand All @@ -1004,8 +1004,8 @@ def update

def split_url(in_url)
parts = in_url.split(/:/)
mod=parts.pop
url=parts.join(":")
mod = parts.pop
url = parts.join(":")
[mod, url]
end
end
Expand Down Expand Up @@ -1045,7 +1045,7 @@ def cache_tag
end

def repo_valid?
cached_location.join(".hg").directory?
(cached_location/".hg").directory?
end

def clone_repo
Expand Down Expand Up @@ -1085,7 +1085,7 @@ def cache_tag
end

def repo_valid?
cached_location.join(".bzr").directory?
(cached_location/".bzr").directory?
end

def clone_repo
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def message
message << "Cannot install #{formula.full_name} because conflicting formulae are installed."
message.concat conflicts.map { |c| conflict_message(c) } << ""
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
link the formula again after the install finishes. You can --force this
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/ARGV.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def include?(arg)
end

def next
at(@n+1) || raise(UsageError)
at(@n + 1) || raise(UsageError)
end

def value(name)
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/ENV/std.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def determine_cc
# @private
def determine_cxx
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

def gcc_4_0
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/extend/ENV/std.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def setup_build_environment(formula = nil)
# Mountain Lion's sed is stricter, and errors out when
# it encounters files with mixed character sets
delete("LC_ALL")
self["LC_CTYPE"]="C"
self["LC_CTYPE"] = "C"
end

# Add lib and include etc. from the current macosxsdk to compiler flags:
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/os/mac/keg_relocate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def dylib_id_for(file)
# the basename of the file itself.
basename = File.basename(file.dylib_id)
relative_dirname = file.dirname.relative_path_from(path)
opt_record.join(relative_dirname, basename).to_s
(opt_record/relative_dirname/basename).to_s
end

# Matches framework references like `XXX.framework/Versions/YYY/XXX` and
Expand Down
14 changes: 7 additions & 7 deletions Library/Homebrew/extend/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def rmdir_if_possible
rmdir
true
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
retry
else
Expand Down Expand Up @@ -343,7 +343,7 @@ def subdirs

# @private
def resolved_path
symlink? ? dirname+readlink : self
symlink? ? dirname.join(readlink) : self
end

# @private
Expand All @@ -353,7 +353,7 @@ def resolved_path_exists?
# The link target contains NUL bytes
false
else
(dirname+link).exist?
dirname.join(link).exist?
end

# @private
Expand All @@ -367,7 +367,7 @@ def /(other)
if !other.respond_to?(:to_str) && !other.respond_to?(:to_path)
odeprecated "Pathname#/ with #{other.class}", "a String or a Pathname"
end
self + other.to_s
join(other.to_s)
end
end

Expand Down Expand Up @@ -403,7 +403,7 @@ def write_exec_script(*targets)
mkpath
targets.each do |target|
target = Pathname.new(target) # allow pathnames or strings
(self+target.basename).write <<-EOS.undent
join(target.basename).write <<-EOS.undent
#!/bin/bash
exec "#{target}" "$@"
EOS
Expand All @@ -427,15 +427,15 @@ def env_script_all_files(dst, env)
Pathname.glob("#{self}/*") do |file|
next if file.directory?
dst.install(file)
new_file = dst+file.basename
new_file = dst.join(file.basename)
file.write_env_script(new_file, env)
end
end

# Writes an exec script that invokes a java jar
def write_jar_script(target_jar, script_name, java_opts = "")
mkpath
(self+script_name).write <<-EOS.undent
join(script_name).write <<-EOS.undent
#!/bin/bash
exec java #{java_opts} -jar #{target_jar} "$@"
EOS
Expand Down