ro-crate 0.4.2 → 0.4.3

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
  SHA256:
3
- metadata.gz: 174513e7c0e8ec6ac0cf6c8bf1ca80dda57f4d95669681d15821a5e1290b5a70
4
- data.tar.gz: 835ad728feca6614b81368b3d3428ffe4f7ad8614863bfdbaf669597bc8abbc9
3
+ metadata.gz: 00f8d84d1776b3f8c51e68477fe665c5c703fb56a584e72f748cf10b1a80de14
4
+ data.tar.gz: 6beefca605f5a5ab5da783510f3a8fe8cbcc795f595431a50eb2e6c47edf7999
5
5
  SHA512:
6
- metadata.gz: c87db2e02ed875d80e1a5ef4a8c5a3e63fedeb67a20b3a94762f6e8a47f79430e970b525ada5510cd3b86d64b955691dde0e267c856ca53eb24e311017f4a59b
7
- data.tar.gz: bbd587d78f67f043917b128f78ad9a94e4044e7096bd9d1540a28e47313fb427a8196b8e531b7123ee7ba1dac686cb5a4de4114d9418ae415f384b3d27847f7e
6
+ metadata.gz: ba029b48b018565b89d5df2d6d4dd8e22a96d5d1949922985ebf564f6133a1b71495a41540a7e265cd3bc5871dda41940d400dea077c439ab23389ebc7e1c44b
7
+ data.tar.gz: ba169bd9cf38fade168fada4a57ba3e29e0b70e1b181a753c09a2f39a21d13a17370376c6561b549041fc2e811c689f6db3a1fad616856f6b956c8528314004a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ro-crate (0.4.2)
4
+ ro-crate (0.4.3)
5
5
  addressable (~> 2.7.0)
6
6
  rubyzip (~> 2.0.0)
7
7
 
@@ -235,5 +235,11 @@ module ROCrate
235
235
  def get_binding
236
236
  binding
237
237
  end
238
+
239
+ private
240
+
241
+ def full_entry_path(relative_path)
242
+ relative_path
243
+ end
238
244
  end
239
245
  end
@@ -21,6 +21,7 @@ module ROCrate
21
21
 
22
22
  if source_directory
23
23
  source_directory = Pathname.new(::File.expand_path(source_directory))
24
+ @entry = source_directory
24
25
  populate_entries(source_directory)
25
26
  crate_path = source_directory.basename.to_s if crate_path.nil?
26
27
  end
@@ -35,9 +36,10 @@ module ROCrate
35
36
  # @return [Hash{String => Entry}>]
36
37
  def entries
37
38
  entries = {}
39
+ entries[filepath.chomp('/')] = @entry if @entry
38
40
 
39
41
  @directory_entries.each do |rel_path, entry|
40
- entries[::File.join(filepath, rel_path)] = entry
42
+ entries[full_entry_path(rel_path)] = entry
41
43
  end
42
44
 
43
45
  entries
@@ -63,6 +65,10 @@ module ROCrate
63
65
  @directory_entries
64
66
  end
65
67
 
68
+ def full_entry_path(relative_path)
69
+ ::File.join(filepath, relative_path)
70
+ end
71
+
66
72
  def default_properties
67
73
  super.merge(
68
74
  '@id' => "#{SecureRandom.uuid}/",
data/ro_crate.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ro-crate'
3
- s.version = '0.4.2'
3
+ s.version = '0.4.3'
4
4
  s.summary = 'Create, manipulate, read RO-Crates.'
5
5
  s.authors = ['Finn Bacall']
6
6
  s.email = 'finn.bacall@manchester.ac.uk'
data/test/crate_test.rb CHANGED
@@ -203,6 +203,17 @@ class CrateTest < Test::Unit::TestCase
203
203
  crate = ROCrate::Crate.new
204
204
  entities = crate.add_all(fixture_file('directory').path)
205
205
 
206
+ paths = crate.entries.keys
207
+ assert_equal 8, paths.length
208
+ assert_includes paths, 'data'
209
+ assert_includes paths, 'root.txt'
210
+ assert_includes paths, 'info.txt'
211
+ assert_includes paths, 'data/binary.jpg'
212
+ assert_includes paths, 'data/info.txt'
213
+ assert_includes paths, 'data/nested.txt'
214
+ assert_includes paths, 'ro-crate-metadata.json'
215
+ assert_includes paths, 'ro-crate-preview.html'
216
+
206
217
  assert_equal 6, entities.length
207
218
  assert_equal 'ROCrate::Directory', crate.dereference('data/').class.name
208
219
  assert_equal 'ROCrate::File', crate.dereference('root.txt').class.name
@@ -220,6 +231,17 @@ class CrateTest < Test::Unit::TestCase
220
231
 
221
232
  assert_empty entities
222
233
 
234
+ paths = crate.entries.keys
235
+ assert_equal 8, paths.length
236
+ assert_includes paths, 'data'
237
+ assert_includes paths, 'root.txt'
238
+ assert_includes paths, 'info.txt'
239
+ assert_includes paths, 'data/binary.jpg'
240
+ assert_includes paths, 'data/info.txt'
241
+ assert_includes paths, 'data/nested.txt'
242
+ assert_includes paths, 'ro-crate-metadata.json'
243
+ assert_includes paths, 'ro-crate-preview.html'
244
+
223
245
  # Should not create any data entities
224
246
  assert_nil crate.dereference('data/')
225
247
  assert_nil crate.dereference('root.txt')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ro-crate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Finn Bacall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-19 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable