ro-bundle 0.1.0 → 0.2.0

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.
@@ -31,6 +31,7 @@ class TestProvenance < Test::Unit::TestCase
31
31
  now = Time.now.to_s
32
32
  @prov.created_on = now
33
33
 
34
+ assert @prov.created_on.instance_of?(Time)
34
35
  assert_equal now, @prov.created_on.to_s
35
36
  assert_not_equal old.to_s, @prov.created_on.to_s
36
37
  assert @prov.edited?
@@ -55,6 +56,7 @@ class TestProvenance < Test::Unit::TestCase
55
56
  agent = "Stian Soiland-Reyes"
56
57
  @prov.created_by = agent
57
58
 
59
+ assert @prov.created_by.instance_of?(ROBundle::Agent)
58
60
  assert_not_same old, @prov.created_by
59
61
  assert @prov.edited?
60
62
  end
@@ -68,6 +70,7 @@ class TestProvenance < Test::Unit::TestCase
68
70
  now = Time.now.to_s
69
71
  @prov.authored_on = now
70
72
 
73
+ assert @prov.authored_on.instance_of?(Time)
71
74
  assert_equal now, @prov.authored_on.to_s
72
75
  assert_not_equal old.to_s, @prov.authored_on.to_s
73
76
  assert @prov.edited?
@@ -118,4 +121,76 @@ class TestProvenance < Test::Unit::TestCase
118
121
  refute name_in_agent_list(name, @prov.authored_by)
119
122
  end
120
123
 
124
+ def test_retrieved_by
125
+ retrievor = @prov.retrieved_by
126
+ assert retrievor.instance_of?(ROBundle::Agent)
127
+ assert_equal retrievor.name, "Robert Haines"
128
+ end
129
+
130
+ def test_change_retrieved_by
131
+ agent = ROBundle::Agent.new("Matt Gamble")
132
+ @prov.retrieved_by = agent
133
+
134
+ assert_same agent, @prov.retrieved_by
135
+ assert @prov.edited?
136
+ end
137
+
138
+ def test_retrieved_by_string_agent
139
+ old = @prov.retrieved_by
140
+ agent = "Stian Soiland-Reyes"
141
+ @prov.retrieved_by = agent
142
+
143
+ assert @prov.retrieved_by.instance_of?(ROBundle::Agent)
144
+ assert_not_same old, @prov.retrieved_by
145
+ assert @prov.edited?
146
+ end
147
+
148
+ def test_retrieved_from
149
+ assert @prov.retrieved_from.instance_of?(String)
150
+ end
151
+
152
+ def test_change_retrieved_from
153
+ old = @prov.retrieved_from
154
+ uri = "http://example.com:8080"
155
+ @prov.retrieved_from = uri
156
+
157
+ assert @prov.retrieved_from.instance_of?(String)
158
+ assert_not_equal old, @prov.retrieved_from
159
+ assert @prov.edited?
160
+ end
161
+
162
+ def test_change_retrieved_from_uri_object
163
+ old = @prov.retrieved_from
164
+ uri = URI.parse("http://example.com:8080")
165
+ @prov.retrieved_from = uri
166
+
167
+ assert @prov.retrieved_from.instance_of?(String)
168
+ assert_not_equal old, @prov.retrieved_from
169
+ assert @prov.edited?
170
+ end
171
+
172
+ def test_change_retrieved_from_fail
173
+ old = @prov.retrieved_from
174
+ uri = "www.example.com"
175
+ @prov.retrieved_from = uri
176
+
177
+ assert_equal old, @prov.retrieved_from
178
+ refute @prov.edited?
179
+ end
180
+
181
+ def test_retrieved_on
182
+ assert @prov.retrieved_on.instance_of?(Time)
183
+ end
184
+
185
+ def test_change_retrieved_on
186
+ old = @prov.retrieved_on
187
+ now = Time.now.to_s
188
+ @prov.retrieved_on = now
189
+
190
+ assert @prov.retrieved_on.instance_of?(Time)
191
+ assert_equal now, @prov.retrieved_on.to_s
192
+ assert_not_equal old.to_s, @prov.retrieved_on.to_s
193
+ assert @prov.edited?
194
+ end
195
+
121
196
  end
