Sha256: 8d83d1ac4c31c631534f2cf990e4141672a4b5fb93a11aae189b42f16d284bb7

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

module Boom
  module Remote
    include Output
    include Color

    def allowed_storage_types
      [Boom::Storage::Gist, Boom::Storage::Mongodb, Boom::Storage::Redis]
    end

    # Returns true if the user is using a sensible seeming storage backend
    # Params storage, the current storage instance
    # else exits with a warning if not
    def allowed? storage
      return true if Boom.local?
      return true if allowed_storage_types.include? storage.class

      output error_message storage
      false
    end

    def error_message storage
      %(
        #{red("<<----BOOOOOM!!!----->>>> ")} (as in explosion, rather than fast)
        You probably don't want to use the #{storage.class} storage whilst
        using boom in remote mode. Your config looks akin to:

        #{red File.read Boom.config.file}

        but things might be better with something a little more like:

        #{cyan Boom::Storage::Redis.sample_config}

        or

        #{cyan Boom::Storage::Mongodb.sample_config}

        Now head yourself on over to #{yellow Boom.config.file}
        and edit some goodness into it

        Meanwhile, please enjoy your ordinary boom service:
        ___________________________________________________

      ).gsub(/^ {8}/, '')
    end
    extend self
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kaboom-0.3.3 lib/kaboom/remote.rb
kaboom-0.3.2 lib/kaboom/remote.rb
kaboom-0.3.1 lib/kaboom/remote.rb