process_settings 0.19.4 → 0.20.0.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: e070efd3c6c720c5c32a039cd1997fceb2f527daefaa7aea4fb4116a542f3400
4
- data.tar.gz: c2ed0b9dc4bb85f093df508580f2f98744837120f4bcdcc6e6f415349f24c10a
3
+ metadata.gz: b1badef60c71146241a061aebd1a5911d0780cd1eb2aa0b776f931eaab3d9b7d
4
+ data.tar.gz: 6b9b1d1b7fcb775b316fb8440e9e2786e9a597314fd4b25214620d594e862fbe
5
5
  SHA512:
6
- metadata.gz: 81694c41b4686cb3e533827337e0f344d2372d8396fcc95ed01ea4a160a9fd7baaf8487eb22dffc5859910ead7740fef6badf4ecb0d553192d69b6c78ceacc88
7
- data.tar.gz: 693a1121602581e6afd0d951f83d31b3ea8016152655afa3a4cac9b957ad0df187b54adee327c3a59964b939cbea1a74f403ba2ac28ac326f1d638832b7304bd
6
+ metadata.gz: 92c9644c27ec9d38d1e9aeaf39dbaa8a8b20ea3bfd5c7f84e206db81b1b5bdc344e0effe8cf710b6971535b826b2cd98db9e2c3f58dc6e9cf38f3941e65d41d9
7
+ data.tar.gz: f29c738cc2f48ae0961e7794968c68b04f450cf1310139ebf76b933c0f25d205e95d7830f84370d833aa89586e659a64c31b39702670d90854327bd525544a18
data/README.md CHANGED
@@ -164,6 +164,14 @@ target:
164
164
  ```
165
165
  This will be applied in any process that has (`service_name == "frontend"` OR `service_name == "auth"`) AND `datacenter == "AWS-US-EAST-1"`.
166
166
 
167
+ ### Regexp Targeting
168
+ To provide a regular expression for targeting, use the ruby regex keyword `!ruby/regexp` followed by your regular expression. For example:
169
+ ```
170
+ target:
171
+ service_name: !ruby/regexp /frontend-\d/
172
+ ```
173
+ This will be applied in any process that has `service_name` that has `frontend-` followed with a number. As an example this will match `"frontend-1"`
174
+
167
175
  ### Precedence
168
176
  The settings YAML files are always combined in alphabetical order by file path. Later settings take precedence over the earlier ones.
169
177
 
@@ -14,7 +14,7 @@ module ProcessSettings
14
14
 
15
15
  def check
16
16
  if version_from_memory != version_from_disk && (Time.now - mtime_from_disk) > MAX_MTIME_DIFFERENCE
17
- raise OutOfSync.new("ProcessSettings versions are out of sync!\n Version from Disk: #{version_from_disk}\n Version from Memory: #{version_from_memory}\n mtime of file: #{mtime_from_disk}")
17
+ raise ProcessSettings::OutOfSync.new("ProcessSettings versions are out of sync!\n Version from Disk: #{version_from_disk}\n Version from Memory: #{version_from_memory}\n mtime of file: #{mtime_from_disk}")
18
18
  end
19
19
  end
20
20
 
@@ -90,6 +90,8 @@ module ProcessSettings
90
90
  end
91
91
  when true, false
92
92
  target_value
93
+ when Regexp
94
+ context_hash.match?(target_value)
93
95
  else
94
96
  target_value == context_hash
95
97
  end
@@ -73,7 +73,7 @@ module ProcessSettings
73
73
  end
74
74
 
75
75
  def from_file(file_path, only_meta: false)
76
- json_doc = Psych.load_file(file_path)
76
+ json_doc = Psych.safe_load_file(file_path, permitted_classes: [Regexp])
77
77
  from_array(json_doc, only_meta: only_meta)
78
78
  end
79
79
  end
@@ -60,18 +60,12 @@ module ProcessSettings
60
60
 
61
61
  class << self
62
62
  def included(including_klass)
63
- # Prepend the teardown method in case the test class has already defined one.
64
- including_klass.prepend(TeardownProcessSettings)
63
+ including_klass.define_method(:teardown) do
64
+ ProcessSettings.instance = initial_instance
65
+ end
65
66
  end
66
67
  end
67
68
  end
68
-
69
- module TeardownProcessSettings
70
- def teardown
71
- ProcessSettings.instance = initial_instance
72
- super
73
- end
74
- end
75
69
  end
76
70
 
77
71
  Helpers = RSpec::Helpers # for backward-compatibility
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProcessSettings
4
- VERSION = '0.19.4'
4
+ VERSION = '0.20.0.pre.1'
5
5
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'active_support'
4
4
  require 'active_support/deprecation'
5
- require 'active_support/core_ext'
6
5
 
7
6
  module ProcessSettings
8
7
  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.19.4
4
+ version: 0.20.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '4.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '7'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0'
29
+ version: '4.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '7'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: json
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -56,14 +62,14 @@ dependencies:
56
62
  name: psych
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - ">="
65
+ - - "~>"
60
66
  - !ruby/object:Gem::Version
61
67
  version: '3.2'
62
68
  type: :runtime
63
69
  prerelease: false
64
70
  version_requirements: !ruby/object:Gem::Requirement
65
71
  requirements:
66
- - - ">="
72
+ - - "~>"
67
73
  - !ruby/object:Gem::Version
68
74
  version: '3.2'
69
75
  description: Targeted process settings that dynamically reload without restarting
@@ -117,11 +123,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
123
  version: '0'
118
124
  required_rubygems_version: !ruby/object:Gem::Requirement
119
125
  requirements:
120
- - - ">="
126
+ - - ">"
121
127
  - !ruby/object:Gem::Version
122
- version: '0'
128
+ version: 1.3.1
123
129
  requirements: []
124
- rubygems_version: 3.3.26
130
+ rubygems_version: 3.0.3
125
131
  signing_key:
126
132
  specification_version: 4
127
133
  summary: Dynamic process settings