@@ -0,0 +1,56 @@
1
+ #------------------------------------------------------------------------------
2
+ # Copyright (c) 2014, 2015 The University of Manchester, UK.
3
+ #
4
+ # BSD Licenced. See LICENCE.rdoc for details.
5
+ #
6
+ # Author: Robert Haines
7
+ #------------------------------------------------------------------------------
8
+
9
+ require 'test/unit'
10
+ require "ro-bundle"
11
+ require "helpers/fake_manifest"
12
+
13
+ class TestProxy < Test::Unit::TestCase
14
+
15
+ def setup
16
+ @manifest = FakeManifest.new($man_ex3)
17
+
18
+ @folder = "folder"
19
+ @file = "file.txt"
20
+ @proxy = ROBundle::Proxy.new(@folder, @file)
21
+ end
22
+
23
+ def test_read_no_proxy
24
+ assert_nil @manifest.aggregates[2].proxy
25
+ end
26
+
27
+ def test_new_empty_proxy
28
+ proxy = ROBundle::Proxy.new
29
+ assert ROBundle::Util.is_absolute_uri?(proxy.uri)
30
+ assert_equal "/", proxy.folder
31
+ assert_nil proxy.filename
32
+ end
33
+
34
+ def test_new_proxy
35
+ assert ROBundle::Util.is_absolute_uri?(@proxy.uri)
36
+ assert_equal "/#{@folder}/", @proxy.folder
37
+ assert_equal @file, @proxy.filename
38
+ end
39
+
40
+ def test_read_proxy
41
+ proxy = @manifest.aggregates[3].proxy
42
+
43
+ assert_not_nil proxy
44
+ assert_equal "/folder/", proxy.folder
45
+ assert_equal "external.txt", proxy.filename
46
+ end
47
+
48
+ def test_json_output
49
+ proxy = @manifest.aggregates[3].proxy
50
+ json = JSON.parse(JSON.generate(proxy))
51
+
52
+ assert_equal "/folder/", json["folder"]
53
+ assert_equal "external.txt", json["filename"]
54
+ end
55
+
56
+ end
@@ -1,5 +1,5 @@
1
1
  #------------------------------------------------------------------------------
2
- # Copyright (c) 2014 The University of Manchester, UK.
2
+ # Copyright (c) 2014, 2015 The University of Manchester, UK.
3
3
  #
4
4
  # BSD Licenced. See LICENCE.rdoc for details.
5
5
  #
@@ -12,11 +12,11 @@ require "ro-bundle"
12
12
  class TestRead < Test::Unit::TestCase
13
13
 
14
14
  def test_verify_valid
15
- assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::ZipError) do
15
+ assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do
16
16
  ROBundle::File.verify!($hello)
17
17
  end
18
18
 
19
- assert(ROBundle::File.verify($hello))
19
+ assert ROBundle::File.verify?($hello)
20
20
  end
21
21
 
22
22
  def test_verify_invalid
@@ -24,7 +24,7 @@ class TestRead < Test::Unit::TestCase
24
24
  ROBundle::File.verify!($invalid)
25
25
  end
26
26
 
27
- refute ROBundle::File.verify($invalid)
27
+ refute ROBundle::File.verify?($invalid)
28
28
  end
29
29
 
30
30
  def test_manifest
@@ -19,7 +19,7 @@ class TestRemove < Test::Unit::TestCase
19
19
 
20
20
  rm_file = "workflow.wfbundle"
21
21
 
22
- ROBundle::File.open(filename) do |b|
22
+ bundle = ROBundle::File.open(filename) do |b|
23
23
  assert b.aggregate?(rm_file)
24
24
  assert_not_nil b.find_entry(rm_file)
25
25
  num_agg = b.aggregates.length
@@ -31,8 +31,11 @@ class TestRemove < Test::Unit::TestCase
31
31
  assert_nil b.find_entry(rm_file)
32
32
  assert_equal num_agg - 1, b.aggregates.length
33
33
  assert_equal num_ann - 4, b.annotations.length
34
+ assert b.commit_required?
34
35
  end
35
36
 
