process_settings 0.3.1 → 0.4.0.pre

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
  SHA1:
3
- metadata.gz: ab9db3b4fdddeb7af46f7d4624ef1547a3801b19
4
- data.tar.gz: eb889d147140be8004a447d102ae42b35aa67b30
3
+ metadata.gz: da6baa8bdbc61885f6924aba6167ea8a77ea597a
4
+ data.tar.gz: abdad82d7862752a0fac28ab1c501a41af016857
5
5
  SHA512:
6
- metadata.gz: 0250e37bfeb4d1958effc06ccaff80e51d00c1e05b1db33c1044fc992006b7bf1210827a64ee8ebb2988878d673434de702c8c115cf4fbebe8a68a2c478ebdd5
7
- data.tar.gz: 74cf6478fd1b719cefd5fbf10a46d67b707df96a098471b1f6c50371b01afed18bf9a309d0841cd0b274bf57680bc7de9395514e70681c944284004d81c6fecb
6
+ metadata.gz: e92e228143718a9cd37eaf0a00a7d721f4b9a6bca7b20b8b87f0cdd29e4b3506f380f1dfc2663dd7da2fefa7acdf15352b43e8588dd4ff2f01cf3332232bc96e
7
+ data.tar.gz: b4d8e2fb372819ec9e55311b71b94eee7190f71d5e8f4f4773e4dcd1e398b21179d7a24832a22765a25a3ec77abc3ba9d59917c477d3d0f85b618c03a4b9a3e8
@@ -11,8 +11,6 @@ require_relative '../lib/process_settings/targeted_settings'
11
11
  PROGRAM_NAME = File.basename($PROGRAM_NAME)
12
12
  SETTINGS_FOLDER = 'settings'
13
13
 
14
- Logger::INFO
15
-
16
14
  def end_marker(version)
17
15
  {
18
16
  'meta' => {
@@ -36,6 +36,8 @@ module ProcessSettings
36
36
  @listener.start
37
37
 
38
38
  load_untargeted_settings
39
+
40
+ statically_targeted_settings # so that notify_on_change will be called if any changes
39
41
  end
40
42
 
41
43
  # stops listening for changes
@@ -4,23 +4,35 @@ require_relative 'targeted_settings'
4
4
 
5
5
  module ProcessSettings
6
6
  # This class will override a file with a higher version file; it accounts for minor version number use
7
- class ReplaceVersionedFile
7
+ module ReplaceVersionedFile
8
+ class << self
9
+ def replace_file_on_newer_file_version(source_file_path, destination_file_path)
10
+ source_file_path.to_s == '' and raise ArgumentError, "source_file_path not present"
11
+ destination_file_path.to_s == '' and raise ArgumentError, "destination_file_path not present"
8
12
 
9
- def replace_file_on_newer_file_version(source_file_name, destination_file_name)
10
- if source_version_is_newer?(source_file_name, destination_file_name)
11
- FileUtils.mv(source_file_name, destination_file_name)
12
- elsif source_file_name != destination_file_name # make sure we're not deleting destination file
13
- FileUtils.remove_file(source_file_name) # clean up, remove left over file
13
+ if source_version_is_newer?(source_file_path, destination_file_path)
14
+ FileUtils.mv(source_file_path, destination_file_path)
15
+ elsif source_file_path != destination_file_path # make sure we're not deleting destination file
16
+ if File.exist?(source_file_path)
17
+ FileUtils.remove_file(source_file_path) # clean up, remove left over file
18
+ end
19
+ end
14
20
  end
15
- end
16
21
 
17
- private
22
+ private
18
23
 
19
- def source_version_is_newer?(source_file_name, destination_file_name)
20
- source_version = ProcessSettings::TargetedSettings.from_file(source_file_name, only_meta: true).version
21
- destination_version = ProcessSettings::TargetedSettings.from_file(destination_file_name, only_meta: true).version
24
+ def source_version_is_newer?(source_file_path, destination_file_path)
25
+ if File.exist?(source_file_path)
26
+ if File.exist?(destination_file_path)
27
+ source_version = ProcessSettings::TargetedSettings.from_file(source_file_path, only_meta: true).version
28
+ destination_version = ProcessSettings::TargetedSettings.from_file(destination_file_path, only_meta: true).version
22
29
 
23
- Gem::Version.new(source_version) > Gem::Version.new(destination_version)
30
+ Gem::Version.new(source_version) > Gem::Version.new(destination_version)
31
+ else
32
+ true
33
+ end
34
+ end
35
+ end
24
36
  end
25
37
  end
26
38
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ProcessSettings
4
+ VERSION = '0.4.0.pre'
5
+ end
6
+
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.3.1
4
+ version: 0.4.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca
@@ -79,6 +79,7 @@ files:
79
79
  - lib/process_settings/target_and_settings.rb
80
80
  - lib/process_settings/targeted_settings.rb
81
81
  - lib/process_settings/util.rb
82
+ - lib/process_settings/version.rb
82
83
  homepage: https://rubygems.org/gems/process_settings
83
84
  licenses:
84
85
  - MIT
@@ -95,9 +96,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
96
  version: '0'
96
97
  required_rubygems_version: !ruby/object:Gem::Requirement
97
98
  requirements:
98
- - - ">="
99
+ - - ">"
99
100
  - !ruby/object:Gem::Version
100
- version: '0'
101
+ version: 1.3.1
101
102
  requirements: []
102
103
  rubyforge_project:
103
104
  rubygems_version: 2.6.13