Class: ForestLiana::Bootstraper

Inherits:
Object
  • Object
show all
Defined in:
lib/forest_liana/bootstraper.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Bootstraper

Returns a new instance of Bootstraper.



4
5
6
7
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
# File 'lib/forest_liana/bootstraper.rb', line 4

def initialize(app)
  @app = app

  @integration_stripe_valid = false
  @integration_intercom_valid = false

  @logger = Logger.new(STDOUT)

  @@logger_colors = {
    DEBUG: 34,
    WARN: 33,
    ERROR: 31,
    INFO: 37
  }

  @logger.formatter = proc do |severity, datetime, progname, message|
    displayed_message = "[#{datetime.to_s(:db)}] Forest 🌳🌳🌳  #{message}\n"
    "\e[#{@@logger_colors[severity.to_sym]}m#{displayed_message}\033[0m"
  end

  if ForestLiana.jwt_signing_key
     @logger.warn "DEPRECATION WARNING: the use of \
ForestLiana.jwt_signing_key (config/initializers/forest_liana.rb) is \
deprecated. Use ForestLiana.secret_key and ForestLiana.auth_key instead. \
More info at: https://github.com/ForestAdmin/forest-rails/releases/tag/1.2.0"
    ForestLiana.secret_key = ForestLiana.jwt_signing_key
    ForestLiana.auth_key = ForestLiana.jwt_signing_key
  end
end

Instance Method Details

#performObject



34
35
36
37
38
39
40
41
42
43
# File 'lib/forest_liana/bootstraper.rb', line 34

def perform
  check_integrations_setup
  create_serializers

  if ForestLiana.secret_key
    create_apimap
    require_lib_forest_liana
    send_apimap
  end
end