process_settings 0.3.1 → 0.4.0.pre
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da6baa8bdbc61885f6924aba6167ea8a77ea597a
|
4
|
+
data.tar.gz: abdad82d7862752a0fac28ab1c501a41af016857
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e92e228143718a9cd37eaf0a00a7d721f4b9a6bca7b20b8b87f0cdd29e4b3506f380f1dfc2663dd7da2fefa7acdf15352b43e8588dd4ff2f01cf3332232bc96e
|
7
|
+
data.tar.gz: b4d8e2fb372819ec9e55311b71b94eee7190f71d5e8f4f4773e4dcd1e398b21179d7a24832a22765a25a3ec77abc3ba9d59917c477d3d0f85b618c03a4b9a3e8
|
@@ -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
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
22
|
+
private
|
18
23
|
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
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
|
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.
|
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:
|
101
|
+
version: 1.3.1
|
101
102
|
requirements: []
|
102
103
|
rubyforge_project:
|
103
104
|
rubygems_version: 2.6.13
|