ro-crate 0.4.10 → 0.4.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -8
- data/README.md +37 -0
- data/lib/ro_crate.rb +1 -0
- data/lib/ro_crate/model/crate.rb +9 -0
- data/lib/ro_crate/model/data_entity.rb +2 -2
- data/lib/ro_crate/model/directory.rb +0 -2
- data/lib/ro_crate/model/file.rb +1 -3
- data/lib/ro_crate/model/metadata.rb +9 -1
- data/lib/ro_crate/model/organization.rb +1 -1
- data/lib/ro_crate/model/preview.rb +3 -15
- data/lib/ro_crate/model/preview_generator.rb +40 -0
- data/lib/ro_crate/reader.rb +53 -18
- data/ro_crate.gemspec +2 -2
- data/test/crate_test.rb +12 -0
- data/test/fixtures/ro-crate-galaxy-sortchangecase/LICENSE +176 -0
- data/test/fixtures/ro-crate-galaxy-sortchangecase/README.md +6 -0
- data/test/fixtures/ro-crate-galaxy-sortchangecase/ro-crate-metadata.json +133 -0
- data/test/fixtures/ro-crate-galaxy-sortchangecase/sort-and-change-case.ga +118 -0
- data/test/fixtures/ro-crate-galaxy-sortchangecase/test/test1/input.bed +3 -0
- data/test/fixtures/ro-crate-galaxy-sortchangecase/test/test1/output_exp.bed +3 -0
- data/test/fixtures/ro-crate-galaxy-sortchangecase/test/test1/sort-and-change-case-test.yml +8 -0
- data/test/fixtures/sparse_directory_crate/ro-crate-preview.html +60 -59
- data/test/reader_test.rb +24 -0
- data/test/writer_test.rb +22 -2
- metadata +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62f3979b325743d31720f803dbf75690ad6b7b9bcf9f2cbf63d8200a2bb204ba
|
4
|
+
data.tar.gz: 3a229e06492a3f9a90721799f43929d6a5ca01fc0a0ff34d917eeebff037d9d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 242b8e326756d51ab583726db7fb94763286f2764bdf1f0523cd9dab5fa560fe4da3016a4a4b84b0cc6bcef4ec096aeae7dc2fd344ef6cb5ee045cf99a954ef9
|
7
|
+
data.tar.gz: 4abaece91d997ac398ee627f639fc98c924768c255bac1bb6c9ce7f43fc03f5b018a2fc657008863c65537592261e85f697ef2c7e200c20621ba41ff0a933541
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ro-crate (0.4.
|
4
|
+
ro-crate (0.4.11)
|
5
5
|
addressable (~> 2.7.0)
|
6
6
|
rubyzip (~> 2.0.0)
|
7
7
|
|
@@ -12,19 +12,19 @@ GEM
|
|
12
12
|
public_suffix (>= 2.0.2, < 5.0)
|
13
13
|
crack (0.4.3)
|
14
14
|
safe_yaml (~> 1.0.0)
|
15
|
-
docile (1.3.
|
15
|
+
docile (1.3.5)
|
16
16
|
hashdiff (1.0.1)
|
17
|
-
json (2.3.1)
|
18
17
|
power_assert (0.4.1)
|
19
18
|
public_suffix (4.0.3)
|
20
19
|
rake (13.0.0)
|
21
20
|
rubyzip (2.0.0)
|
22
21
|
safe_yaml (1.0.5)
|
23
|
-
simplecov (0.
|
22
|
+
simplecov (0.21.2)
|
24
23
|
docile (~> 1.1)
|
25
|
-
|
26
|
-
|
27
|
-
simplecov-html (0.
|
24
|
+
simplecov-html (~> 0.11)
|
25
|
+
simplecov_json_formatter (~> 0.1)
|
26
|
+
simplecov-html (0.12.3)
|
27
|
+
simplecov_json_formatter (0.1.2)
|
28
28
|
test-unit (3.2.3)
|
29
29
|
power_assert
|
30
30
|
webmock (3.8.3)
|
@@ -39,7 +39,7 @@ PLATFORMS
|
|
39
39
|
DEPENDENCIES
|
40
40
|
rake (~> 13.0.0)
|
41
41
|
ro-crate!
|
42
|
-
simplecov (~> 0.
|
42
|
+
simplecov (~> 0.21.2)
|
43
43
|
test-unit (~> 3.2.3)
|
44
44
|
webmock (~> 3.8.3)
|
45
45
|
yard (~> 0.9.25)
|
data/README.md
CHANGED
@@ -17,6 +17,43 @@ and run `bundle install`.
|
|
17
17
|
|
18
18
|
## Usage
|
19
19
|
|
20
|
+
This gem consists a hierarchy of classes to model RO-Crate "entities": the crate itself, data entities
|
21
|
+
(files and directory) and contextual entities (with a limited set of specializations, such as `ROCrate::Person`).
|
22
|
+
They are all descendents of the `ROCrate::Entity` class, with the `ROCrate::Crate` class representing the crate itself.
|
23
|
+
|
24
|
+
The `ROCrate::Reader` class handles reading of RO-Crates into the above model, from a Zip file or directory.
|
25
|
+
|
26
|
+
The `ROCrate::Writer` class can write out an `ROCrate::Crate` instance into a Zip file or directory.
|
27
|
+
|
28
|
+
**Note:** for performance reasons, the gem is currently not linked-data aware and will allow you to set properties that
|
29
|
+
are not semantically valid.
|
30
|
+
|
31
|
+
### Entities
|
32
|
+
Entities correspond to entries in the `@graph` of the RO-Crate's metadata JSON-LD file. Each entity class is
|
33
|
+
basically a wrapper around a set of JSON properties, with some convenience methods for getting/setting some
|
34
|
+
commonly used properties (`crate.name = "My first crate"`).
|
35
|
+
|
36
|
+
These convenience getter/setter methods will automatically handle turning objects into references and adding them to the
|
37
|
+
`@graph` if necessary.
|
38
|
+
|
39
|
+
##### Getting/Setting Arbitrary Properties of Entities
|
40
|
+
As well as using the pre-defined getter/setter methods, you can get/set arbitrary properties like so.
|
41
|
+
|
42
|
+
To set the "creativeWorkStatus" property of the RO-Crate itself to a string literal:
|
43
|
+
```ruby
|
44
|
+
crate['creativeWorkStatus'] = 'work-in-progress'
|
45
|
+
```
|
46
|
+
|
47
|
+
If you want to reference other entities in the crate, you can get a JSON-LD reference from an entity object by using the `reference` method:
|
48
|
+
```ruby
|
49
|
+
joe = crate.add_person('joe', { name: 'Joe Bloggs' }) # Add the entity to the @graph
|
50
|
+
crate['copyrightHolder'] = joe.reference # Reference the entity from the "copyrightHolder" property
|
51
|
+
```
|
52
|
+
and to resolve those references back to the object, use the `dereference` method:
|
53
|
+
```ruby
|
54
|
+
joe = crate['copyrightHolder'].dereference
|
55
|
+
```
|
56
|
+
|
20
57
|
### Documentation
|
21
58
|
|
22
59
|
[Click here for API documentation](https://www.researchobject.org/ro-crate-ruby/).
|
data/lib/ro_crate.rb
CHANGED
@@ -14,6 +14,7 @@ require 'ro_crate/model/remote_entry'
|
|
14
14
|
require 'ro_crate/model/entry'
|
15
15
|
require 'ro_crate/model/directory'
|
16
16
|
require 'ro_crate/model/metadata'
|
17
|
+
require 'ro_crate/model/preview_generator'
|
17
18
|
require 'ro_crate/model/preview'
|
18
19
|
require 'ro_crate/model/crate'
|
19
20
|
require 'ro_crate/model/contextual_entity'
|
data/lib/ro_crate/model/crate.rb
CHANGED
@@ -168,6 +168,15 @@ module ROCrate
|
|
168
168
|
@preview ||= ROCrate::Preview.new(self)
|
169
169
|
end
|
170
170
|
|
171
|
+
##
|
172
|
+
# Set the RO-Crate preview file
|
173
|
+
# @param preview [Preview] the preview to set.
|
174
|
+
#
|
175
|
+
# @return [Preview]
|
176
|
+
def preview=(preview)
|
177
|
+
@preview = claim(preview)
|
178
|
+
end
|
179
|
+
|
171
180
|
##
|
172
181
|
# All the entities within the crate. Includes contextual entities, data entities, the crate itself and its metadata file.
|
173
182
|
#
|
@@ -3,6 +3,8 @@ module ROCrate
|
|
3
3
|
# A class to represent a "Data Entity" within an RO-Crate.
|
4
4
|
# Data Entities are the actual physical files and directories within the Crate.
|
5
5
|
class DataEntity < Entity
|
6
|
+
properties(%w[name contentSize dateModified encodingFormat identifier sameAs author])
|
7
|
+
|
6
8
|
def self.format_local_id(id)
|
7
9
|
super.chomp('/')
|
8
10
|
end
|
@@ -13,8 +15,6 @@ module ROCrate
|
|
13
15
|
# @return [Class]
|
14
16
|
def self.specialize(props)
|
15
17
|
type = props['@type']
|
16
|
-
id = props['@id']
|
17
|
-
abs = URI(id)&.absolute? rescue false
|
18
18
|
type = [type] unless type.is_a?(Array)
|
19
19
|
if type.include?('Dataset')
|
20
20
|
ROCrate::Directory
|
@@ -2,8 +2,6 @@ module ROCrate
|
|
2
2
|
##
|
3
3
|
# A data entity that represents a directory of potentially many files and subdirectories (or none).
|
4
4
|
class Directory < DataEntity
|
5
|
-
properties(%w[name contentSize dateModified encodingFormat identifier sameAs])
|
6
|
-
|
7
5
|
def self.format_local_id(id)
|
8
6
|
super + '/'
|
9
7
|
end
|
data/lib/ro_crate/model/file.rb
CHANGED
@@ -2,14 +2,12 @@ module ROCrate
|
|
2
2
|
##
|
3
3
|
# A data entity that represents a single file.
|
4
4
|
class File < DataEntity
|
5
|
-
properties(%w[name contentSize dateModified encodingFormat identifier sameAs])
|
6
|
-
|
7
5
|
##
|
8
6
|
# Create a new ROCrate::File. PLEASE NOTE, the new file will not be added to the crate. To do this, call
|
9
7
|
# Crate#add_data_entity, or just use Crate#add_file.
|
10
8
|
#
|
11
9
|
# @param crate [Crate] The RO-Crate that owns this file.
|
12
|
-
# @param source [String, Pathname, ::File,
|
10
|
+
# @param source [String, Pathname, ::File, URI, nil, #read] The source on the disk (or on the internet if a URI) where this file will be read.
|
13
11
|
# @param crate_path [String] The relative path within the RO-Crate where this file will be written.
|
14
12
|
# @param properties [Hash{String => Object}] A hash of JSON-LD properties to associate with this file.
|
15
13
|
def initialize(crate, source, crate_path = nil, properties = {})
|
@@ -17,7 +17,15 @@ module ROCrate
|
|
17
17
|
# @return [String] The rendered JSON-LD as a "prettified" string.
|
18
18
|
def generate
|
19
19
|
graph = crate.entities.map(&:properties).reject(&:empty?)
|
20
|
-
JSON.pretty_generate('@context' =>
|
20
|
+
JSON.pretty_generate('@context' => context, '@graph' => graph)
|
21
|
+
end
|
22
|
+
|
23
|
+
def context
|
24
|
+
@context || CONTEXT
|
25
|
+
end
|
26
|
+
|
27
|
+
def context= c
|
28
|
+
@context = c
|
21
29
|
end
|
22
30
|
|
23
31
|
private
|
@@ -12,26 +12,14 @@ module ROCrate
|
|
12
12
|
# @return [String]
|
13
13
|
attr_accessor :template
|
14
14
|
|
15
|
-
def initialize(crate, properties = {})
|
15
|
+
def initialize(crate, source = nil, properties = {})
|
16
|
+
source ||= PreviewGenerator.new(self)
|
16
17
|
@template = nil
|
17
|
-
super(crate,
|
18
|
-
end
|
19
|
-
|
20
|
-
##
|
21
|
-
# Generate the crate's `ro-crate-preview.html`.
|
22
|
-
# @return [String] The rendered HTML as a string.
|
23
|
-
def generate
|
24
|
-
b = crate.get_binding
|
25
|
-
renderer = ERB.new(template || ::File.read(DEFAULT_TEMPLATE))
|
26
|
-
renderer.result(b)
|
18
|
+
super(crate, source, IDENTIFIER, properties)
|
27
19
|
end
|
28
20
|
|
29
21
|
private
|
30
22
|
|
31
|
-
def source
|
32
|
-
Entry.new(StringIO.new(generate))
|
33
|
-
end
|
34
|
-
|
35
23
|
def default_properties
|
36
24
|
{
|
37
25
|
'@id' => IDENTIFIER,
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module ROCrate
|
4
|
+
##
|
5
|
+
# A class to handle generation of an RO-Crate's preview HTML in an IO-like way (to fit into an Entry).
|
6
|
+
class PreviewGenerator
|
7
|
+
##
|
8
|
+
# @param preview [Preview] The RO-Crate preview object.
|
9
|
+
def initialize(preview)
|
10
|
+
@preview = preview
|
11
|
+
end
|
12
|
+
|
13
|
+
def read(*args)
|
14
|
+
io.read(*args)
|
15
|
+
end
|
16
|
+
|
17
|
+
##
|
18
|
+
# Generate the crate's `ro-crate-preview.html`.
|
19
|
+
# @return [String] The rendered HTML as a string.
|
20
|
+
def generate
|
21
|
+
b = crate.get_binding
|
22
|
+
renderer = ERB.new(template)
|
23
|
+
renderer.result(b)
|
24
|
+
end
|
25
|
+
|
26
|
+
def template
|
27
|
+
@preview.template || ::File.read(Preview::DEFAULT_TEMPLATE)
|
28
|
+
end
|
29
|
+
|
30
|
+
def crate
|
31
|
+
@preview.crate
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def io
|
37
|
+
@io ||= StringIO.new(generate)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/ro_crate/reader.rb
CHANGED
@@ -103,8 +103,12 @@ module ROCrate
|
|
103
103
|
entry == ROCrate::Metadata::IDENTIFIER_1_0 }
|
104
104
|
|
105
105
|
if metadata_file
|
106
|
-
|
107
|
-
|
106
|
+
metadata_json = ::File.read(::File.join(source, metadata_file))
|
107
|
+
metadata = JSON.parse(metadata_json)
|
108
|
+
entities = entities_from_metadata(metadata)
|
109
|
+
context = metadata['@context']
|
110
|
+
|
111
|
+
build_crate(entities, source, context: context)
|
108
112
|
else
|
109
113
|
raise 'No metadata found!'
|
110
114
|
end
|
@@ -113,10 +117,9 @@ module ROCrate
|
|
113
117
|
##
|
114
118
|
# Extracts all the entities from the @graph of the RO-Crate Metadata.
|
115
119
|
#
|
116
|
-
# @param
|
120
|
+
# @param metadata [Hash] A Hash containing the parsed metadata JSON.
|
117
121
|
# @return [Hash{String => Hash}] A Hash of all the entities, mapped by their @id.
|
118
|
-
def self.entities_from_metadata(
|
119
|
-
metadata = JSON.parse(metadata_json)
|
122
|
+
def self.entities_from_metadata(metadata)
|
120
123
|
graph = metadata['@graph']
|
121
124
|
|
122
125
|
if graph
|
@@ -129,6 +132,7 @@ module ROCrate
|
|
129
132
|
# Do some normalization...
|
130
133
|
entities[ROCrate::Metadata::IDENTIFIER] = extract_metadata_entity(entities)
|
131
134
|
raise "No metadata entity found in @graph!" unless entities[ROCrate::Metadata::IDENTIFIER]
|
135
|
+
entities[ROCrate::Preview::IDENTIFIER] = extract_preview_entity(entities)
|
132
136
|
entities[ROCrate::Crate::IDENTIFIER] = extract_root_entity(entities)
|
133
137
|
raise "No root entity (with @id: #{entities[ROCrate::Metadata::IDENTIFIER].dig('about', '@id')}) found in @graph!" unless entities[ROCrate::Crate::IDENTIFIER]
|
134
138
|
|
@@ -139,25 +143,49 @@ module ROCrate
|
|
139
143
|
end
|
140
144
|
|
141
145
|
##
|
142
|
-
# Create
|
146
|
+
# Create and populate crate from the given set of entities.
|
147
|
+
#
|
148
|
+
# @param entity_hash [Hash{String => Hash}] A Hash containing all the entities in the @graph, mapped by their @id.
|
149
|
+
# @param source [String, ::File, Pathname] The location of the RO-Crate being read.
|
150
|
+
# @param crate_class [Class] The class to use to instantiate the crate,
|
151
|
+
# useful if you have created a subclass of ROCrate::Crate that you want to use. (defaults to ROCrate::Crate).
|
152
|
+
# @param context [nil, String, Array, Hash] A custom JSON-LD @context (parsed), or nil to use default.
|
153
|
+
# @return [Crate] The RO-Crate.
|
154
|
+
def self.build_crate(entity_hash, source, crate_class: ROCrate::Crate, context:)
|
155
|
+
crate = initialize_crate(entity_hash, source, crate_class: crate_class, context: context)
|
156
|
+
|
157
|
+
extract_data_entities(crate, source, entity_hash).each do |entity|
|
158
|
+
crate.add_data_entity(entity)
|
159
|
+
end
|
160
|
+
|
161
|
+
# The remaining entities in the hash must be contextual.
|
162
|
+
extract_contextual_entities(crate, entity_hash).each do |entity|
|
163
|
+
crate.add_contextual_entity(entity)
|
164
|
+
end
|
165
|
+
|
166
|
+
crate
|
167
|
+
end
|
168
|
+
|
169
|
+
##
|
170
|
+
# Initialize a crate from the given set of entities.
|
143
171
|
#
|
144
172
|
# @param entity_hash [Hash{String => Hash}] A Hash containing all the entities in the @graph, mapped by their @id.
|
145
173
|
# @param source [String, ::File, Pathname] The location of the RO-Crate being read.
|
174
|
+
# @param crate_class [Class] The class to use to instantiate the crate,
|
175
|
+
# useful if you have created a subclass of ROCrate::Crate that you want to use. (defaults to ROCrate::Crate).
|
176
|
+
# @param context [nil, String, Array, Hash] A custom JSON-LD @context (parsed), or nil to use default.
|
146
177
|
# @return [Crate] The RO-Crate.
|
147
|
-
def self.
|
148
|
-
|
178
|
+
def self.initialize_crate(entity_hash, source, crate_class: ROCrate::Crate, context:)
|
179
|
+
crate_class.new.tap do |crate|
|
149
180
|
crate.properties = entity_hash.delete(ROCrate::Crate::IDENTIFIER)
|
150
181
|
crate.metadata.properties = entity_hash.delete(ROCrate::Metadata::IDENTIFIER)
|
182
|
+
crate.metadata.context = context
|
151
183
|
preview_properties = entity_hash.delete(ROCrate::Preview::IDENTIFIER)
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
crate.add_data_entity(entity)
|
156
|
-
end
|
157
|
-
# The remaining entities in the hash must be contextual.
|
158
|
-
extract_contextual_entities(crate, entity_hash).each do |entity|
|
159
|
-
crate.add_contextual_entity(entity)
|
184
|
+
if preview_properties
|
185
|
+
preview_path = ::File.join(source, ROCrate::Preview::IDENTIFIER)
|
186
|
+
crate.preview = ROCrate::Preview.new(crate, ::File.exists?(preview_path) ? Pathname.new(preview_path) : nil, preview_properties)
|
160
187
|
end
|
188
|
+
crate.add_all(source, false)
|
161
189
|
end
|
162
190
|
end
|
163
191
|
|
@@ -229,8 +257,8 @@ module ROCrate
|
|
229
257
|
##
|
230
258
|
# Extract the metadata entity from the entity hash, according to the rules defined here:
|
231
259
|
# https://www.researchobject.org/ro-crate/1.1/root-data-entity.html#finding-the-root-data-entity
|
232
|
-
# @return [Hash{String => Hash}] A Hash containing (hopefully) one value, the metadata entity's properties
|
233
|
-
# mapped by its @id.
|
260
|
+
# @return [nil, Hash{String => Hash}] A Hash containing (hopefully) one value, the metadata entity's properties
|
261
|
+
# mapped by its @id, or nil if nothing is found.
|
234
262
|
def self.extract_metadata_entity(entities)
|
235
263
|
key = entities.detect do |_, props|
|
236
264
|
props.dig('conformsTo', '@id')&.start_with?(ROCrate::Metadata::RO_CRATE_BASE)
|
@@ -245,6 +273,13 @@ module ROCrate
|
|
245
273
|
entities.delete(ROCrate::Metadata::IDENTIFIER_1_0))
|
246
274
|
end
|
247
275
|
|
276
|
+
##
|
277
|
+
# Extract the ro-crate-preview entity from the entity hash.
|
278
|
+
# @return [Hash{String => Hash}] A Hash containing the preview entity's properties mapped by its @id, or nil if nothing is found.
|
279
|
+
def self.extract_preview_entity(entities)
|
280
|
+
entities.delete("./#{ROCrate::Preview::IDENTIFIER}") || entities.delete(ROCrate::Preview::IDENTIFIER)
|
281
|
+
end
|
282
|
+
|
248
283
|
##
|
249
284
|
# Extract the root entity from the entity hash, according to the rules defined here:
|
250
285
|
# https://www.researchobject.org/ro-crate/1.1/root-data-entity.html#finding-the-root-data-entity
|
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.
|
3
|
+
s.version = '0.4.11'
|
4
4
|
s.summary = 'Create, manipulate, read RO-Crates.'
|
5
5
|
s.authors = ['Finn Bacall']
|
6
6
|
s.email = 'finn.bacall@manchester.ac.uk'
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.add_runtime_dependency 'rubyzip', '~> 2.0.0'
|
13
13
|
s.add_development_dependency 'rake', '~> 13.0.0'
|
14
14
|
s.add_development_dependency 'test-unit', '~> 3.2.3'
|
15
|
-
s.add_development_dependency 'simplecov', '~> 0.
|
15
|
+
s.add_development_dependency 'simplecov', '~> 0.21.2'
|
16
16
|
s.add_development_dependency 'yard', '~> 0.9.25'
|
17
17
|
s.add_development_dependency 'webmock', '~> 3.8.3'
|
18
18
|
end
|
data/test/crate_test.rb
CHANGED
@@ -164,6 +164,18 @@ class CrateTest < Test::Unit::TestCase
|
|
164
164
|
assert_equal 2, crate1.contextual_entities.first.properties['cats']
|
165
165
|
end
|
166
166
|
|
167
|
+
test 'sharing entities' do
|
168
|
+
crate = ROCrate::Crate.new
|
169
|
+
info = crate.add_file(fixture_file('info.txt'),'the_info.txt')
|
170
|
+
bob = crate.add_person('bob', name: 'Bob Jones')
|
171
|
+
crate.author = bob
|
172
|
+
info.author = bob
|
173
|
+
|
174
|
+
assert_equal [bob], crate.contextual_entities
|
175
|
+
assert_equal bob, info.author
|
176
|
+
assert_equal bob, crate.author
|
177
|
+
end
|
178
|
+
|
167
179
|
test 'external files' do
|
168
180
|
crate = ROCrate::Crate.new
|
169
181
|
local = crate.add_file(fixture_file('info.txt'))
|
@@ -0,0 +1,176 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# Galaxy mini workflow
|
2
|
+
|
3
|
+
A tiny Galaxy workflow that sorts tabular lines according to the first column
|
4
|
+
and changes the text to upper case.
|
5
|
+
|
6
|
+
This RO-Crate is based on an [example from the Life Monitor repository](https://github.com/crs4/life_monitor/tree/8437be177822d0e2b3fed30db094b91c2fc14391/interaction_experiments/data/crates/ro-crate-galaxy-sortchangecase).
|
@@ -0,0 +1,133 @@
|
|
1
|
+
{
|
2
|
+
"@context": [
|
3
|
+
"https://w3id.org/ro/crate/1.1/context",
|
4
|
+
{
|
5
|
+
"TestSuite": "https://w3id.org/ro/terms/test#TestSuite",
|
6
|
+
"TestInstance": "https://w3id.org/ro/terms/test#TestInstance",
|
7
|
+
"TestService": "https://w3id.org/ro/terms/test#TestService",
|
8
|
+
"TestDefinition": "https://w3id.org/ro/terms/test#TestDefinition",
|
9
|
+
"PlanemoEngine": "https://w3id.org/ro/terms/test#PlanemoEngine",
|
10
|
+
"JenkinsService": "https://w3id.org/ro/terms/test#JenkinsService",
|
11
|
+
"TravisService": "https://w3id.org/ro/terms/test#TravisService",
|
12
|
+
"GithubService": "https://w3id.org/ro/terms/test#GithubService",
|
13
|
+
"instance": "https://w3id.org/ro/terms/test#instance",
|
14
|
+
"runsOn": "https://w3id.org/ro/terms/test#runsOn",
|
15
|
+
"resource": "https://w3id.org/ro/terms/test#resource",
|
16
|
+
"definition": "https://w3id.org/ro/terms/test#definition",
|
17
|
+
"engineVersion": "https://w3id.org/ro/terms/test#engineVersion"
|
18
|
+
}
|
19
|
+
],
|
20
|
+
"@graph": [
|
21
|
+
{
|
22
|
+
"@id": "ro-crate-metadata.json",
|
23
|
+
"@type": "CreativeWork",
|
24
|
+
"about": {
|
25
|
+
"@id": "./"
|
26
|
+
},
|
27
|
+
"conformsTo": {
|
28
|
+
"@id": "https://w3id.org/ro/crate/1.1"
|
29
|
+
}
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"@id": "./",
|
33
|
+
"@type": "Dataset",
|
34
|
+
"name": "sort-and-change-case",
|
35
|
+
"description": "sort lines and change text to upper case",
|
36
|
+
"license": "Apache-2.0",
|
37
|
+
"mainEntity": {
|
38
|
+
"@id": "sort-and-change-case.ga"
|
39
|
+
},
|
40
|
+
"hasPart": [
|
41
|
+
{
|
42
|
+
"@id": "sort-and-change-case.ga"
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"@id": "LICENSE"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"@id": "README.md"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"@id": "test/test1/sort-and-change-case-test.yml"
|
52
|
+
}
|
53
|
+
],
|
54
|
+
"mentions": [
|
55
|
+
{
|
56
|
+
"@id": "#test1"
|
57
|
+
}
|
58
|
+
]
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"@id": "sort-and-change-case.ga",
|
62
|
+
"@type": [
|
63
|
+
"File",
|
64
|
+
"SoftwareSourceCode",
|
65
|
+
"ComputationalWorkflow"
|
66
|
+
],
|
67
|
+
"programmingLanguage": {
|
68
|
+
"@id": "#galaxy"
|
69
|
+
},
|
70
|
+
"name": "sort-and-change-case"
|
71
|
+
},
|
72
|
+
{
|
73
|
+
"@id": "LICENSE",
|
74
|
+
"@type": "File"
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"@id": "README.md",
|
78
|
+
"@type": "File"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"@id": "#galaxy",
|
82
|
+
"@type": "ComputerLanguage",
|
83
|
+
"name": "Galaxy",
|
84
|
+
"identifier": {
|
85
|
+
"@id": "https://galaxyproject.org/"
|
86
|
+
},
|
87
|
+
"url": {
|
88
|
+
"@id": "https://galaxyproject.org/"
|
89
|
+
}
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"@id": "#test1",
|
93
|
+
"name": "test1",
|
94
|
+
"@type": "TestSuite",
|
95
|
+
"mainEntity": {
|
96
|
+
"@id": "sort-and-change-case.ga"
|
97
|
+
},
|
98
|
+
"instance": [
|
99
|
+
{"@id": "#test1_1"}
|
100
|
+
],
|
101
|
+
"definition": {"@id": "test/test1/sort-and-change-case-test.yml"}
|
102
|
+
},
|
103
|
+
{
|
104
|
+
"@id": "#test1_1",
|
105
|
+
"name": "test1_1",
|
106
|
+
"@type": "TestInstance",
|
107
|
+
"runsOn": {"@id": "https://w3id.org/ro/terms/test#JenkinsService"},
|
108
|
+
"url": "http://example.org/jenkins",
|
109
|
+
"resource": "job/tests/"
|
110
|
+
},
|
111
|
+
{
|
112
|
+
"@id": "test/test1/sort-and-change-case-test.yml",
|
113
|
+
"@type": [
|
114
|
+
"File",
|
115
|
+
"TestDefinition"
|
116
|
+
],
|
117
|
+
"conformsTo": {"@id": "https://w3id.org/ro/terms/test#PlanemoEngine"},
|
118
|
+
"engineVersion": ">=0.70"
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"@id": "https://w3id.org/ro/terms/test#JenkinsService",
|
122
|
+
"@type": "TestService",
|
123
|
+
"name": "Jenkins",
|
124
|
+
"url": {"@id": "https://www.jenkins.io"}
|
125
|
+
},
|
126
|
+
{
|
127
|
+
"@id": "https://w3id.org/ro/terms/test#PlanemoEngine",
|
128
|
+
"@type": "SoftwareApplication",
|
129
|
+
"name": "Planemo",
|
130
|
+
"url": {"@id": "https://github.com/galaxyproject/planemo"}
|
131
|
+
}
|
132
|
+
]
|
133
|
+
}
|
@@ -0,0 +1,118 @@
|
|
1
|
+
{
|
2
|
+
"uuid": "e2a8566c-c025-4181-9e90-7ed29d4e4df1",
|
3
|
+
"tags": [],
|
4
|
+
"format-version": "0.1",
|
5
|
+
"name": "sort-and-change-case",
|
6
|
+
"version": 0,
|
7
|
+
"steps": {
|
8
|
+
"0": {
|
9
|
+
"tool_id": null,
|
10
|
+
"tool_version": null,
|
11
|
+
"outputs": [],
|
12
|
+
"workflow_outputs": [],
|
13
|
+
"input_connections": {},
|
14
|
+
"tool_state": "{}",
|
15
|
+
"id": 0,
|
16
|
+
"uuid": "5a36fad2-66c7-4b9e-8759-0fbcae9b8541",
|
17
|
+
"errors": null,
|
18
|
+
"name": "Input dataset",
|
19
|
+
"label": "bed_input",
|
20
|
+
"inputs": [],
|
21
|
+
"position": {
|
22
|
+
"top": 200,
|
23
|
+
"left": 200
|
24
|
+
},
|
25
|
+
"annotation": "",
|
26
|
+
"content_id": null,
|
27
|
+
"type": "data_input"
|
28
|
+
},
|
29
|
+
"1": {
|
30
|
+
"tool_id": "sort1",
|
31
|
+
"tool_version": "1.1.0",
|
32
|
+
"outputs": [
|
33
|
+
{
|
34
|
+
"type": "input",
|
35
|
+
"name": "out_file1"
|
36
|
+
}
|
37
|
+
],
|
38
|
+
"workflow_outputs": [
|
39
|
+
{
|
40
|
+
"output_name": "out_file1",
|
41
|
+
"uuid": "8237f71a-bc2a-494e-a63c-09c1e65ef7c8",
|
42
|
+
"label": "sorted_bed"
|
43
|
+
}
|
44
|
+
],
|
45
|
+
"input_connections": {
|
46
|
+
"input": {
|
47
|
+
"output_name": "output",
|
48
|
+
"id": 0
|
49
|
+
}
|
50
|
+
},
|
51
|
+
"tool_state": "{\"__page__\": null, \"style\": \"\\\"alpha\\\"\", \"column\": \"\\\"1\\\"\", \"__rerun_remap_job_id__\": null, \"column_set\": \"[]\", \"input\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\", \"header_lines\": \"\\\"0\\\"\", \"order\": \"\\\"ASC\\\"\"}",
|
52
|
+
"id": 1,
|
53
|
+
"uuid": "0b6b3cda-c75f-452b-85b1-8ae4f3302ba4",
|
54
|
+
"errors": null,
|
55
|
+
"name": "Sort",
|
56
|
+
"post_job_actions": {},
|
57
|
+
"label": "sort",
|
58
|
+
"inputs": [
|
59
|
+
{
|
60
|
+
"name": "input",
|
61
|
+
"description": "runtime parameter for tool Sort"
|
62
|
+
}
|
63
|
+
],
|
64
|
+
"position": {
|
65
|
+
"top": 200,
|
66
|
+
"left": 420
|
67
|
+
},
|
68
|
+
"annotation": "",
|
69
|
+
"content_id": "sort1",
|
70
|
+
"type": "tool"
|
71
|
+
},
|
72
|
+
"2": {
|
73
|
+
"tool_id": "ChangeCase",
|
74
|
+
"tool_version": "1.0.0",
|
75
|
+
"outputs": [
|
76
|
+
{
|
77
|
+
"type": "tabular",
|
78
|
+
"name": "out_file1"
|
79
|
+
}
|
80
|
+
],
|
81
|
+
"workflow_outputs": [
|
82
|
+
{
|
83
|
+
"output_name": "out_file1",
|
84
|
+
"uuid": "c31cd733-dab6-4d50-9fec-b644d162397b",
|
85
|
+
"label": "uppercase_bed"
|
86
|
+
}
|
87
|
+
],
|
88
|
+
"input_connections": {
|
89
|
+
"input": {
|
90
|
+
"output_name": "out_file1",
|
91
|
+
"id": 1
|
92
|
+
}
|
93
|
+
},
|
94
|
+
"tool_state": "{\"__page__\": null, \"casing\": \"\\\"up\\\"\", \"__rerun_remap_job_id__\": null, \"cols\": \"\\\"c1\\\"\", \"delimiter\": \"\\\"TAB\\\"\", \"input\": \"{\\\"__class__\\\": \\\"RuntimeValue\\\"}\"}",
|
95
|
+
"id": 2,
|
96
|
+
"uuid": "9698bcde-0729-48fe-b88d-ccfb6f6153b4",
|
97
|
+
"errors": null,
|
98
|
+
"name": "Change Case",
|
99
|
+
"post_job_actions": {},
|
100
|
+
"label": "change_case",
|
101
|
+
"inputs": [
|
102
|
+
{
|
103
|
+
"name": "input",
|
104
|
+
"description": "runtime parameter for tool Change Case"
|
105
|
+
}
|
106
|
+
],
|
107
|
+
"position": {
|
108
|
+
"top": 200,
|
109
|
+
"left": 640
|
110
|
+
},
|
111
|
+
"annotation": "",
|
112
|
+
"content_id": "ChangeCase",
|
113
|
+
"type": "tool"
|
114
|
+
}
|
115
|
+
},
|
116
|
+
"annotation": "",
|
117
|
+
"a_galaxy_workflow": "true"
|
118
|
+
}
|
@@ -1,66 +1,67 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
}</script>
|
37
|
-
|
38
|
-
|
4
|
+
<title>New RO-Crate</title>
|
5
|
+
<script type="application/ld+json">{
|
6
|
+
"@context": "https://w3id.org/ro/crate/1.0/context",
|
7
|
+
"@graph": [
|
8
|
+
{
|
9
|
+
"@id": "ro-crate-metadata.jsonld",
|
10
|
+
"@type": "CreativeWork",
|
11
|
+
"about": {
|
12
|
+
"@id": "./"
|
13
|
+
}
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"@id": "ro-crate-preview.html",
|
17
|
+
"@type": "CreativeWork",
|
18
|
+
"about": {
|
19
|
+
"@id": "./"
|
20
|
+
}
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"@id": "./",
|
24
|
+
"@type": "Dataset",
|
25
|
+
"hasPart": [
|
26
|
+
{
|
27
|
+
"@id": "listed_file.txt"
|
28
|
+
}
|
29
|
+
]
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"@id": "listed_file.txt",
|
33
|
+
"@type": "File"
|
34
|
+
}
|
35
|
+
]
|
36
|
+
}</script>
|
37
|
+
<meta name="generator" content="https://github.com/fbacall/ro-crate-ruby">
|
38
|
+
<meta name="keywords" content="RO-Crate">
|
39
39
|
</head>
|
40
40
|
<body>
|
41
|
-
|
42
|
-
|
43
|
-
<p>
|
44
|
-
|
45
|
-
</p>
|
46
|
-
<dl>
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</dl>
|
41
|
+
<h1>New RO-Crate</h1>
|
42
|
+
Some stuff has been added here blablabla
|
52
43
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
44
|
+
<p>
|
45
|
+
|
46
|
+
</p>
|
47
|
+
<dl>
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
</dl>
|
53
|
+
|
54
|
+
<h2>Contents</h2>
|
55
|
+
<ul>
|
56
|
+
|
57
|
+
<li id="__data_entity_listed_file.txt">
|
58
|
+
|
59
|
+
<strong>listed_file.txt</strong>
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</li>
|
64
|
+
|
65
|
+
</ul>
|
65
66
|
</body>
|
66
|
-
</html>
|
67
|
+
</html>
|
data/test/reader_test.rb
CHANGED
@@ -227,4 +227,28 @@ class ReaderTest < Test::Unit::TestCase
|
|
227
227
|
assert crate.entries['fish/data/binary.jpg']
|
228
228
|
assert_equal ['./', 'fish/', 'ro-crate-metadata.json', 'ro-crate-preview.html'], crate.entities.map(&:id).sort
|
229
229
|
end
|
230
|
+
|
231
|
+
test 'reading preserves any additions to @context' do
|
232
|
+
crate = ROCrate::Reader.read_directory(fixture_file('ro-crate-galaxy-sortchangecase').path)
|
233
|
+
|
234
|
+
context = crate.metadata.context
|
235
|
+
assert_equal [
|
236
|
+
'https://w3id.org/ro/crate/1.1/context',
|
237
|
+
{
|
238
|
+
'TestSuite' => 'https://w3id.org/ro/terms/test#TestSuite',
|
239
|
+
'TestInstance' => 'https://w3id.org/ro/terms/test#TestInstance',
|
240
|
+
'TestService' => 'https://w3id.org/ro/terms/test#TestService',
|
241
|
+
'TestDefinition' => 'https://w3id.org/ro/terms/test#TestDefinition',
|
242
|
+
'PlanemoEngine' => 'https://w3id.org/ro/terms/test#PlanemoEngine',
|
243
|
+
'JenkinsService' => 'https://w3id.org/ro/terms/test#JenkinsService',
|
244
|
+
'TravisService' => 'https://w3id.org/ro/terms/test#TravisService',
|
245
|
+
'GithubService' => 'https://w3id.org/ro/terms/test#GithubService',
|
246
|
+
'instance' => 'https://w3id.org/ro/terms/test#instance',
|
247
|
+
'runsOn' => 'https://w3id.org/ro/terms/test#runsOn',
|
248
|
+
'resource' => 'https://w3id.org/ro/terms/test#resource',
|
249
|
+
'definition' => 'https://w3id.org/ro/terms/test#definition',
|
250
|
+
'engineVersion' => 'https://w3id.org/ro/terms/test#engineVersion'
|
251
|
+
}
|
252
|
+
], context
|
253
|
+
end
|
230
254
|
end
|
data/test/writer_test.rb
CHANGED
@@ -124,12 +124,32 @@ class WriterTest < Test::Unit::TestCase
|
|
124
124
|
actual_files = Dir.chdir(dir) { Dir.glob('**/*') }
|
125
125
|
assert_equal expected_files, actual_files
|
126
126
|
expected_files.each do |file|
|
127
|
-
next if file == 'ro-crate-metadata.jsonld' # Expected context gets updated.
|
128
|
-
next if file == 'ro-crate-preview.html' # RO-Crate preview format changed
|
129
127
|
abs_file_path = ::File.join(fixture, file)
|
130
128
|
next if ::File.directory?(abs_file_path)
|
131
129
|
assert_equal ::File.read(abs_file_path), ::File.read(::File.join(dir, file)), "#{file} didn't match"
|
132
130
|
end
|
133
131
|
end
|
134
132
|
end
|
133
|
+
|
134
|
+
test 'reading/writing multiple times does not change the crate' do
|
135
|
+
input_dir = fixture_file('sparse_directory_crate').path
|
136
|
+
Dir.mktmpdir do |dir|
|
137
|
+
3.times do |i|
|
138
|
+
output_dir = ::File.join(dir, "new_directory_#{i}")
|
139
|
+
crate = ROCrate::Reader.read(input_dir)
|
140
|
+
|
141
|
+
ROCrate::Writer.new(crate).write(output_dir)
|
142
|
+
expected_files = Dir.chdir(input_dir) { Dir.glob('**/*') }
|
143
|
+
actual_files = Dir.chdir(output_dir) { Dir.glob('**/*') }
|
144
|
+
assert_equal expected_files, actual_files
|
145
|
+
expected_files.each do |file|
|
146
|
+
abs_file_path = ::File.join(input_dir, file)
|
147
|
+
next if ::File.directory?(abs_file_path)
|
148
|
+
assert_equal ::File.read(abs_file_path), ::File.read(::File.join(output_dir, file)), "#{file} didn't match"
|
149
|
+
end
|
150
|
+
|
151
|
+
input_dir = output_dir
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
135
155
|
end
|
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.
|
4
|
+
version: 0.4.11
|
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-
|
11
|
+
date: 2021-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.21.2
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.21.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: yard
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- lib/ro_crate/model/organization.rb
|
138
138
|
- lib/ro_crate/model/person.rb
|
139
139
|
- lib/ro_crate/model/preview.rb
|
140
|
+
- lib/ro_crate/model/preview_generator.rb
|
140
141
|
- lib/ro_crate/model/remote_entry.rb
|
141
142
|
- lib/ro_crate/reader.rb
|
142
143
|
- lib/ro_crate/ro-crate-preview.html.erb
|
@@ -166,6 +167,13 @@ files:
|
|
166
167
|
- test/fixtures/file with spaces.txt
|
167
168
|
- test/fixtures/info.txt
|
168
169
|
- test/fixtures/nested_directory.zip
|
170
|
+
- test/fixtures/ro-crate-galaxy-sortchangecase/LICENSE
|
171
|
+
- test/fixtures/ro-crate-galaxy-sortchangecase/README.md
|
172
|
+
- test/fixtures/ro-crate-galaxy-sortchangecase/ro-crate-metadata.json
|
173
|
+
- test/fixtures/ro-crate-galaxy-sortchangecase/sort-and-change-case.ga
|
174
|
+
- test/fixtures/ro-crate-galaxy-sortchangecase/test/test1/input.bed
|
175
|
+
- test/fixtures/ro-crate-galaxy-sortchangecase/test/test1/output_exp.bed
|
176
|
+
- test/fixtures/ro-crate-galaxy-sortchangecase/test/test1/sort-and-change-case-test.yml
|
169
177
|
- test/fixtures/spaces/file with spaces.txt
|
170
178
|
- test/fixtures/spaces/ro-crate-metadata.jsonld
|
171
179
|
- test/fixtures/sparse_directory_crate.zip
|