#!/usr/bin/env ruby require 'require_all' module Rebuild require_relative '../lib/rbld_commands' require_rel '../lib/commands' require_relative '../lib/rbld_plugins' end def notify_start Rebuild::PlugMgr.instance.notify(:start) { return false } end begin rbld_log.info( "ARGV: #{ARGV.join(' ')}" ) exit 100 unless notify_start if !ARGV[0] || (ARGV[0] == "help" && !ARGV[1]) puts Rebuild::CLI::Main.usage puts exit 0 end if ARGV[0] == "help" Rebuild::CLI::Commands.usage( ARGV[1] ) exit 0 end if ARGV[1] == "--help" || ARGV[1] == "-h" Rebuild::CLI::Commands.usage( ARGV[0] ) exit 0 end exit Rebuild::CLI::Commands.run( ARGV[0], ARGV.drop(1) ) || 0 rescue StandardError => e rbld_print.error(e.message) e.backtrace.each { |l| rbld_log.fatal(l) } exit 1 rescue SignalException => e rbld_print.error("Command execution was terminated.") e.backtrace.each { |l| rbld_log.fatal(l) } exit 2 end