longleaf 1.1.0 → 1.1.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/lib/longleaf/services/metadata_serializer.rb +23 -9
- data/lib/longleaf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb37785f1fd9fc03721f7cdc3946f648d3c1e126385677daba89fdcfb3c32330
|
4
|
+
data.tar.gz: a208d7c6c79440563950c6b64647637f75fa3687690ff496395cab5e524408f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d1df2dd6abad7c04af677ca571308b322368daeaa27ddde4bc48d2804819851b19e66ce6c66a01007a8439c7c6d6c5937de8c55813ee9af3f2b99a4486affa9
|
7
|
+
data.tar.gz: 2d2ba20c34cdf8abeeb163558b5eb5dec681fb03c17029e97ee3fa9f58ec36de00d9c1b8e8e5effbcf0dcd8ac8abb75866a8983efbd68bff8669f9a9d7a046ef
|
@@ -105,6 +105,7 @@ module Longleaf
|
|
105
105
|
original_file.flock(File::LOCK_EX)
|
106
106
|
|
107
107
|
base_name = File.basename(file_path)
|
108
|
+
old_renamed = nil
|
108
109
|
Tempfile.open(base_name, parent_dir) do |temp_file|
|
109
110
|
begin
|
110
111
|
# Write content to temp file
|
@@ -117,16 +118,27 @@ module Longleaf
|
|
117
118
|
old_stat = File.stat(file_path)
|
118
119
|
set_perms(temp_path, old_stat)
|
119
120
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
121
|
+
# Produce digest files for the temp file
|
122
|
+
digest_paths = write_digests(temp_path, content, digest_algs)
|
123
|
+
|
124
|
+
# Move the old file to a temp path in case it needs to be restored
|
125
|
+
old_renamed = temp_path + ".old"
|
126
|
+
File.rename(file_path, old_renamed)
|
127
|
+
|
128
|
+
# Move move the new file into place as the new main file
|
129
|
+
File.rename(temp_path, file_path)
|
128
130
|
rescue => e
|
129
|
-
|
131
|
+
# Attempt to restore old file if it had already been moved
|
132
|
+
if !old_renamed.nil? && !File.exist?(file_path)
|
133
|
+
File.rename(old_renamed, file_path)
|
134
|
+
end
|
135
|
+
# Cleanup the temp file and any digest files written for it
|
136
|
+
temp_file.delete if File.exist?(temp_file.path)
|
137
|
+
unless digest_paths.nil?
|
138
|
+
digest_paths.each do |digest_path|
|
139
|
+
File.delete(digest_path)
|
140
|
+
end
|
141
|
+
end
|
130
142
|
raise e
|
131
143
|
end
|
132
144
|
|
@@ -136,6 +148,8 @@ module Longleaf
|
|
136
148
|
digest_paths.each do |digest_path|
|
137
149
|
File.rename(digest_path, digest_path.sub(temp_path, file_path))
|
138
150
|
end
|
151
|
+
# Cleanup the old file
|
152
|
+
File.delete(old_renamed)
|
139
153
|
end
|
140
154
|
end
|
141
155
|
end
|
data/lib/longleaf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: longleaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Pennell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|