aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2015-08-22 13:15:33 +0800
committerXu Cheng2015-08-22 13:15:33 +0800
commita88c40b8c888064f6514cf0646ea2140e2578d57 (patch)
tree73a31c1fd0b6984ccc8ea43fdfa242ad53c8cea8 /Library
parent3d1f9e0a9c6185b470630c29e44714ac2d050371 (diff)
downloadbrew-a88c40b8c888064f6514cf0646ea2140e2578d57.tar.bz2
core file style update
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/audit.rb2
-rw-r--r--Library/Homebrew/cmd/cleanup.rb2
-rw-r--r--Library/Homebrew/cmd/doctor.rb2
-rw-r--r--Library/Homebrew/cmd/update.rb3
-rw-r--r--Library/Homebrew/exceptions.rb8
-rw-r--r--Library/Homebrew/extend/ARGV.rb10
-rw-r--r--Library/Homebrew/formula_installer.rb2
-rw-r--r--Library/Homebrew/formulary.rb6
-rw-r--r--Library/Homebrew/keg_relocate.rb2
-rw-r--r--Library/Homebrew/test/test_formula_installer_bottle.rb2
-rw-r--r--Library/Homebrew/test/test_migrator.rb2
-rw-r--r--Library/Homebrew/test/test_utils.rb1
12 files changed, 21 insertions, 21 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index 49396224b..ca76c1c53 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -374,7 +374,7 @@ class FormulaAuditor
problem "Description should use \"command-line\" instead of \"#{$1}\""
end
- if desc =~ %r[^([Aa]n?)\s]
+ if desc =~ /^([Aa]n?)\s/
problem "Please remove the indefinite article \"#{$1}\" from the beginning of the description"
end
end
diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb
index f9203c68d..0561510cb 100644
--- a/Library/Homebrew/cmd/cleanup.rb
+++ b/Library/Homebrew/cmd/cleanup.rb
@@ -133,7 +133,7 @@ module Homebrew
workers.map(&:join)
end
- def prune?(path, options={})
+ def prune?(path, options = {})
@time ||= Time.now
path_modified_time = path.mtime
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 97e31a8e2..910aedc52 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -864,7 +864,7 @@ class Checks
# https://help.github.com/articles/https-cloning-errors
`git --version`.chomp =~ /git version ((?:\d+\.?)+)/
- if $1 && Version.new($1) < Version.new("1.7.10") then
+ if $1 && Version.new($1) < Version.new("1.7.10")
git_upgrade_cmd = Formula["git"].any_version_installed? ? "upgrade" : "install"
<<-EOS.undent
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb
index d9cecf5d5..33c7c49ae 100644
--- a/Library/Homebrew/cmd/update.rb
+++ b/Library/Homebrew/cmd/update.rb
@@ -71,7 +71,8 @@ module Homebrew
user, repo, oldname = oldname.split("/", 3)
newname = newname.split("/", 3).last
else
- user, repo = "homebrew", "homebrew"
+ user = "homebrew"
+ repo = "homebrew"
end
next unless (dir = HOMEBREW_CELLAR/oldname).directory? && !dir.subdirs.empty?
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 9e3a29983..f38233a4f 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -99,7 +99,7 @@ class TapFormulaWithOldnameAmbiguityError < RuntimeError
end
super <<-EOS.undent
- Formulae with '#{name}' old name found in multiple taps: #{taps.map { |t| "\n * #{t}" }.join}
+ Formulae with '#{name}' old name found in multiple taps: #{taps.map { |t| "\n * #{t}" }.join}
Please use the fully-qualified name e.g. #{taps.first}/#{name} to refer the formula or use its new name.
EOS
@@ -121,7 +121,7 @@ end
class TapPinStatusError < RuntimeError
attr_reader :name, :pinned
- def initialize name, pinned
+ def initialize(name, pinned)
@name = name
@pinned = pinned
@@ -297,7 +297,7 @@ class BuildToolsError < RuntimeError
super <<-EOS.undent
The following #{formula_text}:
- #{formulae.join(', ')}
+ #{formulae.join(", ")}
cannot be installed as a #{package_text} and must be built from source.
#{xcode_text}
EOS
@@ -343,7 +343,7 @@ class BuildFlagsError < RuntimeError
super <<-EOS.undent
The following #{flag_text}:
- #{flags.join(', ')}
+ #{flags.join(", ")}
#{require_text} building tools, but none are installed.
Either remove the #{flag_text} to attempt bottle installation,
#{xcode_text}
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb
index 0f78769c5..106aae7cf 100644
--- a/Library/Homebrew/extend/ARGV.rb
+++ b/Library/Homebrew/extend/ARGV.rb
@@ -212,11 +212,11 @@ module HomebrewArgvExtension
def collect_build_flags
build_flags = []
- build_flags << '--HEAD' if build_head?
- build_flags << '--universal' if build_universal?
- build_flags << '--32-bit' if build_32_bit?
- build_flags << '--build-bottle' if build_bottle?
- build_flags << '--build-from-source' if build_from_source?
+ build_flags << "--HEAD" if build_head?
+ build_flags << "--universal" if build_universal?
+ build_flags << "--32-bit" if build_32_bit?
+ build_flags << "--build-bottle" if build_bottle?
+ build_flags << "--build-from-source" if build_from_source?
build_flags
end
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 8c15367a9..e47840a1f 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -160,7 +160,7 @@ class FormulaInstaller
raise BuildToolsError.new([formula])
end
- if !ignore_deps?
+ unless ignore_deps?
deps = compute_dependencies
check_dependencies_bottled(deps) if pour_bottle?
install_dependencies(deps)
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 755d9f87c..3198ebad2 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -249,7 +249,7 @@ class Formulary
return AliasLoader.new(possible_alias)
end
- possible_tap_formulae = tap_paths(ref)
+ possible_tap_formulae = tap_paths(ref)
if possible_tap_formulae.size > 1
raise TapFormulaAmbiguityError.new(ref, possible_tap_formulae)
elsif possible_tap_formulae.size == 1
@@ -288,7 +288,7 @@ class Formulary
Pathname.new("#{HOMEBREW_LIBRARY}/Formula/#{name.downcase}.rb")
end
- def self.tap_paths(name, taps=Dir["#{HOMEBREW_LIBRARY}/Taps/*/*/"])
+ def self.tap_paths(name, taps = Dir["#{HOMEBREW_LIBRARY}/Taps/*/*/"])
name = name.downcase
taps.map do |tap|
Pathname.glob([
@@ -299,7 +299,7 @@ class Formulary
end.compact
end
- def self.find_with_priority(ref, spec=:stable)
+ def self.find_with_priority(ref, spec = :stable)
possible_pinned_tap_formulae = tap_paths(ref, Dir["#{HOMEBREW_LIBRARY}/PinnedTaps/*/*/"]).map(&:realpath)
if possible_pinned_tap_formulae.size > 1
raise TapFormulaAmbiguityError.new(ref, possible_pinned_tap_formulae)
diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb
index 05d19db4d..f0d6abefe 100644
--- a/Library/Homebrew/keg_relocate.rb
+++ b/Library/Homebrew/keg_relocate.rb
@@ -99,7 +99,7 @@ class Keg
def install_name_tool(*args)
tool = MacOS.install_name_tool
- system(tool, *args) or raise ErrorDuringExecution.new(tool, args)
+ system(tool, *args) || raise(ErrorDuringExecution.new(tool, args))
end
# If file is a dylib or bundle itself, look for the dylib named by
diff --git a/Library/Homebrew/test/test_formula_installer_bottle.rb b/Library/Homebrew/test/test_formula_installer_bottle.rb
index 4d2d1676f..61ed78b19 100644
--- a/Library/Homebrew/test/test_formula_installer_bottle.rb
+++ b/Library/Homebrew/test/test_formula_installer_bottle.rb
@@ -70,7 +70,7 @@ class InstallBottleTests < Homebrew::TestCase
installer = FormulaInstaller.new(formula)
assert_raises(BuildToolsError) do
- installer.install
+ installer.install
end
refute_predicate formula, :installed?
diff --git a/Library/Homebrew/test/test_migrator.rb b/Library/Homebrew/test/test_migrator.rb
index 236c7e00d..e85483a95 100644
--- a/Library/Homebrew/test/test_migrator.rb
+++ b/Library/Homebrew/test/test_migrator.rb
@@ -5,7 +5,7 @@ require "tab"
require "keg"
class Formula
- def set_oldname oldname
+ def set_oldname(oldname)
@oldname = oldname
end
end
diff --git a/Library/Homebrew/test/test_utils.rb b/Library/Homebrew/test/test_utils.rb
index 9dc283084..915e17e70 100644
--- a/Library/Homebrew/test/test_utils.rb
+++ b/Library/Homebrew/test/test_utils.rb
@@ -2,7 +2,6 @@ require "testing_env"
require "tempfile"
class UtilTests < Homebrew::TestCase
-
def setup
@dir = Pathname.new(mktmpdir)
end