process_settings 0.11.0 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -5
- data/bin/combine_process_settings +22 -0
- data/lib/process_settings/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3825ac379576930a892de053c60a8a5ea108cf18ca231c36afb74d29e023e873
|
4
|
+
data.tar.gz: 9e06cf4895b856fa801f868a5e600023ab27cbbee2a730f8d2c776de6b14ea62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38a7e49c5782b72c334f9029388ffb06aa94cf3fd7dffc73a7750f102445c21fb8788df60d37af53e68f1e58956ef429cd7a3a442e117095eea74bd89bc2340d
|
7
|
+
data.tar.gz: ac57357cd9873b9a8f42b98046b5ebd942e9058083d0b71711879ea73c917671967ffbc34aa3be77dc3b8b844d6f966a3b13c88860ccc2a7e8a659f1eecad117
|
data/README.md
CHANGED
@@ -126,16 +126,20 @@ The simplest approach--as shown above--is to read the latest settings at any tim
|
|
126
126
|
http_version = ProcessSettings['frontend', 'http_version']
|
127
127
|
```
|
128
128
|
|
129
|
-
#### Register
|
130
|
-
Alternatively, if you need to execute
|
129
|
+
#### Register a `when_updated` Callback
|
130
|
+
Alternatively, if you need to execute initially and whenever the value is updated, register a callback with `ProcessSettings.instance#when_updated`:
|
131
131
|
```
|
132
|
-
ProcessSettings.instance.
|
132
|
+
ProcessSettings.instance.when_updated do
|
133
133
|
logger.level = ProcessSettings['frontend', 'log_level']
|
134
134
|
end
|
135
135
|
```
|
136
|
-
|
136
|
+
By default, the `when_updated` block is called initially when registered. We've found this to be convenient in most cases; it can be disabled by passing `initial_update: false`, in which case the block will be called 0 or more times in the future, when any of the process settings for this process change.
|
137
|
+
|
138
|
+
`when_updated` is idempotent.
|
137
139
|
|
138
|
-
|
140
|
+
In case you need to cancel the callback later, `when_updated` returns a handle (the block itself) which can later be passed into `cancel_when_updated`.
|
141
|
+
|
142
|
+
Note that all callbacks run sequentially on the shared change monitoring thread, so please be considerate!
|
139
143
|
|
140
144
|
## Targeting
|
141
145
|
Each settings YAML file has an optional `target` key at the top level, next to `settings`.
|
@@ -75,12 +75,34 @@ def add_warning_comment(yaml, root_folder, program_name, settings_folder)
|
|
75
75
|
yaml.sub("\n", "\n" + warning_comment)
|
76
76
|
end
|
77
77
|
|
78
|
+
MINIMUM_LIBYAML_VERSION = '0.2.5' # So that null (nil) values don't have trailing spaces.
|
79
|
+
|
80
|
+
def check_libyaml_version
|
81
|
+
if Gem::Version.new(Psych::LIBYAML_VERSION) < Gem::Version.new(MINIMUM_LIBYAML_VERSION)
|
82
|
+
warn <<~EOS
|
83
|
+
|
84
|
+
#{PROGRAM_NAME} error: libyaml version #{Psych::LIBYAML_VERSION} must be at least #{MINIMUM_LIBYAML_VERSION}. Try:
|
85
|
+
|
86
|
+
brew update && brew upgrade libyaml
|
87
|
+
|
88
|
+
You may also need:
|
89
|
+
|
90
|
+
gem install psych -- --enable-bundled-libyaml
|
91
|
+
EOS
|
92
|
+
|
93
|
+
exit(1)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
|
78
98
|
#
|
79
99
|
# main
|
80
100
|
#
|
81
101
|
|
82
102
|
options = parse_options(ARGV.dup)
|
83
103
|
|
104
|
+
check_libyaml_version
|
105
|
+
|
84
106
|
combined_settings = read_and_combine_settings(Pathname.new(options.root_folder) + SETTINGS_FOLDER)
|
85
107
|
|
86
108
|
version_number = options.version || default_version_number(options.initial_filename)
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: process_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-09-19 00:00:00.000000000 Z
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '3.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: psych
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.2'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.2'
|
61
75
|
description: Targeted process settings that dynamically reload without restarting
|
62
76
|
the process
|
63
77
|
email: development+ps@invoca.com
|
@@ -97,7 +111,7 @@ licenses:
|
|
97
111
|
metadata:
|
98
112
|
source_code_uri: https://github.com/Invoca/process_settings
|
99
113
|
allowed_push_host: https://rubygems.org
|
100
|
-
post_install_message:
|
114
|
+
post_install_message:
|
101
115
|
rdoc_options: []
|
102
116
|
require_paths:
|
103
117
|
- lib
|
@@ -113,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
127
|
version: '0'
|
114
128
|
requirements: []
|
115
129
|
rubygems_version: 3.0.3
|
116
|
-
signing_key:
|
130
|
+
signing_key:
|
117
131
|
specification_version: 4
|
118
132
|
summary: Dynamic process settings
|
119
133
|
test_files: []
|