lib/flare_up/emitter.rb in flare-up-0.7 vs lib/flare_up/emitter.rb in flare-up-0.8
- old
+ new
@@ -7,42 +7,43 @@
:aws_secret_key,
:redshift_username,
:redshift_password
]
- # TODO: How do we test this?
def self.error(message)
- $stderr.puts sanitize("\x1b[31m#{message}") unless ENV['TESTING']
+ err("\x1b[31m#{message}")
end
- # TODO: How do we test this?
def self.success(message)
- $stdout.puts sanitize("\x1b[32m#{message}") unless ENV['TESTING']
+ out("\x1b[32m#{message}")
end
- # TODO: How do we test this?
def self.warn(message)
- $stdout.puts sanitize("\x1b[33m#{message}") unless ENV['TESTING']
+ err("\x1b[33m#{message}")
end
- # TODO: How do we test this?
def self.info(message)
- $stdout.puts sanitize(message) unless ENV['TESTING']
+ out(message)
end
- # TODO: How do we test this?
+ def self.out(message)
+ $stderr.puts(sanitize(message)) unless ENV['TESTING']
+ end
+ private_class_method :out
+
+ def self.err(message)
+ $stdout.puts(sanitize(message)) unless ENV['TESTING']
+ end
+ private_class_method :err
+
def self.sanitize(message)
RISKY_OPTIONS.each do |risky_option|
- message.gsub!(@BOOT_OPTIONS[risky_option], 'REDACTED') if @BOOT_OPTIONS[risky_option]
+ message.gsub!(OptionStore.get(risky_option), 'REDACTED') if OptionStore.get(risky_option)
end
- message.gsub!(/\e\[(\d+)(;\d+)*m/, '') unless @BOOT_OPTIONS[:colorize_output]
+ message.gsub!(/\e\[(\d+)(;\d+)*m/, '') unless OptionStore.get(:colorize_output)
message
end
-
- # TODO: How do we test this?
- def self.store_options(options)
- @BOOT_OPTIONS = options
- end
+ private_class_method :sanitize
end
end
\ No newline at end of file