Class: ForestLiana::Bootstrapper

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

Constant Summary collapse

SCHEMA_FILENAME =
File.join(Dir.pwd, '.forestadmin-schema.json')

Instance Method Summary collapse

Constructor Details

#initializeBootstrapper

Returns a new instance of Bootstrapper.



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
# File 'lib/forest_liana/bootstrapper.rb', line 8

def initialize
  @integration_stripe_valid = false
  @integration_intercom_valid = false

  if ForestLiana.secret_key && ForestLiana.auth_key
    FOREST_LOGGER.warn "DEPRECATION WARNING: The use of " \
      "ForestLiana.secret_key and ForestLiana.auth_key " \
      "(config/initializers/forest_liana.rb) is deprecated. Please use " \
      "ForestLiana.env_secret and ForestLiana.auth_secret instead."
    ForestLiana.env_secret = ForestLiana.secret_key
    ForestLiana.auth_secret = ForestLiana.auth_key
  end

  unless Rails.application.config.action_controller.perform_caching || Rails.env.test? || ForestLiana.forest_client_id
    FOREST_LOGGER.error "You need to enable caching on your environment to use Forest Admin.\n" \
      "For a development environment, run: `rails dev:cache`\n" \
      "Or setup a static forest_client_id by following this part of the documentation:\n" \
      "https://docs.forestadmin.com/documentation/how-tos/maintain/upgrade-notes-rails/upgrade-to-v6#setup-a-static-clientid"
  end

  fetch_models
  check_integrations_setup
  namespace_duplicated_models
  create_factories

  generate_apimap if ForestLiana.env_secret
end

Instance Method Details

#display_apimapObject



40
41
42
43
44
# File 'lib/forest_liana/bootstrapper.rb', line 40

def display_apimap
  if ForestLiana.env_secret
    puts " = Current Forest Apimap:\n#{JSON.pretty_generate(get_apimap_serialized)}"
  end
end

#synchronize(with_feedback = false) ⇒ Object



36
37
38
# File 'lib/forest_liana/bootstrapper.rb', line 36

def synchronize(with_feedback=false)
  send_apimap(with_feedback) if ForestLiana.env_secret
end