Sha256: b9626f602620837867cd8dd1c192706aa81a7697bb44fde07fc57d3a613cc473

Contents?: true

Size: 1.79 KB

Versions: 6

Compression:

Stored size: 1.79 KB

Contents

#!/usr/bin/env ruby

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

def init_hem
  require 'hem'

  # Default main classes
  error_handler = Hem::ErrorHandlers::Friendly.new
  Hem.ui = Hem::Ui.new
  Hem.logger = Logger.new(STDOUT)
  Hem.logger.level = Logger::WARN

  # Low level / early arg parsing
  # Anything that can alter ui / logger / cli should be here
  # Early termination args should also go here
  slop = Slop.parse! do
    on '--debug', 'Enable debugging' do
      require 'teerb'
      require 'tmpdir'
      error_handler = Hem::ErrorHandlers::Debug.new
      debug_log = File.open(File.join(Dir.tmpdir, 'hem_debug.log'), 'w+')
      Hem.logger = Logger.new(TeeRb::IODelegate.new(STDOUT, debug_log))
      Hem.logger.level = Logger::DEBUG
    end

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

    on '--log-level=', 'Set log level' do
      level = self.to_hash[:'log-level'].upcase
      Hem.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.'
    on '--skip-host-checks', 'Skip host checks'
  end

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

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

  begin
    Hem.cli = Hem::Cli.new(slop: slop)
    Hem.cli.start
  rescue Exception => error
    exit error_handler.handle(error)
  end
end

Gem.configuration.verbose = false

require 'hem/patches/rubygems'

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

init_hem

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hem-1.0.1.beta6 bin/hem
hem-1.0.1.beta5 bin/hem
hem-1.0.1.beta4 bin/hem
hem-1.0.1.beta3 bin/hem
hem-1.0.1.beta2 bin/hem
hem-1.0.1.beta1 bin/hem