file_pipeline 0.0.5 → 0.0.6
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/file_pipeline/versioned_file.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51b495ebce21752d34f27eef33a350539f8918076774063323e603cde82a7726
|
4
|
+
data.tar.gz: f6bd55e7129fe2308193af2e12630a867cca866ae6ce71dd177a9deea3e2aa00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47077cb546d41be57b9c662718710c815dda1c3d77b1834946800d2ddf5472abfde8ecf9e107f58b69f6eb573ea536464a316c5d60a5ae97e94a4d5deb6fbc01
|
7
|
+
data.tar.gz: 25b006ee9e71a989eea5f22eece86918feabe4f7579cf96425110cf64efe5f0e00ab40335b6002298d552f979894bbcd210869ce8e724c35628306d8da701e1e
|
@@ -71,6 +71,7 @@ module FilePipeline
|
|
71
71
|
if info&.failure
|
72
72
|
raise Errors::FailedModificationError, info: info, file: original
|
73
73
|
end
|
74
|
+
|
74
75
|
version = validate(file)
|
75
76
|
@history[version] = info
|
76
77
|
self
|
@@ -147,6 +148,9 @@ module FilePipeline
|
|
147
148
|
# resets the #history to an empty Hash. Returns the path to the written
|
148
149
|
# file.
|
149
150
|
#
|
151
|
+
# If the optional block is passed, it will be evaluated before the file is
|
152
|
+
# finalized.
|
153
|
+
#
|
150
154
|
# ===== Options
|
151
155
|
#
|
152
156
|
# * +overwrite+ - +true+ or +false+
|
@@ -154,6 +158,7 @@ module FilePipeline
|
|
154
158
|
# #basename and the #original will be preserved.
|
155
159
|
# * +true+ - The finalized version will replace the #original.
|
156
160
|
def finalize(overwrite: false)
|
161
|
+
yield(self) if block_given?
|
157
162
|
filename = overwrite ? replacing_trarget : preserving_taget
|
158
163
|
FileUtils.rm original if overwrite
|
159
164
|
@original = VersionedFile.copy(current, original_dir, filename)
|