Add ofail command and fix bottle command output.
This commit is contained in:
parent
a1ce504e7d
commit
fe969c21ad
@ -91,7 +91,7 @@ class Test
|
|||||||
begin
|
begin
|
||||||
Formula.factory arg
|
Formula.factory arg
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError
|
||||||
ofail "#{arg} is not a pull request number or formula." unless arg.to_i > 0
|
odie "#{arg} is not a pull request number or formula." unless arg.to_i > 0
|
||||||
@url = arg
|
@url = arg
|
||||||
@formulae = []
|
@formulae = []
|
||||||
else
|
else
|
||||||
@ -214,7 +214,7 @@ class Test
|
|||||||
test "git clean --force -dx"
|
test "git clean --force -dx"
|
||||||
else
|
else
|
||||||
`git diff --exit-code HEAD 2>/dev/null`
|
`git diff --exit-code HEAD 2>/dev/null`
|
||||||
ofail "Uncommitted changes, aborting." unless $?.success?
|
odie "Uncommitted changes, aborting." unless $?.success?
|
||||||
test "git reset --hard #{@start_sha1}" if @start_sha1
|
test "git reset --hard #{@start_sha1}" if @start_sha1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -267,7 +267,7 @@ class Test
|
|||||||
end
|
end
|
||||||
|
|
||||||
if ARGV.empty?
|
if ARGV.empty?
|
||||||
ofail 'This command requires at least one argument containing a pull request number or formula.'
|
odie 'This command requires at least one argument containing a pull request number or formula.'
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir HOMEBREW_REPOSITORY
|
Dir.chdir HOMEBREW_REPOSITORY
|
||||||
|
|||||||
@ -418,9 +418,6 @@ module Homebrew extend self
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if errors
|
ofail "#{problem_count} problems in #{brew_count} brews" if errors
|
||||||
puts "#{problem_count} problems in #{brew_count} brews"
|
|
||||||
Homebrew.failed = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -5,14 +5,12 @@ require 'tab'
|
|||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
def bottle_formula f
|
def bottle_formula f
|
||||||
unless f.installed?
|
unless f.installed?
|
||||||
onoe "Formula not installed: #{f.name}"
|
return ofail "Formula not installed: #{f.name}"
|
||||||
Homebrew.failed = true
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
unless built_bottle? f
|
unless built_bottle? f
|
||||||
onoe "Formula not installed with '--build-bottle': #{f.name}"
|
return ofail "Formula not installed with '--build-bottle': #{f.name}"
|
||||||
Homebrew.failed = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
directory = Pathname.pwd
|
directory = Pathname.pwd
|
||||||
|
|||||||
@ -904,9 +904,8 @@ module Homebrew extend self
|
|||||||
unless out.nil? or out.empty?
|
unless out.nil? or out.empty?
|
||||||
puts unless Homebrew.failed?
|
puts unless Homebrew.failed?
|
||||||
lines = out.to_s.split('\n')
|
lines = out.to_s.split('\n')
|
||||||
opoo lines.shift
|
ofail lines.shift
|
||||||
puts lines
|
puts lines
|
||||||
Homebrew.failed = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -76,8 +76,7 @@ module Homebrew extend self
|
|||||||
fi.caveats
|
fi.caveats
|
||||||
fi.finish
|
fi.finish
|
||||||
rescue CannotInstallFormulaError => e
|
rescue CannotInstallFormulaError => e
|
||||||
onoe e.message
|
ofail e.message
|
||||||
Homebrew.failed = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,15 +12,13 @@ module Homebrew extend self
|
|||||||
ARGV.formulae.each do |f|
|
ARGV.formulae.each do |f|
|
||||||
# Cannot test uninstalled formulae
|
# Cannot test uninstalled formulae
|
||||||
unless f.installed?
|
unless f.installed?
|
||||||
puts "Testing requires the latest version of #{f.name}"
|
ofail "Testing requires the latest version of #{f.name}"
|
||||||
Homebrew.failed = true
|
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
# Cannot test formulae without a test method
|
# Cannot test formulae without a test method
|
||||||
unless f.respond_to? :test
|
unless f.respond_to? :test
|
||||||
puts "#{f.name} defines no test"
|
ofail "#{f.name} defines no test"
|
||||||
Homebrew.failed = true
|
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -29,8 +27,7 @@ module Homebrew extend self
|
|||||||
# tests can also return false to indicate failure
|
# tests can also return false to indicate failure
|
||||||
raise if f.test == false
|
raise if f.test == false
|
||||||
rescue
|
rescue
|
||||||
puts "#{f.name}: failed"
|
ofail "#{f.name}: failed"
|
||||||
Homebrew.failed = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -33,8 +33,7 @@ module Homebrew extend self
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue MultipleVersionsInstalledError => e
|
rescue MultipleVersionsInstalledError => e
|
||||||
onoe e
|
ofail e
|
||||||
puts "Use `brew remove --force #{e.name}` to remove all versions."
|
puts "Use `brew remove --force #{e.name}` to remove all versions."
|
||||||
Homebrew.failed = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -66,8 +66,7 @@ module Homebrew extend self
|
|||||||
installer.caveats
|
installer.caveats
|
||||||
installer.finish
|
installer.finish
|
||||||
rescue CannotInstallFormulaError => e
|
rescue CannotInstallFormulaError => e
|
||||||
onoe e
|
ofail e
|
||||||
Homebrew.failed = true
|
|
||||||
rescue BuildError => e
|
rescue BuildError => e
|
||||||
e.dump
|
e.dump
|
||||||
puts
|
puts
|
||||||
|
|||||||
@ -54,6 +54,11 @@ def onoe error
|
|||||||
end
|
end
|
||||||
|
|
||||||
def ofail error
|
def ofail error
|
||||||
|
onoe error
|
||||||
|
Homebrew.failed = true
|
||||||
|
end
|
||||||
|
|
||||||
|
def odie error
|
||||||
onoe error
|
onoe error
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user