lib/gaptool-client.rb in gaptool-client-0.5.2 vs lib/gaptool-client.rb in gaptool-client-0.5.3

- old
+ new

@@ -12,20 +12,20 @@ puts nodes.to_json else nodes.each do |node| @host = "#{node['role']}:#{node['environment']}:#{node['instance']}" unless grepable - puts @host.color(:green) + puts Rainbow(@host).green end node.keys.each do |key| if grepable puts "#{@host}|#{key}|#{node[key]}" else unless key == node.keys.last - puts " ┠ #{key.color(:cyan)}: #{node[key]}" + puts " ┠ #{Rainbow(key).cyan}: #{node[key]}" else - puts " ┖ #{key.color(:cyan)}: #{node[key]}\n\n" + puts " ┖ #{Rainbow(key).cyan}: #{node[key]}\n\n" end end end end end @@ -49,15 +49,15 @@ channel.exec(command) do |ch, success| unless success abort "FAILED: couldn't execute command (ssh.channel.exec)" end channel.on_data do |ch,data| - puts "#{node['role'].color(:yellow)}:#{node['environment'].color(:yellow)}:#{node['instance'].color(:yellow)}> #{data}" + puts "#{Rainbow(node['role']).yellow}:#{Rainbow(node['environment']).yellow}:#{Rainbow(node['instance']).yellow}> #{data}" end channel.on_extended_data do |ch,type,data| - puts "#{node['role'].color(:yellow)}:#{node['environment'].color(:yellow)}:#{node['instance'].color(:red)}> #{data}" + puts "#{Rainbow(node['role']).yellow}:#{Rainbow(node['environment']).yellow}:#{Rainbow(node['instance']).red}> #{data}" end channel.on_request("exit-status") do |ch,data| exit_code = data.read_long if exit_code != 0 @@ -139,18 +139,18 @@ if instance @ssh = $api.ssh(role, environment, instance) else nodes = $api.getenvroles(role, environment) if first? || nodes.size == 1 - puts "No instnace specified, but only one instance in cluster or first forced" + puts "No instance specified, but only one instance in cluster or first forced" @ssh = $api.ssh(role, environment, nodes.first['instance']) else puts "No instance specified, querying list." nodes.each_index do |i| puts "#{i}: #{nodes[i]['instance']}" end - print "Select a node: ".color(:cyan) + print Rainbow("Select a node: ").cyan @ssh = $api.ssh(role, environment, nodes[$stdin.gets.chomp.to_i]['instance']) end end File.open('/tmp/gtkey', 'w') {|f| f.write(@ssh['key'])} File.chmod(0600, '/tmp/gtkey') @@ -313,22 +313,22 @@ option [ "-s", "--service"], "SERVICE", "Name of the service, omit to show all" def execute if service.nil? keyhash = $api.svcapi_showkeys(:all) keyhash.keys.each do |service| - puts service.color(:green) + puts Rainbow(service).green keyhash[service].keys.each do |state| - puts " ┖ #{state}".color(:cyan) + puts Rainbow(" ┖ #{state}").cyan keyhash[service][state].each do |key| puts " - #{key}" end end end else keyhash = $api.svcapi_showkeys(service) - puts service.color(:green) + puts Rainbow(service).green keyhash.keys.each do |state| - puts " ┖ #{state}".color(:cyan) + puts Rainbow(" ┖ #{state}").cyan keyhash[state].each do |key| puts " - #{key}" end end end