Sha256: 830be326d6a363d19a49aa78329c639c8749832f26911bc9cf81e524b0ca2943

Contents?: true

Size: 921 Bytes

Versions: 3

Compression:

Stored size: 921 Bytes

Contents

require "pathname"
require "fileutils"
require "open3"

# We don't want the setup method to have to do all this error
# checking, and we also want to explicitly log what we are
# executing. Thus, we use this method instead of Kernel#system
def system!(*args)
  if ENV["BRUT_BIN_KIT_DEBUG"] == "true"
    log "Executing #{args}"
    out,err,status = Open3.capture3(*args)
    if status.success?
      log "#{args} succeeded"
    else
      log "#{args} failed"
      log "STDOUT:"
      $stdout.puts out
      log "STDERR:"
      $stderr.puts err
      abort
    end
  else
    log "Executing #{args}"
    if system(*args)
      log "#{args} succeeded"
    else
      log "#{args} failed"
      abort
    end
  end
end

# It's helpful to know what messages came from this
# script, so we'll use log instead of `puts`
def log(message)
  puts "[ #{$0} ] #{message}"
end

ROOT_DIR = ((Pathname(__dir__) / ".." ).expand_path)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
brut-0.0.3 bin/bin_kit.rb
brut-0.0.2 bin/bin_kit.rb
brut-0.0.1 bin/bin_kit.rb