core file style update

This commit is contained in:
Xu Cheng 2015-08-22 13:15:33 +08:00
parent 3d1f9e0a9c
commit a88c40b8c8
12 changed files with 21 additions and 21 deletions

View File

@ -374,7 +374,7 @@ class FormulaAuditor
problem "Description should use \"command-line\" instead of \"#{$1}\"" problem "Description should use \"command-line\" instead of \"#{$1}\""
end 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" problem "Please remove the indefinite article \"#{$1}\" from the beginning of the description"
end end
end end

View File

@ -864,7 +864,7 @@ class Checks
# https://help.github.com/articles/https-cloning-errors # https://help.github.com/articles/https-cloning-errors
`git --version`.chomp =~ /git version ((?:\d+\.?)+)/ `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" git_upgrade_cmd = Formula["git"].any_version_installed? ? "upgrade" : "install"
<<-EOS.undent <<-EOS.undent

View File

@ -71,7 +71,8 @@ module Homebrew
user, repo, oldname = oldname.split("/", 3) user, repo, oldname = oldname.split("/", 3)
newname = newname.split("/", 3).last newname = newname.split("/", 3).last
else else
user, repo = "homebrew", "homebrew" user = "homebrew"
repo = "homebrew"
end end
next unless (dir = HOMEBREW_CELLAR/oldname).directory? && !dir.subdirs.empty? next unless (dir = HOMEBREW_CELLAR/oldname).directory? && !dir.subdirs.empty?

View File

@ -121,7 +121,7 @@ end
class TapPinStatusError < RuntimeError class TapPinStatusError < RuntimeError
attr_reader :name, :pinned attr_reader :name, :pinned
def initialize name, pinned def initialize(name, pinned)
@name = name @name = name
@pinned = pinned @pinned = pinned
@ -297,7 +297,7 @@ class BuildToolsError < RuntimeError
super <<-EOS.undent super <<-EOS.undent
The following #{formula_text}: The following #{formula_text}:
#{formulae.join(', ')} #{formulae.join(", ")}
cannot be installed as a #{package_text} and must be built from source. cannot be installed as a #{package_text} and must be built from source.
#{xcode_text} #{xcode_text}
EOS EOS
@ -343,7 +343,7 @@ class BuildFlagsError < RuntimeError
super <<-EOS.undent super <<-EOS.undent
The following #{flag_text}: The following #{flag_text}:
#{flags.join(', ')} #{flags.join(", ")}
#{require_text} building tools, but none are installed. #{require_text} building tools, but none are installed.
Either remove the #{flag_text} to attempt bottle installation, Either remove the #{flag_text} to attempt bottle installation,
#{xcode_text} #{xcode_text}

View File

@ -212,11 +212,11 @@ module HomebrewArgvExtension
def collect_build_flags def collect_build_flags
build_flags = [] build_flags = []
build_flags << '--HEAD' if build_head? build_flags << "--HEAD" if build_head?
build_flags << '--universal' if build_universal? build_flags << "--universal" if build_universal?
build_flags << '--32-bit' if build_32_bit? build_flags << "--32-bit" if build_32_bit?
build_flags << '--build-bottle' if build_bottle? build_flags << "--build-bottle" if build_bottle?
build_flags << '--build-from-source' if build_from_source? build_flags << "--build-from-source" if build_from_source?
build_flags build_flags
end end

View File

@ -160,7 +160,7 @@ class FormulaInstaller
raise BuildToolsError.new([formula]) raise BuildToolsError.new([formula])
end end
if !ignore_deps? unless ignore_deps?
deps = compute_dependencies deps = compute_dependencies
check_dependencies_bottled(deps) if pour_bottle? check_dependencies_bottled(deps) if pour_bottle?
install_dependencies(deps) install_dependencies(deps)

View File

@ -99,7 +99,7 @@ class Keg
def install_name_tool(*args) def install_name_tool(*args)
tool = MacOS.install_name_tool tool = MacOS.install_name_tool
system(tool, *args) or raise ErrorDuringExecution.new(tool, args) system(tool, *args) || raise(ErrorDuringExecution.new(tool, args))
end end
# If file is a dylib or bundle itself, look for the dylib named by # If file is a dylib or bundle itself, look for the dylib named by

View File

@ -5,7 +5,7 @@ require "tab"
require "keg" require "keg"
class Formula class Formula
def set_oldname oldname def set_oldname(oldname)
@oldname = oldname @oldname = oldname
end end
end end

View File

@ -2,7 +2,6 @@ require "testing_env"
require "tempfile" require "tempfile"
class UtilTests < Homebrew::TestCase class UtilTests < Homebrew::TestCase
def setup def setup
@dir = Pathname.new(mktmpdir) @dir = Pathname.new(mktmpdir)
end end