Sha256: 8449db8aa72ced417223fb86ad989473f5c7ab57c8bd9a1f56ad2b21b12a3230
Contents?: true
Size: 846 Bytes
Versions: 12
Compression:
Stored size: 846 Bytes
Contents
# coding: utf-8 require 'rainbow' require 'sshkit' require 'gaptool_client/api' module Gaptool class InteractionHandler attr_reader :host def initialize(host) @host = host end def on_data(_command, stream_name, data, _channel) case stream_name when :stdout puts "#{Rainbow("#{@host}").yellow}> #{data}" when :stderr STDERR.puts "#{Rainbow("#{@host}").red}> #{data}" end end end class Host < SSHKit::Host attr_reader :info def initialize(node) super(node['hostname']) @info = node end def method_missing(attr, *args, &_block) @info[attr] || super end def [](attr) @info[attr] end def name @name ||= Gaptool::API.get_host(@info) end def handler InteractionHandler.new(name) end end end
Version data entries
12 entries across 12 versions & 1 rubygems