ocfl 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -8
- data/lib/ocfl/object/directory.rb +3 -11
- data/lib/ocfl/object/inventory.rb +3 -5
- data/lib/ocfl/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: b32346d0bd14e71b28385a1e34ad4f4af73335ab64345fa374c890ccf07e4f83
|
4
|
+
data.tar.gz: 4f9f6bc929cdee4f24e3b8b4bca167d69219d34fb74de00ff75414a68ee66ad2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9a520d6bf056649a3b4c261ea27fb6d5a994d8f0bd274f5a8aca19751e24fa4c1ca08de57ee7971b927081f4dcb941a514570deba8088580579613123a1d1f1
|
7
|
+
data.tar.gz: a3df7b8ae6913eee74a0bea12474ee4c7ebe937bd1b92c28c8918e2a00c46d82191e99a360dacd780b1be65f1bdab25dbca7edfa47f3d03b8d4cf8e3ef534ebe
|
data/README.md
CHANGED
@@ -44,20 +44,12 @@ directory.path(filepath: "ocfl.rbs", version: "v2")
|
|
44
44
|
# => <Pathname:/files/[object_root]/v2/content/ocfl.rbs>
|
45
45
|
|
46
46
|
# Get the path of a file in the head version
|
47
|
-
directory.path(filepath: "ocfl.rbs", version: :head)
|
48
|
-
# => <Pathname:/files/[object_root]/v2/content/ocfl.rbs>
|
49
|
-
|
50
|
-
# Get the path of a file from the latest version in which it was changed
|
51
47
|
directory.path(filepath: "ocfl.rbs")
|
52
48
|
# => <Pathname:/files/[object_root]/v2/content/ocfl.rbs>
|
53
49
|
|
54
50
|
new_version = directory.overwrite_current_version
|
55
51
|
new_version.copy_file('sig/ocfl.rbs')
|
56
52
|
new_version.save
|
57
|
-
|
58
|
-
new_version = directory.clone_current_version
|
59
|
-
new_version.copy_file('Gemfile')
|
60
|
-
new_version.save
|
61
53
|
```
|
62
54
|
|
63
55
|
## Development
|
@@ -18,14 +18,10 @@ module OCFL
|
|
18
18
|
delegate :head, :versions, :manifest, to: :inventory
|
19
19
|
|
20
20
|
def path(filepath:, version: nil)
|
21
|
-
version
|
22
|
-
relative_path =
|
23
|
-
version_inventory(version).path(filepath)
|
24
|
-
else
|
25
|
-
inventory.path(filepath)
|
26
|
-
end
|
21
|
+
version ||= head
|
22
|
+
relative_path = version_inventory(version).path(filepath)
|
27
23
|
|
28
|
-
raise FileNotFound, "Path '#{filepath}' not found in #{version
|
24
|
+
raise FileNotFound, "Path '#{filepath}' not found in #{version} inventory" if relative_path.nil?
|
29
25
|
|
30
26
|
object_root / relative_path
|
31
27
|
end
|
@@ -69,10 +65,6 @@ module OCFL
|
|
69
65
|
end
|
70
66
|
|
71
67
|
def begin_new_version
|
72
|
-
DraftVersion.new(object_directory: self)
|
73
|
-
end
|
74
|
-
|
75
|
-
def clone_current_version
|
76
68
|
DraftVersion.new(object_directory: self, state: head_inventory.state)
|
77
69
|
end
|
78
70
|
|
@@ -34,13 +34,11 @@ module OCFL
|
|
34
34
|
|
35
35
|
# @return [String,nil] the path to the file relative to the object root. (e.g. v2/content/image.tiff)
|
36
36
|
def path(logical_path)
|
37
|
-
|
38
|
-
path.match(%r{\Av\d+/#{content_directory}/#{logical_path}\z})
|
39
|
-
end
|
37
|
+
digest, = state.find { |_, logical_paths| logical_paths.include?(logical_path) }
|
40
38
|
|
41
|
-
return
|
39
|
+
return unless digest
|
42
40
|
|
43
|
-
|
41
|
+
manifest[digest].find { |content_path| content_path.match(%r{\Av\d+/#{content_directory}/#{logical_path}\z}) }
|
44
42
|
end
|
45
43
|
|
46
44
|
def head_version
|
data/lib/ocfl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocfl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|