Hash :
49350d87
Author :
Thomas de Grivel
Date :
2023-02-25T16:56:20
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#!/usr/bin/env ruby
load "#{File.dirname(File.dirname(__FILE__))}/lib/rbpkg.rb"
$ARGS = ARGV
def shift
usage if $ARGS == []
arg = $ARGS[0]
$ARGS = $ARGS[1..] || []
arg
end
verbose_level = 2 # print command output
case $ARGS[0]
when "-v"
verbose_level = 3 # print all messages
shift
when "-q"
verbose_level = 1 # print commands
shift
when "-qq"
verbose_level = 0 # print nothing
shift
end
Rbpkg.init("rbpkg_ci", verbose_level, Rbpkg.ci_log_dir)
def usage()
STDERR.puts "Usage: #{File.basename($0)} REPO BRANCH COMMIT"
exit 1
end
def rbpkg_ci
case $ARGS[0]
when "-h"
usage
when "--help"
usage
when "--upgrade"
Rbpkg.upgrade_self
shift
end
repo = shift
branch = $ARGS[0] ? shift : nil
commit = $ARGS[0] ? shift : nil
usage unless $ARGS == []
Rbpkg.ci_init
Rbpkg::Repos.repo(repo).ci(branch, commit)
end
begin
rbpkg_ci
Rbpkg::Log.ok_all
rescue => error
verbose(-1, error.backtrace.reverse.join("\n"))
verbose(-1, "#{error.class.name}: #{error.message}")
exit 1
end