ocfl 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/lib/ocfl/object/draft_version.rb +14 -4
- data/lib/ocfl/version.rb +1 -1
- data/tmp/.keep +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c21578c64e68d5bdab7fcea3b08bf8210a967a52d0d6b0f2ecdc203a4f2eaca4
|
4
|
+
data.tar.gz: 48503dd0f9011c88bbf20bc6adf073d2b1ff422ac1ed06063c332f7c3bbf619e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74169c05ca7d91082db0198d252234956c7a47139d57419f5be14e8e23168af39e75b9d9e78d397bd1b65fbc688834ee84cd1456d452795163c777c6c7da15c7
|
7
|
+
data.tar.gz: acd185ad8a09d1b016d9c6867d5b4b68005fbe1227abe8848912f917c3d71f4d535cd1847cc4422606fec0d5fc01b9dbf59b6b613c4e5701dfca1703ebae79dc
|
data/.rubocop.yml
CHANGED
@@ -21,7 +21,9 @@ module OCFL
|
|
21
21
|
|
22
22
|
def move_file(incoming_path)
|
23
23
|
prepare_content_directory
|
24
|
-
add(incoming_path)
|
24
|
+
already_stored = add(incoming_path)
|
25
|
+
return if already_stored
|
26
|
+
|
25
27
|
FileUtils.mv(incoming_path, content_path)
|
26
28
|
end
|
27
29
|
|
@@ -80,18 +82,26 @@ module OCFL
|
|
80
82
|
# @param [String] logical_file_path where we're going to store the file (e.g. 'object/directory_builder_spec.rb')
|
81
83
|
# @param [String] incoming_path where's this file from (e.g. 'spec/ocfl/object/directory_builder_spec.rb')
|
82
84
|
def copy_one(logical_file_path, incoming_path)
|
83
|
-
add(incoming_path, logical_file_path:)
|
85
|
+
already_stored = add(incoming_path, logical_file_path:)
|
86
|
+
return if already_stored
|
87
|
+
|
84
88
|
parent_dir = (content_path / logical_file_path).parent
|
85
89
|
FileUtils.mkdir_p(parent_dir) unless parent_dir == content_path
|
86
90
|
FileUtils.cp(incoming_path, content_path / logical_file_path)
|
87
91
|
end
|
88
92
|
|
93
|
+
# @return [Boolean] true if the file already existed in this object. If false, the object must be
|
94
|
+
# moved to the content directory.
|
89
95
|
def add(incoming_path, logical_file_path: File.basename(incoming_path))
|
90
96
|
digest = Digest::SHA512.file(incoming_path).to_s
|
91
97
|
version_content_path = content_path.relative_path_from(object_directory.object_root)
|
92
98
|
file_path_relative_to_root = (version_content_path / logical_file_path).to_s
|
93
|
-
@manifest
|
94
|
-
@
|
99
|
+
result = @manifest.key?(digest)
|
100
|
+
@manifest[digest] ||= []
|
101
|
+
@state[digest] ||= []
|
102
|
+
@manifest[digest].push(file_path_relative_to_root)
|
103
|
+
@state[digest].push(logical_file_path)
|
104
|
+
result
|
95
105
|
end
|
96
106
|
|
97
107
|
def prepare_content_directory
|
data/lib/ocfl/version.rb
CHANGED
data/tmp/.keep
ADDED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocfl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/ocfl/object/version.rb
|
104
104
|
- lib/ocfl/version.rb
|
105
105
|
- sig/ocfl.rbs
|
106
|
+
- tmp/.keep
|
106
107
|
homepage: https://github.com/sul-dlss/ocfl-rb
|
107
108
|
licenses: []
|
108
109
|
metadata:
|