various: proper escape dot in regex

This commit is contained in:
Xu Cheng 2016-07-13 16:19:51 +08:00
parent 91fb49d270
commit de1049f1f1
No known key found for this signature in database
GPG Key ID: C2A3860FA0B459CE
8 changed files with 11 additions and 11 deletions

View File

@ -503,7 +503,7 @@ class FormulaAuditor
when %r{^http://[^/]*\.apache\.org}, when %r{^http://[^/]*\.apache\.org},
%r{^http://packages\.debian\.org}, %r{^http://packages\.debian\.org},
%r{^http://wiki\.freedesktop\.org/}, %r{^http://wiki\.freedesktop\.org/},
%r{^http://((?:www)\.)?gnupg.org/}, %r{^http://((?:www)\.)?gnupg\.org/},
%r{^http://ietf\.org}, %r{^http://ietf\.org},
%r{^http://[^/.]+\.ietf\.org}, %r{^http://[^/.]+\.ietf\.org},
%r{^http://[^/.]+\.tools\.ietf\.org}, %r{^http://[^/.]+\.tools\.ietf\.org},
@ -531,7 +531,7 @@ class FormulaAuditor
def audit_github_repository def audit_github_repository
return unless @online return unless @online
regex = %r{https?://github.com/([^/]+)/([^/]+)/?.*} regex = %r{https?://github\.com/([^/]+)/([^/]+)/?.*}
_, user, repo = *regex.match(formula.stable.url) if formula.stable _, user, repo = *regex.match(formula.stable.url) if formula.stable
_, user, repo = *regex.match(formula.homepage) unless user _, user, repo = *regex.match(formula.homepage) unless user
return if !user || !repo return if !user || !repo

View File

@ -51,7 +51,7 @@ module Homebrew
issue = arg issue = arg
url = "https://github.com/Homebrew/homebrew-core/pull/#{arg}" url = "https://github.com/Homebrew/homebrew-core/pull/#{arg}"
tap = CoreTap.instance tap = CoreTap.instance
elsif (testing_match = arg.match %r{brew.sh/job/Homebrew.*Testing/(\d+)/}) elsif (testing_match = arg.match %r{brew\.sh/job/Homebrew.*Testing/(\d+)/})
_, testing_job = *testing_match _, testing_job = *testing_match
url = "https://github.com/Homebrew/homebrew-core/compare/master...BrewTestBot:testing-#{testing_job}" url = "https://github.com/Homebrew/homebrew-core/compare/master...BrewTestBot:testing-#{testing_job}"
tap = CoreTap.instance tap = CoreTap.instance

View File

@ -90,7 +90,7 @@ module Homebrew
unless local_only unless local_only
safe_system "hub", "fork", "--no-remote" safe_system "hub", "fork", "--no-remote"
quiet_system "hub", "fork" quiet_system "hub", "fork"
remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists./, 1] remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists\./, 1]
odie "cannot get remote from 'hub'!" unless remote odie "cannot get remote from 'hub'!" unless remote
safe_system "git", "push", remote, "#{branch}:#{branch}" safe_system "git", "push", remote, "#{branch}:#{branch}"
pr_message = <<-EOS.undent pr_message = <<-EOS.undent
@ -134,7 +134,7 @@ module Homebrew
unless local_only unless local_only
safe_system "hub", "fork", "--no-remote" safe_system "hub", "fork", "--no-remote"
quiet_system "hub", "fork" quiet_system "hub", "fork"
remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists./, 1] remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists\./, 1]
odie "cannot get remote from 'hub'!" unless remote odie "cannot get remote from 'hub'!" unless remote
safe_system "git", "push", remote, "#{branch}:#{branch}" safe_system "git", "push", remote, "#{branch}:#{branch}"
safe_system "hub", "pull-request", "--browse", "-m", <<-EOS.undent safe_system "hub", "pull-request", "--browse", "-m", <<-EOS.undent

View File

@ -148,7 +148,7 @@ module Homebrew
"--", formula.path "--", formula.path
safe_system "hub", "fork", "--no-remote" safe_system "hub", "fork", "--no-remote"
quiet_system "hub", "fork" quiet_system "hub", "fork"
remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists./, 1] remote = Utils.popen_read("hub fork 2>&1")[/fatal: remote (.+) already exists\./, 1]
odie "cannot get remote from 'hub'!" if remote.to_s.empty? odie "cannot get remote from 'hub'!" if remote.to_s.empty?
safe_system "git", "push", remote, "#{branch}:#{branch}" safe_system "git", "push", remote, "#{branch}:#{branch}"
safe_system "hub", "pull-request", "--browse", "-m", safe_system "hub", "pull-request", "--browse", "-m",

View File

@ -26,7 +26,7 @@ class DevelopmentTools
case default_cc case default_cc
# if GCC 4.2 is installed, e.g. via Tigerbrew, prefer it # if GCC 4.2 is installed, e.g. via Tigerbrew, prefer it
# over the system's GCC 4.0 # over the system's GCC 4.0
when /^gcc-4.0/ then gcc_42_build_version ? :gcc : :gcc_4_0 when /^gcc-4\.0/ then gcc_42_build_version ? :gcc : :gcc_4_0
when /^gcc/ then :gcc when /^gcc/ then :gcc
when "clang" then :clang when "clang" then :clang
else else

View File

@ -27,7 +27,7 @@ module FormulaCellarChecks
keg = Keg.new(formula.prefix) keg = Keg.new(formula.prefix)
system_openssl = keg.mach_o_files.select do |obj| system_openssl = keg.mach_o_files.select do |obj|
dlls = obj.dynamically_linked_libraries dlls = obj.dynamically_linked_libraries
dlls.any? { |dll| %r{/usr/lib/lib(crypto|ssl).(\d\.)*dylib}.match dll } dlls.any? { |dll| %r{/usr/lib/lib(crypto|ssl)\.(\d\.)*dylib}.match dll }
end end
return if system_openssl.empty? return if system_openssl.empty?

View File

@ -46,7 +46,7 @@ module OS
paths = {} paths = {}
Dir[File.join(sdk_prefix, "MacOSX*.sdk")].each do |sdk_path| Dir[File.join(sdk_prefix, "MacOSX*.sdk")].each do |sdk_path|
version = sdk_path[/MacOSX(\d+\.\d+)u?.sdk$/, 1] version = sdk_path[/MacOSX(\d+\.\d+)u?\.sdk$/, 1]
paths[version] = sdk_path unless version.nil? paths[version] = sdk_path unless version.nil?
end end

View File

@ -279,7 +279,7 @@ class Version
stem = if spec.directory? stem = if spec.directory?
spec.basename.to_s spec.basename.to_s
elsif %r{((?:sourceforge.net|sf.net)/.*)/download$}.match(spec_s) elsif %r{((?:sourceforge\.net|sf\.net)/.*)/download$}.match(spec_s)
Pathname.new(spec.dirname).stem Pathname.new(spec.dirname).stem
else else
spec.stem spec.stem
@ -290,7 +290,7 @@ class Version
# e.g. https://github.com/sam-github/libnet/tarball/libnet-1.1.4 # e.g. https://github.com/sam-github/libnet/tarball/libnet-1.1.4
# e.g. https://github.com/isaacs/npm/tarball/v0.2.5-1 # e.g. https://github.com/isaacs/npm/tarball/v0.2.5-1
# e.g. https://github.com/petdance/ack/tarball/1.93_02 # e.g. https://github.com/petdance/ack/tarball/1.93_02
m = %r{github.com/.+/(?:zip|tar)ball/(?:v|\w+-)?((?:\d+[-._])+\d*)$}.match(spec_s) m = %r{github\.com/.+/(?:zip|tar)ball/(?:v|\w+-)?((?:\d+[-._])+\d*)$}.match(spec_s)
return m.captures.first unless m.nil? return m.captures.first unless m.nil?
# e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style) # e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style)