Sha256: 681a0356c6ae256dbce35036562feb8ee49ea674e1d5d6e137680e8b97154fde

Contents?: true

Size: 1.81 KB

Versions: 2

Compression:

Stored size: 1.81 KB

Contents

#!/usr/bin/env ruby

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

# Hack to override Gemfile to that of hobo (otherwise it'll use project specific one!)
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)

# Ensure hobo gems are used
require 'hobo/patches/rubygems'
require 'bundler/setup'
require 'bundler'

# Suppress Net/SSH/Simple warning on windows
$SUPPRESS_32BIT_WARNING=1

require 'hobo'

$HOBO_ARGV = ARGV

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
    require 'teerb'
    require 'tmpdir'
    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

  on '--non-interactive', 'Run non-interactively. Defaults will be automatically used where possible.'
end

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

opts = slop.to_hash
Hobo.ui.interactive = !(opts[:'non-interactive'] == true)

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

2 entries across 2 versions & 1 rubygems

Version Path
hobo-inviqa-0.0.10.pre.rc6 bin/hobo
hobo-inviqa-0.0.10.pre.rc4 bin/hobo