Module: Bushido

Defined in:
lib/bushido.rb

Defined Under Namespace

Modules: App, Command, Data

Class Method Summary collapse

Class Method Details

.set_env(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/bushido.rb', line 8

def self.set_env(options = {})
  options = {
    :last_command_successful  => true,
    :domains                  => [],
    :subdomain                => 'san_francisco',
    :claimed                  => false,
    :last_event               => {
      :category   => 'user',
      :name       => 'create',
      :data       => { 'email' => '[email protected]', 'id' => 4242 }
    },
    :events                   => {
      'app.claimed' => {
        'data' => {
          'email' => '[email protected]'
        }
      }
    }
  }.merge(options)

  @@domains = options.delete(:domains)
  @@subdomain = options.delete(:subdomain)
  @@last_command_successful = options.delete(:last_command_successful)
  @@claimed = options.delete(:claimed)

  ENV['BUSHIDO_CLAIMED'] = @@claimed.to_s

  @@last_event = OpenStruct.new(options.delete(:last_event))

  @@events = options.delete(:events)

  options.each { |k, v| ENV[k] = v }
end