Sha256: c479b5434b07f92e496ec60f568c2620249f628c546b114b8833566d931c9691

Contents?: true

Size: 559 Bytes

Versions: 6

Compression:

Stored size: 559 Bytes

Contents

require "thor"
require "term/ansicolor"
require "systemu"

class Bard::CLI < Thor
  include Term::ANSIColor

  private

  def fatal(message)
    raise Bard::CLI::Error, red("!!! ") + message
  end

  def run_crucial(command, verbose = false)
    status, stdout, stderr = systemu command
    fatal "Running command: #{yellow(command)}: #{stderr}" if status.to_i.nonzero?
    if verbose
      $stdout.puts stdout
      $stderr.puts stderr
    end
    stdout.chomp
  end

  def project_name
    @project_name ||= File.expand_path(".").split("/").last
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bard-0.23.0 lib/bard/base.rb
bard-0.22.2 lib/bard/base.rb
bard-0.22.1 lib/bard/base.rb
bard-0.22.0 lib/bard/base.rb
bard-0.21.0 lib/bard/base.rb
bard-0.20.0 lib/bard/base.rb