forest_liana 2.9.1 → 2.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 313683d281e45e8fe815d7f11e9818c77ef4a78b
4
- data.tar.gz: 6aa4e20522c3d2c1e4f24c5e01ca44df78bad6b3
3
+ metadata.gz: aec5c04b564d1ea85d2af7b7e097a27148996842
4
+ data.tar.gz: 012fff66c5d6457601ba654b6eff4e4d07652022
5
5
  SHA512:
6
- metadata.gz: 8e5e7778f28f88478ea187b53e7fc22c43742c774ff9326ed620090e00951ae647651d9f3b76c77e20e7e6a1a36417faed3306ebcbcfa688774d7617fb4bfcc4
7
- data.tar.gz: 175a4247a264aa93be16477c8f452da2fc977c5e5c3dd42bfc1f20c2995ba9fb909fbf8b77adff94568db08b90190a9233e51415a56869915b1b3d0b67ad30a2
6
+ metadata.gz: 19218a4d18faff38146343fae86be93737b8c6caf716f779b7772b1c6030a101aebe82b29b5029f65600854f75c356fbdc0d48e223bb5dfce790d2057e3f559a
7
+ data.tar.gz: 5b296b887174352eeb49857b1e6c8f34789d4f951e12d9370616417e79d7df21ec2487fd7301c8d12d079f2fdc58a958eeaa5d35964d752361f5c58abb9f260a
@@ -36,6 +36,17 @@ module ForestLiana
36
36
  File.basename($0) == 'rake'
37
37
  end
38
38
 
39
+ def database_available?
40
+ database_available = true
41
+ begin
42
+ ActiveRecord::Base.connection_pool.with_connection { |connection| connection.active? }
43
+ rescue => error
44
+ database_available = false
45
+ FOREST_LOGGER.error "No Apimap sent to Forest servers, it seems that the database is not accessible:\n#{error}"
46
+ end
47
+ database_available
48
+ end
49
+
39
50
  error = configure_forest_cors unless ENV['FOREST_CORS_DEACTIVATED']
40
51
 
41
52
  config.after_initialize do |app|
@@ -47,8 +58,10 @@ module ForestLiana
47
58
 
48
59
  app.eager_load!
49
60
 
50
- # NOTICE: Do not run the code below on rails g forest_liana:install.
51
- Bootstraper.new(app).perform if ForestLiana.env_secret || ForestLiana.secret_key
61
+ if database_available?
62
+ # NOTICE: Do not run the code below on rails g forest_liana:install.
63
+ Bootstraper.new(app).perform if ForestLiana.env_secret || ForestLiana.secret_key
64
+ end
52
65
  end
53
66
  end
54
67
  end
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "2.9.1"
2
+ VERSION = "2.9.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 2.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-03 00:00:00.000000000 Z
11
+ date: 2018-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails