brew-test-bot: Cleanup and improve documentation.
This commit is contained in:
parent
25442f20ec
commit
2901fd393e
@ -3,10 +3,12 @@
|
|||||||
# Usage: brew test-bot [options...] <pull-request|formula>
|
# Usage: brew test-bot [options...] <pull-request|formula>
|
||||||
#
|
#
|
||||||
# Options:
|
# Options:
|
||||||
# --log: Writes log files under ./brewbot/
|
# --log: Writes log files under ./brewbot/
|
||||||
# --html: Writes html and log files under ./brewbot/
|
# --html: Writes html and log files under ./brewbot/
|
||||||
# --comment: Comment on the pull request
|
# --comment: Comment on the pull request
|
||||||
# --clean: Clean the Homebrew directory. Very dangerous. Use with care.
|
# --cleanup: Clean the Homebrew directory. Very dangerous. Use with care.
|
||||||
|
# --skip-cleanup: Don't check for uncommitted changes.
|
||||||
|
# --skip-setup: Don't check the local system is setup correctly.
|
||||||
|
|
||||||
require 'formula'
|
require 'formula'
|
||||||
require 'utils'
|
require 'utils'
|
||||||
@ -15,7 +17,7 @@ require 'date'
|
|||||||
HOMEBREW_CONTRIBUTED_CMDS = HOMEBREW_REPOSITORY + "Library/Contributions/cmds/"
|
HOMEBREW_CONTRIBUTED_CMDS = HOMEBREW_REPOSITORY + "Library/Contributions/cmds/"
|
||||||
|
|
||||||
class Step
|
class Step
|
||||||
attr_reader :command
|
attr_reader :command, :repository
|
||||||
attr_accessor :status
|
attr_accessor :status
|
||||||
|
|
||||||
def initialize test, command
|
def initialize test, command
|
||||||
@ -24,6 +26,7 @@ class Step
|
|||||||
@command = command
|
@command = command
|
||||||
@name = command.split[1].delete '-'
|
@name = command.split[1].delete '-'
|
||||||
@status = :running
|
@status = :running
|
||||||
|
@repository = HOMEBREW_REPOSITORY
|
||||||
@test.steps << self
|
@test.steps << self
|
||||||
write_html
|
write_html
|
||||||
end
|
end
|
||||||
@ -73,7 +76,7 @@ class Step
|
|||||||
|
|
||||||
command = "#{step.command} &>#{step.log_file_path}"
|
command = "#{step.command} &>#{step.log_file_path}"
|
||||||
if command.start_with? 'git '
|
if command.start_with? 'git '
|
||||||
Dir.chdir HOMEBREW_REPOSITORY { `#{command}` }
|
Dir.chdir step.repository { `#{command}` }
|
||||||
else
|
else
|
||||||
`#{command}`
|
`#{command}`
|
||||||
end
|
end
|
||||||
@ -229,8 +232,10 @@ class Test
|
|||||||
test "git reset --hard origin/master"
|
test "git reset --hard origin/master"
|
||||||
test "git clean --force -dx"
|
test "git clean --force -dx"
|
||||||
else
|
else
|
||||||
git('diff --exit-code HEAD 2>/dev/null')
|
unless ARGV.include? "--skip-cleanup"
|
||||||
odie "Uncommitted changes, aborting." unless $?.success?
|
git('diff --exit-code HEAD 2>/dev/null')
|
||||||
|
odie "Uncommitted changes, aborting." unless $?.success?
|
||||||
|
end
|
||||||
test "git reset --hard #{@start_sha1}" if @start_sha1
|
test "git reset --hard #{@start_sha1}" if @start_sha1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -269,7 +274,7 @@ class Test
|
|||||||
|
|
||||||
def self.run url
|
def self.run url
|
||||||
test = new url
|
test = new url
|
||||||
test.cleanup unless ARGV.include? "--skip-cleanup"
|
test.cleanup
|
||||||
test.download
|
test.download
|
||||||
test.setup unless ARGV.include? "--skip-setup"
|
test.setup unless ARGV.include? "--skip-setup"
|
||||||
test.formulae.each do |f|
|
test.formulae.each do |f|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user