Sha256: 856d120e9a94b6aaa4f650398654d18bbf389568a70059225eda99db50424978

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 KB

Contents

#!/usr/bin/env ruby

# Hack to allow testing with Aruba (for now)
$:.push File.expand_path(File.join("..", "..", "lib"), __FILE__)

require 'hobo'
require 'slop'
require 'teerb'
require 'tmpdir'

error_handler = Hobo::ErrorHandlers::Friendly.new

Hobo.ui = Hobo::Ui.new
Hobo.logger = Logger.new(STDOUT)
Hobo.logger.level = Logger::WARN

# Options parsed here will be hidden from the main app
slop = Slop.parse! do
  on '--debug', 'Enable debugging' do
    error_handler = Hobo::ErrorHandlers::Debug.new
    debug_log = File.open(File.join(Dir.tmpdir, 'hobo_debug.log'), 'w+')
    Hobo.logger = Logger.new(TeeRb::IODelegate.new(STDOUT, debug_log))
    Hobo.logger.level = Logger::DEBUG
  end

  on '--ansi', 'Enable / disable ansi output', :invertable => true do
    Hobo.ui.use_color self.to_hash[:ansi]
  end

  on '--log-level=', 'Set log level' do
    level = self.to_hash[:'log-level'].upcase
    Hobo.logger.level = Logger.const_get(level) if [ 'DEBUG', 'INFO' ].include? level
  end
end

Hobo.logger.formatter = proc do |severity, datetime, progname, msg|
  "#{datetime.strftime("%Y-%m-%d %H:%M:%S")}: #{severity}: #{msg}\n"
end

begin
  Hobo::Lib::HostCheck.check(:filter => /not_using_system_ruby/)
  Hobo.cli = Hobo::Cli.new(slop: slop)
  Hobo.cli.start
rescue Exception => error
  exit error_handler.handle(error)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hobo-inviqa-0.0.8 bin/hobo
hobo-inviqa-0.0.7.pre.rc3 bin/hobo
hobo-inviqa-0.0.7.pre.rc2 bin/hobo
hobo-inviqa-0.0.7.pre.rc1 bin/hobo