37
+ refute bundle.commit_required?
38
+
36
39
  removed_annotations = [
37
40
  ".ro/annotations/workflow.wfdesc.ttl",
38
41
  ".ro/annotations/d2757512-7149-4ff7-b7f8-78de3e3a2bd5.ttl"
@@ -77,14 +80,14 @@ class TestRemove < Test::Unit::TestCase
77
80
 
78
81
  ROBundle::File.open(filename) do |b|
79
82
  rm_file = b.aggregates[0]
80
- assert b.aggregate?(rm_file.file)
83
+ assert b.aggregate?(rm_file.uri)
81
84
  assert_not_nil b.find_entry(rm_file.file_entry)
82
85
  num_agg = b.aggregates.length
83
86
  num_ann = b.annotations.length
84
87
 
85
88
  b.remove_aggregate(rm_file)
86
89
 
87
- refute b.aggregate?(rm_file.file)
90
+ refute b.aggregate?(rm_file.uri)
88
91
  assert_nil b.find_entry(rm_file.file_entry)
89
92
  assert_equal num_agg - 1, b.aggregates.length
90
93
  assert_equal num_ann - 4, b.annotations.length
@@ -122,14 +125,14 @@ class TestRemove < Test::Unit::TestCase
122
125
 
123
126
  ROBundle::File.open(filename) do |b|
124
127
  rm_file = b.aggregates[0]
125
- assert b.aggregate?(rm_file.file)
128
+ assert b.aggregate?(rm_file.uri)
126
129
  assert_not_nil b.find_entry(rm_file.file_entry)
127
130
  num_agg = b.aggregates.length
128
131
  num_ann = b.annotations.length
129
132
 
130
133
  b.remove_aggregate(rm_file, :keep_file => true)
131
134
 
132
- refute b.aggregate?(rm_file.file)
135
+ refute b.aggregate?(rm_file.uri)
133
136
  assert_not_nil b.find_entry(rm_file.file_entry)
134
137
  assert_equal num_agg - 1, b.aggregates.length
135
138
  assert_equal num_ann - 4, b.annotations.length
@@ -18,7 +18,8 @@ class TestUtil < Test::Unit::TestCase
18
18
  json_mix = json_ok.merge(json_nil).merge(json_empty)
19
19
  empty = {}
20
20
 
21
- assert_same json_ok, ROBundle::Util.clean_json(json_ok)
21
+ assert_not_same json_ok, ROBundle::Util.clean_json(json_ok)
22
+ assert_equal json_ok, ROBundle::Util.clean_json(json_ok)
22
23
  assert_equal empty, ROBundle::Util.clean_json(json_nil)
23
24
  assert_equal empty, ROBundle::Util.clean_json(json_empty)
24
25
  assert_equal json_ok, ROBundle::Util.clean_json(json_mix)
@@ -1,5 +1,5 @@
1
1
  #------------------------------------------------------------------------------
2
- # Copyright (c) 2014 The University of Manchester, UK.
2
+ # Copyright (c) 2014, 2015 The University of Manchester, UK.
3
3
  #
4
4
  # BSD Licenced. See LICENCE.rdoc for details.
5
5
  #
@@ -13,6 +13,7 @@ Coveralls.wear!
13
13
  $hello = "test/data/HelloAnyone.robundle"
14
14
  $invalid = "test/data/invalid-manifest.robundle"
15
15
  $man_ex3 = "test/data/example3-manifest.json"
16
+ $man_ex6 = "test/data/example6-manifest.json"
16
17
  $man_empty = "test/data/empty-manifest.json"
17
18
  $man_invalid = "test/data/invalid-manifest.json"
18
19
 
@@ -20,6 +21,7 @@ require "tc_util"
20
21
  require "tc_agent"
21
22
  require "tc_provenance"
22
23
  require "tc_annotation"
24
+ require "tc_proxy"
23
25
  require "tc_aggregate"
24
26
  require "tc_manifest"
25
27
  require "tc_read"
metadata CHANGED
@@ -1,115 +1,129 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ro-bundle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Haines
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-22 00:00:00.000000000 Z
11
+ date: 2015-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rdoc
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '4.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '4.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: coveralls
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ! '>='
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ! '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: ucf
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - ~>
87
+ - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '1.0'
89
+ version: '2.0'
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ~>
94
+ - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '1.0'
96
+ version: '2.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: json
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - ~>
101
+ - - "~>"
88
102
  - !ruby/object:Gem::Version
89
103
  version: '1.8'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ~>
108
+ - - "~>"
95
109
  - !ruby/object:Gem::Version
96
110
  version: '1.8'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: uuid
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - ~>
115
+ - - "~>"
102
116
  - !ruby/object:Gem::Version
103
117
  version: '2.3'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - ~>
122
+ - - "~>"
109
123
  - !ruby/object:Gem::Version
110
124
  version: '2.3'
111
125
  description: This library provides an API for manipulating Research Object (RO) bundles.
112
- The RO bundle specification can be found at http://purl.org/wf4ever/ro-bundle.
126
+ The RO bundle specification can be found at https://w3id.org/bundle/.
113
127
  email:
114
128
  - support@mygrid.org.uk
115
129
  executables:
@@ -123,11 +137,11 @@ extra_rdoc_files:
123
137
  - Licence.rdoc
124
138
  - ReadMe.rdoc
125
139
  files:
126
- - .gitignore
127
- - .ruby-env
128
- - .ruby-gemset
129
- - .ruby-version
130
- - .travis.yml
140
+ - ".gitignore"
141
+ - ".ruby-env"
142
+ - ".ruby-gemset"
143
+ - ".ruby-version"
144
+ - ".travis.yml"
131
145
  - Changes.rdoc
132
146
  - Gemfile
133
147
  - Licence.rdoc
@@ -144,14 +158,17 @@ files:
144
158
  - lib/ro-bundle/ro/aggregate.rb
145
159
  - lib/ro-bundle/ro/annotation.rb
146
160
  - lib/ro-bundle/ro/directory.rb
161
+ - lib/ro-bundle/ro/manifest-entry.rb
147
162
  - lib/ro-bundle/ro/manifest.rb
148
163
  - lib/ro-bundle/ro/provenance.rb
164
+ - lib/ro-bundle/ro/proxy.rb
149
165
  - lib/ro-bundle/util.rb
150
166
  - lib/ro-bundle/version.rb
151
167
  - ro-bundle.gemspec
152
168
  - test/data/HelloAnyone.robundle
153
169
  - test/data/empty-manifest.json
154
170
  - test/data/example3-manifest.json
171
+ - test/data/example6-manifest.json
155
172
  - test/data/invalid-manifest.json
156
173
  - test/data/invalid-manifest.robundle
157
174
  - test/helpers/fake_manifest.rb
@@ -164,34 +181,35 @@ files:
164
181
  - test/tc_create.rb
165
182
  - test/tc_manifest.rb
166
183
  - test/tc_provenance.rb
184
+ - test/tc_proxy.rb
167
185
  - test/tc_read.rb
168
186
  - test/tc_remove.rb
169
187
  - test/tc_util.rb
170
188
  - test/ts_ro_bundle.rb
171
- homepage: http://www.taverna.org.uk
189
+ homepage: http://www.researchobject.org/
172
190
  licenses:
173
191
  - BSD
174
192
  metadata: {}
175
193
  post_install_message:
176
194
  rdoc_options:
177
- - -N
178
- - --tab-width=2
179
- - --main=ReadMe.rdoc
195
+ - "-N"
196
+ - "--tab-width=2"
197
+ - "--main=ReadMe.rdoc"
180
198
  require_paths:
181
199
  - lib
182
200
  required_ruby_version: !ruby/object:Gem::Requirement
183
201
  requirements:
184
- - - ! '>='
202
+ - - ">="
185
203
  - !ruby/object:Gem::Version
186
204
  version: 1.9.3
187
205
  required_rubygems_version: !ruby/object:Gem::Requirement
188
206
  requirements:
189
- - - ! '>='
207
+ - - ">="
190
208
  - !ruby/object:Gem::Version
191
209
  version: '0'
192
210
  requirements: []
193
211
  rubyforge_project:
194
- rubygems_version: 2.2.2
212
+ rubygems_version: 2.4.6
195
213
  signing_key:
196
214
  specification_version: 4
197
215
  summary: This library provides an API for manipulating Research Object (RO) bundles.
@@ -199,6 +217,7 @@ test_files:
199
217
  - test/data/HelloAnyone.robundle
200
218
  - test/data/empty-manifest.json
201
219
  - test/data/example3-manifest.json
220
+ - test/data/example6-manifest.json
202
221
  - test/data/invalid-manifest.json
203
222
  - test/data/invalid-manifest.robundle
204
223
  - test/helpers/fake_manifest.rb
@@ -211,6 +230,7 @@ test_files:
211
230
  - test/tc_create.rb
212
231
  - test/tc_manifest.rb
213
232
  - test/tc_provenance.rb
233
+ - test/tc_proxy.rb
214
234
  - test/tc_read.rb
215
235
  - test/tc_remove.rb
216
236
  - test/tc_util.rb