process_settings 0.10.0 → 0.10.5

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: 7639f6a88f14fbfc52dabbac2b771712cb7fda441683eabc23bdabdd2c9d5492
4
- data.tar.gz: 5f8f41ad06f23db45c31a6c91246252a2a18b9055f1317dcf7e32f84cb6be6eb
3
+ metadata.gz: 22513a938b872f9e3366d445d4c121aafd965c32bec9b937f9b2abe41ff73722
4
+ data.tar.gz: 4e352a2f5a80c19fd171810612b411762372aec422464f684cbcfe71d5d27602
5
5
  SHA512:
6
- metadata.gz: df98267ef1e0c5da02c62a37ac953e12dd4f187aa822306fccce6c2654b6963641dc682d3fbd457455461d8237be7a4eb319f16f0393d399802773ce5ce16fc2
7
- data.tar.gz: 67419019b84fca98837ef37f09d85554052f4ef1b9a2f59185017fb9f141834d28d86228dd7b1f461a00f079234541c02c12f955e760bc7686f55a4ce90b553e
6
+ metadata.gz: ac2cf3d580dd5c27c4bed2a10a59024d886bcfecd2cae4a2b39ddc3e34b78a82f41e01323bc0732144c4bd2823c1e379c2bd218ebf34cf4dc2b1a992d9bf9b20
7
+ data.tar.gz: 97b556d773340f019947a3c623faea53086274a8ff03b62b61583c757e3d7228acb0d1b800ad21076831648238dcca008f7a0cf939ade944d33fc3832b78828d
@@ -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
- system("rm -f tmp/combined_process_settings-A.yml tmp/combined_process_settings-B.yml")
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]} > tmp/combined_process_settings-A.yml")
48
- system("sed '/^- meta:$/,$d' #{input_files[1]} > tmp/combined_process_settings-B.yml")
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 tmp/combined_process_settings-A.yml tmp/combined_process_settings-B.yml")
55
+ system("cmp --silent #{tempfile_a} #{tempfile_b}")
52
56
  else
53
- system("diff -c tmp/combined_process_settings-A.yml tmp/combined_process_settings-B.yml | sed '1,3d'")
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 tmp/combined_process_settings-A.yml tmp/combined_process_settings-B.yml")
61
+ system("rm -f #{tempfile_a} #{tempfile_b}")
58
62
 
59
63
  exit(exit_code)
@@ -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
- @instance = monitor
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
- @instance ||= lazy_create_instance
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
@@ -31,11 +31,11 @@ module ProcessSettings
31
31
  end
32
32
 
33
33
  def instance
34
- ActiveSupport::Deprecation.warn("ProcessSettings::Monitor.instance is deprecated and will be removed in v1.0. Use ProcessSettings.instance instead.")
35
34
  @instance ||= default_instance
36
35
  end
37
36
 
38
37
  def default_instance
38
+ ActiveSupport::Deprecation.warn("`ProcessSettings::Monitor.instance` is deprecated and will be removed in v1.0. Assign a `FileMonitor` object to `ProcessSettings.instance` instead.")
39
39
  @default_instance ||= new_from_settings
40
40
  end
41
41
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'abstract_monitor'
3
4
  require_relative 'hash_with_hash_path'
4
5
 
5
6
  module ProcessSettings
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support'
3
4
  require 'active_support/core_ext'
4
5
  require 'process_settings/abstract_monitor'
5
6
 
@@ -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'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProcessSettings
4
- VERSION = '0.10.0'
4
+ VERSION = '0.10.5'
5
5
  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.10.0
4
+ version: 0.10.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca