Sha256: 05dc5dc16a48e59b57ea862da143768e3fbf769ed6a9ed44c83ef78fc8d9ce62

Contents?: true

Size: 834 Bytes

Versions: 2

Compression:

Stored size: 834 Bytes

Contents

module FlareUp

  class Emitter

    RISKY_OPTIONS = [
      :aws_access_key,
      :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']
    end

    # TODO: How do we test this?
    def self.info(message)
      $stdout.puts sanitize(message) unless ENV['TESTING']
    end

    # TODO: How do we test this?
    def self.sanitize(message)
      RISKY_OPTIONS.each do |risky_option|
        message.gsub!(@BOOT_OPTIONS[risky_option], 'REDACTED')
      end
      message.gsub!(/\e\[(\d+)(;\d+)*m/, '') unless @BOOT_OPTIONS[:colorize_output]
      message
    end

    # TODO: How do we test this?
    def self.store_options(options)
      @BOOT_OPTIONS = options
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flare-up-0.5 lib/flare_up/emitter.rb
flare-up-0.4 lib/flare_up/emitter.rb