arkaan 0.7.5 → 0.7.6

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: dc727a94560a7d9ab37e10b788a28e322ba0b346
4
- data.tar.gz: 75877dfb1faff014c23f8e3afb828de8edfb071f
3
+ metadata.gz: fd10beb54eb3bf3084e66dd2116638774086a903
4
+ data.tar.gz: 1773ac97cd2237923d42f7e71cad4697b0fb54fa
5
5
  SHA512:
6
- metadata.gz: 0636b1c58ce076e7594afc504232f7014e3a17021b337c96dd36a74702c98a45618516b3df20dd5ab7f21acc9d74e27eb1562c45272dd76f4951b871fe6f870c
7
- data.tar.gz: 991da6be9cd21c206ab54c320eddb089be6a62e0c6eb84de842c6a98402fab5340e017c42fc9f6731dc43c251409e8215cd9ae228f002a675314013be506c135
6
+ metadata.gz: e06f03c1e39e17a7fcac7d14c52408403bcda6bf178e72ce8b197e2f2a81064d25a435442e3419285543b809cb4603b4ab5344d0f260e0d04f3c1c9281a2e89d
7
+ data.tar.gz: d02e70b47ac48b7b8dde712027d889aaafbaced9e6a9e60f3278ad1121c0099f5880db4601ca773d847ac5733b549e0562d2526f753b9df0f157aacf83637803
@@ -11,10 +11,14 @@ module Arkaan
11
11
  # @!attribute [r] location
12
12
  # @return [String] the path to the file loading the whole application, used to deduce the loading paths.
13
13
  attr_reader :location
14
+ # @!attribute [r] name
15
+ # @return [String] the name of the service, used later to instantiate it when the mongoid configuration is fully loaded.
16
+ attr_reader :name
14
17
 
15
18
  def initialize
16
19
  @location = false
17
20
  @service = false
21
+ @name = false
18
22
  end
19
23
 
20
24
  # Determines if the application can be loaded (all the parameters have been correctly set)
@@ -29,19 +33,11 @@ module Arkaan
29
33
  return service ? service.path : false
30
34
  end
31
35
 
32
- # Getter for the name of the service.
33
- # @return [String, Boolean] the name of the service as it is registered in the database, or FALSE if it's not set already.
34
- def name
35
- return service ? service.key : false
36
- end
37
-
38
36
  # Look for the service and sets it if it's found in the database, or set it to nil if not found.
39
37
  # @param [String] service_name - the name of the service to look for in the database.
40
38
  # @return [Arkaan::utils::MicroService] the instance of the micro-service to chain other calls.
41
39
  def register_as(service_name)
42
- @service = Arkaan::Monitoring::Service.where(key: service_name).first
43
- register_service if @service.nil?
44
- register_instance
40
+ @name = service_name
45
41
  return self
46
42
  end
47
43
 
@@ -81,10 +77,15 @@ module Arkaan
81
77
  end
82
78
 
83
79
  def load_application(test_mode: false)
84
- @location = File.join(location, '..')
85
- load_mongoid_configuration
86
- load_standard_files
87
- load_test_files if test_mode
80
+ if !!(name && service && location)
81
+ @location = File.join(location, '..') if test_mode
82
+ load_mongoid_configuration
83
+ @service = Arkaan::Monitoring::Service.where(key: service_name).first
84
+ register_service if @service.nil?
85
+ register_instance
86
+ load_standard_files
87
+ load_test_files if test_mode
88
+ end
88
89
  return self
89
90
  end
90
91
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkaan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Courtois