Sha256: 4963daf66c2cc81f9fef5b03dd0b1a531ebdada91b7a253d2d224e9973200d0c

Contents?: true

Size: 865 Bytes

Versions: 1

Compression:

Stored size: 865 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') if @BOOT_OPTIONS[risky_option]
      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

1 entries across 1 versions & 1 rubygems

Version Path
flare-up-0.6 lib/flare_up/emitter.rb