arkaan 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arkaan/utils.rb +1 -0
- data/lib/arkaan/utils/seeder.rb +25 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fbb8f59c892ce91e7c016d76b3bd36a666a251c
|
4
|
+
data.tar.gz: 1a185db4880c3d0986cd70b462c96e2f7eaf446e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cacca5e1e77eb380d2f8847281524ce5b70f87cd49d98a02dae68d2c8f98f44615157fbc36fb08d4ce7c3d2defed8123d20caadee44ea620c79c71c9c5e4c21
|
7
|
+
data.tar.gz: e181c90141dd6a63d81be1ef2517e7a9f0e3bbdceef64877958a379957fee5a6e182ea630cfcf23c91cdc7f93287cd2ef313f9b48ebefabb1812696d04131555
|
data/lib/arkaan/utils.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Arkaan
|
2
|
+
module Utils
|
3
|
+
# This class loads the necessary data in the database if they don't exist yet.
|
4
|
+
# @author Vincent Courtois <courtois.vincent@outlook.com>
|
5
|
+
class Seeder
|
6
|
+
include Singleton
|
7
|
+
|
8
|
+
# Creates the service if it does not exist, and the instance if it does not exist.
|
9
|
+
# @return [Arkaan::Monitoring::Service] the created, or found, service corresponding to this micro-service.
|
10
|
+
def create_service(key)
|
11
|
+
service = Arkaan::Monitoring::Service.where(key: key).first
|
12
|
+
|
13
|
+
if service.nil?
|
14
|
+
service = Arkaan::Monitoring::Service.create!(key: key, path: "/#{key}", premium: true, active: true)
|
15
|
+
end
|
16
|
+
|
17
|
+
if service.instances.where(url: ENV['SERVICE_URL']).first.nil?
|
18
|
+
Arkaan::Monitoring::Instance.create!(url: ENV['SERVICE_URL'], running: true, service: service, active: true)
|
19
|
+
end
|
20
|
+
|
21
|
+
return service
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arkaan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Courtois
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- lib/arkaan/permissions/right.rb
|
210
210
|
- lib/arkaan/utils.rb
|
211
211
|
- lib/arkaan/utils/controller.rb
|
212
|
+
- lib/arkaan/utils/seeder.rb
|
212
213
|
homepage: https://rubygems.org/gems/arkaan
|
213
214
|
licenses:
|
214
215
|
- MIT
|