Module: Boom::Remote

Extended by:
Remote
Includes:
Color, Output
Included in:
Remote
Defined in:
lib/kaboom/remote.rb

Constant Summary

Constants included from Color

Color::CODES

Instance Method Summary collapse

Methods included from Color

#colorize, included

Methods included from Output

#output

Instance Method Details

#allowed?(storage) ⇒ Boolean

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

Returns:

  • (Boolean)


13
14
15
16
17
18
19
# File 'lib/kaboom/remote.rb', line 13

def allowed? storage
  return true if Boom.local?
  return true if allowed_storage_types.include? storage.class

  output error_message storage
  false
end

#allowed_storage_typesObject



6
7
8
# File 'lib/kaboom/remote.rb', line 6

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

#error_message(storage) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/kaboom/remote.rb', line 21

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