process_settings 0.10.1 → 0.10.6.pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/diff_process_settings +10 -6
- data/lib/process_settings.rb +2 -9
- data/lib/process_settings/abstract_monitor.rb +1 -1
- data/lib/process_settings/monitor.rb +7 -3
- data/lib/process_settings/target.rb +1 -1
- data/lib/process_settings/testing/monitor.rb +1 -0
- data/lib/process_settings/testing/monitor_stub.rb +9 -1
- data/lib/process_settings/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f84a7b291c62e80a70aa63c5cd9fef3da8a479023b97b2b48876440e2ad3f78
|
4
|
+
data.tar.gz: ed14cf885d3c1e8f43aba4efd90b84aae91fba2e7d9aa0c044d3d87d60453ed0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db0012a991f04fe39c830010e5d5bb189ab0d4acd7211e04b3c606aa4267297b439ef42837238366a13798bef80a3ba078c192494b2d135b29b5ae80998e16ab
|
7
|
+
data.tar.gz: 571dd8f98045dd11f43dc4d349d0b3b0e094de80deb304a3a52905c6659e8643f6adf9cc31ae4474bdd55b8530d9698fcaaa940e1d4a21c84461686bdd32b8e0
|
data/bin/diff_process_settings
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
require 'fileutils'
|
8
8
|
require 'optparse'
|
9
9
|
require 'ostruct'
|
10
|
+
require 'tempfile'
|
10
11
|
|
11
12
|
PROGRAM_NAME = File.basename($PROGRAM_NAME)
|
12
13
|
|
@@ -41,19 +42,22 @@ input_files =
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
44
|
-
|
45
|
+
tempfile_a = Tempfile.new(['combined_process_settings', '.yml'], 'tmp').path
|
46
|
+
tempfile_b = Tempfile.new(['combined_process_settings', '.yml'], 'tmp').path
|
47
|
+
|
48
|
+
system("rm -f #{tempfile_a} #{tempfile_b}")
|
45
49
|
|
46
50
|
# remove the meta-data from the end
|
47
|
-
system("sed '/^- meta:$/,$d' #{input_files[0]} >
|
48
|
-
system("sed '/^- meta:$/,$d' #{input_files[1]} >
|
51
|
+
system("sed '/^- meta:$/,$d' #{input_files[0]} > #{tempfile_a}")
|
52
|
+
system("sed '/^- meta:$/,$d' #{input_files[1]} > #{tempfile_b}")
|
49
53
|
|
50
54
|
if options.silent
|
51
|
-
system("cmp --silent
|
55
|
+
system("cmp --silent #{tempfile_a} #{tempfile_b}")
|
52
56
|
else
|
53
|
-
system("diff -c
|
57
|
+
system("diff -c #{tempfile_a} #{tempfile_b} | sed '1,3d'")
|
54
58
|
end
|
55
59
|
exit_code = $?.exitstatus
|
56
60
|
|
57
|
-
system("rm -f
|
61
|
+
system("rm -f #{tempfile_a} #{tempfile_b}")
|
58
62
|
|
59
63
|
exit(exit_code)
|
data/lib/process_settings.rb
CHANGED
@@ -22,14 +22,14 @@ module ProcessSettings
|
|
22
22
|
raise ArgumentError, "Invalid monitor of type #{monitor.class.name} provided. Must be of type ProcessSettings::AbstractMonitor"
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
Monitor.instance = monitor
|
26
26
|
end
|
27
27
|
|
28
28
|
# Getter method for retrieving the current monitor instance being used by ProcessSettings
|
29
29
|
#
|
30
30
|
# @return [ProcessSettings::AbstractMonitor]
|
31
31
|
def instance
|
32
|
-
|
32
|
+
Monitor.instance
|
33
33
|
end
|
34
34
|
|
35
35
|
# This is the main entry point for looking up settings in the process.
|
@@ -56,12 +56,5 @@ module ProcessSettings
|
|
56
56
|
def [](*path, dynamic_context: {}, required: true)
|
57
57
|
instance[*path, dynamic_context: dynamic_context, required: required]
|
58
58
|
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def lazy_create_instance
|
63
|
-
ActiveSupport::Deprecation.warn("lazy creation of Monitor instance is deprecated and will be removed from ProcessSettings 1.0")
|
64
|
-
Monitor.instance
|
65
|
-
end
|
66
59
|
end
|
67
60
|
end
|
@@ -15,7 +15,7 @@ module ProcessSettings
|
|
15
15
|
attr_reader :static_context, :statically_targeted_settings
|
16
16
|
|
17
17
|
def initialize(logger:)
|
18
|
-
@logger = logger
|
18
|
+
@logger = logger or raise ArgumentError, "logger must be not be nil"
|
19
19
|
@on_change_callbacks = []
|
20
20
|
@when_updated_blocks = Set.new
|
21
21
|
@static_context = {}
|
@@ -13,7 +13,6 @@ module ProcessSettings
|
|
13
13
|
attr_writer :instance
|
14
14
|
|
15
15
|
def file_path=(new_file_path)
|
16
|
-
ActiveSupport::Deprecation.warn("ProcessSettings::Monitor.file_path= is deprecated and will be removed in v1.0.")
|
17
16
|
clear_instance
|
18
17
|
|
19
18
|
@file_path = new_file_path
|
@@ -31,11 +30,16 @@ module ProcessSettings
|
|
31
30
|
end
|
32
31
|
|
33
32
|
def instance
|
34
|
-
|
35
|
-
|
33
|
+
if @instance
|
34
|
+
@instance
|
35
|
+
else
|
36
|
+
ActiveSupport::Deprecation.warn("`ProcessSettings::Monitor.instance` lazy create is deprecated and will be removed in v1.0. Assign a `FileMonitor` object to `ProcessSettings.instance =` instead.")
|
37
|
+
@instance = default_instance
|
38
|
+
end
|
36
39
|
end
|
37
40
|
|
38
41
|
def default_instance
|
42
|
+
ActiveSupport::Deprecation.warn("`ProcessSettings::Monitor.instance` is deprecated and will be removed in v1.0. Assign a `FileMonitor` object to `ProcessSettings.instance =` instead.")
|
39
43
|
@default_instance ||= new_from_settings
|
40
44
|
end
|
41
45
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'active_support'
|
4
|
+
require 'active_support/deprecation'
|
3
5
|
require 'active_support/core_ext'
|
4
6
|
|
5
7
|
require_relative '../monitor'
|
@@ -9,8 +11,14 @@ module ProcessSettings
|
|
9
11
|
module Testing
|
10
12
|
# This class implements the Monitor#targeted_value interface but is stubbed to use a simple hash in tests
|
11
13
|
class MonitorStub
|
14
|
+
class << self
|
15
|
+
def new(*_args)
|
16
|
+
ActiveSupport::Deprecation.warn("ProcessSettings::Testing::MonitorStub is deprecated and will be removed in future versions. Use ProcessSettings::Testing::Monitor instead.", caller)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
12
21
|
def initialize(settings_hash)
|
13
|
-
ActiveSupport::Deprecation.warn("ProcessSettings::Testing::MonitorStub is deprecated and will be removed in future versions. Use ProcessSettings::Testing::Monitor instead.", caller)
|
14
22
|
@settings_hash = HashWithHashPath[settings_hash]
|
15
23
|
end
|
16
24
|
|
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.10.1
|
4
|
+
version: 0.10.6.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca
|
@@ -108,9 +108,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- - "
|
111
|
+
- - ">"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version:
|
113
|
+
version: 1.3.1
|
114
114
|
requirements: []
|
115
115
|
rubygems_version: 3.0.3
|
116
116
|
signing_key:
|