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 +4 -4
- data/lib/process_settings/monitor.rb +16 -4
- data/lib/process_settings/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c51c6fd16737845ed2ff8ab28b127d7e0a58b2a99926f47990adda952ca84db8
|
4
|
+
data.tar.gz: a4a2f86fd244320929523e849c15c3737d344aa34cb8288c81806f93b3844da1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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)
|
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.
|
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:
|
103
|
+
version: 1.3.1
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.0.
|
105
|
+
rubygems_version: 3.0.3
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Dynamic process settings
|