Skip to content

Commit

Permalink
(DIO-2700) Vmfloaty should not use the Colorize gem
Browse files Browse the repository at this point in the history
removing cosmetic use of colorize
  • Loading branch information
Samuel Beaulieu committed Feb 16, 2022
1 parent 1b64ce3 commit 6b9b4ea
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion lib/vmfloaty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require 'rubygems'
require 'commander'
require 'colorize'
require 'json'
require 'pp'
require 'uri'
Expand Down
4 changes: 2 additions & 2 deletions lib/vmfloaty/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def self.pretty_print_hosts(verbose, service, hostnames = [], print_to_stderr =
metadata = [host_data['state'], host_data['template'], duration, *tag_pairs]
message = "- #{hostname}.#{host_data['domain']} (#{metadata.join(', ')})".gsub(/^/, ' ' * indent)
if host_data['state'] && host_data['state'] == 'destroyed'
output_target.puts message.colorize(:red)
output_target.puts "- DESTROYED #{hostname}.#{host_data['domain']}".gsub(/^/, ' ' * indent)
else
output_target.puts message
end
Expand Down Expand Up @@ -201,7 +201,7 @@ def self.pretty_print_status(verbose, service)
rescue StandardError => e
FloatyLogger.error "#{name.ljust(width)} #{e.red}"
end
puts message.colorize(status_response['status']['ok'] ? :default : :red)
puts message
when 'NonstandardPooler'
pools = status_response
pools.delete 'ok'
Expand Down
2 changes: 1 addition & 1 deletion lib/vmfloaty/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Vmfloaty
VERSION = '1.5.0'
VERSION = '1.6.0'
end
6 changes: 3 additions & 3 deletions spec/vmfloaty/utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,13 @@ class Service
subject
end

it 'prints in red when destroyed' do
it 'prints DESTROYED and hostname when destroyed' do
fallback = { 'vmpooler_fallback' => 'vmpooler' }
service.config.merge! fallback
response_body_vmpooler[fqdn_hostname]['state'] = 'destroyed'
default_output_second_line_red = " - #{fqdn} (destroyed, #{template}, 7.67/48 hours, user: bob, role: agent)".red
default_output_second_line = " - DESTROYED #{fqdn}"
expect($stdout).to receive(:puts).with(default_output_first_line)
expect($stdout).to receive(:puts).with(default_output_second_line_red)
expect($stdout).to receive(:puts).with(default_output_second_line)

subject
end
Expand Down
1 change: 0 additions & 1 deletion vmfloaty.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Gem::Specification.new do |s|
s.test_files = Dir['spec/**/*']
s.require_path = 'lib'

s.add_dependency 'colorize', '~> 0.8.1'
s.add_dependency 'commander', '>= 4.4.3', '< 4.7.0'
s.add_dependency 'faraday', '~> 1.5', '>= 1.5.1'
end

0 comments on commit 6b9b4ea

Please sign in to comment.