process_settings 0.5.4.pre.1 → 0.5.4
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 +10 -16
- 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: 0d3f11e7b35109103df7bcd4cc593f2589948df29edfe1eb8fabf332b6676717
|
4
|
+
data.tar.gz: f71a2c9d8c8b3c70e89b0ab1497d6331aaa75961f8283cb01779f2939b7cf4e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 745b8414363c0f9464b1e8a5a1025fa4808b26abcc143f28d269ae45edecb2e1671ea468d8cb64d3a696644292da8d9d720b5eda8700479a74bdff04805f28fa
|
7
|
+
data.tar.gz: d154960aa9a1f3a5197b5cca0bb7becb59669cd1b1e1cd6419395bed83a885b7f984e5f842cf502a60454f5a93cb630ba28e652b4d1d5ce98c533202d223f3dc
|
@@ -20,23 +20,16 @@ module ProcessSettings
|
|
20
20
|
@logger = logger
|
21
21
|
@on_change_callbacks = []
|
22
22
|
@static_context = {}
|
23
|
-
|
24
|
-
|
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)
|
23
|
+
@last_statically_targetted_settings = nil
|
24
|
+
@last_untargetted_settings = nil
|
34
25
|
|
35
26
|
# to eliminate any race condition:
|
36
27
|
# 1. set up file watcher
|
37
28
|
# 2. start it (this should trigger if any changes have been made since (1))
|
38
29
|
# 3. load the file
|
39
30
|
|
31
|
+
path = File.dirname(@file_path)
|
32
|
+
|
40
33
|
@listener = file_change_notifier.to(path) do |modified, added, _removed|
|
41
34
|
if modified.include?(@file_path) || added.include?(@file_path)
|
42
35
|
@logger.info("ProcessSettings::Monitor file #{@file_path} changed. Reloading.")
|
@@ -51,14 +44,19 @@ module ProcessSettings
|
|
51
44
|
end
|
52
45
|
|
53
46
|
load_untargeted_settings
|
47
|
+
|
54
48
|
load_statically_targeted_settings
|
55
49
|
end
|
56
50
|
|
57
51
|
# stops listening for changes
|
58
52
|
def stop
|
59
|
-
@listener
|
53
|
+
@listener.stop
|
60
54
|
end
|
61
55
|
|
56
|
+
# TODO:
|
57
|
+
# 1. rename this to `when_updated` and clone that interface from InvocaCluster
|
58
|
+
# 2. since the callback yields self, support Instance#[]; have ProcessSettings.[] delegate there.
|
59
|
+
|
62
60
|
# Registers the given callback block to be called when settings change.
|
63
61
|
# These are run using the shared thread that monitors for changes so be courteous and don't monopolize it!
|
64
62
|
def on_change(&callback)
|
@@ -109,10 +107,6 @@ module ProcessSettings
|
|
109
107
|
|
110
108
|
private
|
111
109
|
|
112
|
-
def listener
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
110
|
# Loads the most recent settings from disk
|
117
111
|
def load_untargeted_settings
|
118
112
|
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
|
4
|
+
version: 0.5.4
|
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: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.0.
|
105
|
+
rubygems_version: 3.0.1
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Dynamic process settings
|