process_settings 0.5.3 → 0.5.4.pre.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7409eca6baf538f5bdc5a2ce765f65ec9d6e735450fa6726471fe230a4e849cd
4
- data.tar.gz: 26dfed2a390ad11cd062d0821d0017259a71dece1046d49105c73fd82b7af880
3
+ metadata.gz: c51c6fd16737845ed2ff8ab28b127d7e0a58b2a99926f47990adda952ca84db8
4
+ data.tar.gz: a4a2f86fd244320929523e849c15c3737d344aa34cb8288c81806f93b3844da1
5
5
  SHA512:
6
- metadata.gz: '093e4c53cc9af8d609d4906526454cc1fd23e0a8995af7188a59b1d739c3860d7be289adbd885949113eb05ef83fbb40956bf3c6bf33f6df501651717c19e911'
7
- data.tar.gz: c31f991c2b2fd72dbef879b8c08c3dc2f722e7cf4ec83c58a46491fd8480a05a38c9089f39ff72a84db8a9c72aeeb907f4a587a6f118e5d7ec32cd48bf4bac0c
6
+ metadata.gz: d454ebe1d871c50d8d8d545a12ee958f2102d91c837738cda2ad9156450842a77ac86eca7c0a9b0bec5bf248081c488440f4dc082d651d438da696c7ec30d32f
7
+ data.tar.gz: 0e6bc0976b16124da1361900354fe27ad7e54564a8419050f92670cc4df16f0e98f8bb0b8fbddaa43d3687818fa306ba8c31146de3c690f08663e58deab01d20
@@ -21,13 +21,22 @@ module ProcessSettings
21
21
  @on_change_callbacks = []
22
22
  @static_context = {}
23
23
 
24
+ start
25
+ end
26
+
27
+ # starts listening for changes
28
+ # Note: This method creates a new thread that will be monitoring for changes
29
+ # do to the nature of how the Listen gem works, there is no record of
30
+ # existing threads, calling this mutliple times will result in spinning off
31
+ # multiple listen threads and will have unknow effects
32
+ def start
33
+ path = File.dirname(@file_path)
34
+
24
35
  # to eliminate any race condition:
25
36
  # 1. set up file watcher
26
37
  # 2. start it (this should trigger if any changes have been made since (1))
27
38
  # 3. load the file
28
39
 
29
- path = File.dirname(@file_path)
30
-
31
40
  @listener = file_change_notifier.to(path) do |modified, added, _removed|
32
41
  if modified.include?(@file_path) || added.include?(@file_path)
33
42
  @logger.info("ProcessSettings::Monitor file #{@file_path} changed. Reloading.")
@@ -42,13 +51,12 @@ module ProcessSettings
42
51
  end
43
52
 
44
53
  load_untargeted_settings
45
-
46
54
  load_statically_targeted_settings
47
55
  end
48
56
 
49
57
  # stops listening for changes
50
58
  def stop
51
- @listener.stop
59
+ @listener&.stop
52
60
  end
53
61
 
54
62
  # Registers the given callback block to be called when settings change.
@@ -101,6 +109,10 @@ module ProcessSettings
101
109
 
102
110
  private
103
111
 
112
+ def listener
113
+
114
+ end
115
+
104
116
  # Loads the most recent settings from disk
105
117
  def load_untargeted_settings
106
118
  new_untargeted_settings = load_file(file_path)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProcessSettings
4
- VERSION = '0.5.3'
4
+ VERSION = '0.5.4.pre.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca
@@ -98,11 +98,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - ">"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 1.3.1
104
104
  requirements: []
105
- rubygems_version: 3.0.1
105
+ rubygems_version: 3.0.3
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Dynamic process settings