resync-client 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +42 -0
- data/.rubocop.yml +23 -0
- data/.ruby-version +1 -0
- data/.travis.yml +2 -0
- data/Gemfile +3 -0
- data/LICENSE.md +22 -0
- data/README.md +59 -0
- data/Rakefile +56 -0
- data/example.rb +49 -0
- data/lib/resync/client/bitstream.rb +79 -0
- data/lib/resync/client/client.rb +58 -0
- data/lib/resync/client/downloadable.rb +35 -0
- data/lib/resync/client/dump.rb +25 -0
- data/lib/resync/client/http_helper.rb +111 -0
- data/lib/resync/client/resync_extensions.rb +85 -0
- data/lib/resync/client/version.rb +6 -0
- data/lib/resync/client/zip_package.rb +66 -0
- data/lib/resync/client.rb +3 -0
- data/resync-client.gemspec +35 -0
- data/spec/data/examples/capability-list.xml +25 -0
- data/spec/data/examples/change-dump-manifest.xml +41 -0
- data/spec/data/examples/change-dump.xml +41 -0
- data/spec/data/examples/change-list-index.xml +22 -0
- data/spec/data/examples/change-list.xml +36 -0
- data/spec/data/examples/resource-dump-manifest.xml +25 -0
- data/spec/data/examples/resource-dump.xml +39 -0
- data/spec/data/examples/resource-list-index.xml +21 -0
- data/spec/data/examples/resource-list.xml +24 -0
- data/spec/data/examples/source-description.xml +25 -0
- data/spec/data/resourcedump/manifest.xml +18 -0
- data/spec/data/resourcedump/resourcedump.xml +16 -0
- data/spec/data/resourcedump/resourcedump.zip +0 -0
- data/spec/data/resourcedump/resources/res1 +7 -0
- data/spec/data/resourcedump/resources/res2 +7 -0
- data/spec/rspec_custom_matchers.rb +11 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/todo.rb +65 -0
- data/spec/unit/resync/client/bitstream_spec.rb +90 -0
- data/spec/unit/resync/client/client_spec.rb +130 -0
- data/spec/unit/resync/client/dump_spec.rb +26 -0
- data/spec/unit/resync/client/http_helper_spec.rb +235 -0
- data/spec/unit/resync/client/resync_extensions_spec.rb +148 -0
- data/spec/unit/resync/client/zip_package_spec.rb +44 -0
- metadata +238 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
require 'zip'
|
3
|
+
require_relative 'bitstream'
|
4
|
+
|
5
|
+
module Resync
|
6
|
+
# A ZIP package of resources or changes, providing access to individual
|
7
|
+
# bitstreams based on the included manifest file.
|
8
|
+
#
|
9
|
+
class ZipPackage
|
10
|
+
|
11
|
+
# ------------------------------------------------------------
|
12
|
+
# Attributes
|
13
|
+
|
14
|
+
# @return [Zip::File] the ZIP file wrapped by this package
|
15
|
+
attr_reader :zipfile
|
16
|
+
|
17
|
+
# @return [ResourceDumpManifest, ChangeDumpManifest] the manifest
|
18
|
+
# for the ZIP package
|
19
|
+
attr_reader :manifest
|
20
|
+
|
21
|
+
# ------------------------------------------------------------
|
22
|
+
# Initializer
|
23
|
+
|
24
|
+
# Creates a new +ZipPackage+ for the specified file.
|
25
|
+
#
|
26
|
+
# @param zipfile [Zip::File, String] the ZIP file, or a path to it.
|
27
|
+
def initialize(zipfile)
|
28
|
+
self.zipfile = zipfile
|
29
|
+
end
|
30
|
+
|
31
|
+
# ------------------------------------------------------------
|
32
|
+
# Public methods
|
33
|
+
|
34
|
+
# Gets the bitstream for the specified resource. (Note that this
|
35
|
+
# does no validation; if the resource is not in the manifest, or
|
36
|
+
# the corresponding entry is not in the ZIP file, the behavior of
|
37
|
+
# the returned {Bitstream} is undefined.)
|
38
|
+
#
|
39
|
+
# @return [Bitstream] a bitstream wrapping the ZIP entry for the
|
40
|
+
# specified resource.
|
41
|
+
def bitstream_for(resource)
|
42
|
+
Bitstream.new(zipfile: @zipfile, resource: resource)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Gets all bitstreams declared in the package manifest.
|
46
|
+
# @return [Array<Bitstream>] a list of all bitstreams in the package
|
47
|
+
def bitstreams
|
48
|
+
manifest.resources.map { |r| bitstream_for(r) }
|
49
|
+
end
|
50
|
+
|
51
|
+
# ------------------------------------------------------------
|
52
|
+
# Private methods
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def zipfile=(value)
|
57
|
+
zipfile = value.is_a?(Zip::File) ? value : Zip::File.open(value)
|
58
|
+
manifest_entry = zipfile.find_entry('manifest.xml')
|
59
|
+
fail "No manifest.xml found in zipfile #{zipfile.name}" unless manifest_entry
|
60
|
+
manifest_stream = manifest_entry.get_input_stream
|
61
|
+
@manifest = XMLParser.parse(manifest_stream)
|
62
|
+
@zipfile = zipfile
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'resync/client/version'
|
6
|
+
require 'uri'
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = 'resync-client'
|
10
|
+
spec.version = Resync::Client::VERSION
|
11
|
+
spec.authors = ['David Moles']
|
12
|
+
spec.email = ['david.moles@ucop.edu']
|
13
|
+
spec.summary = 'Client library for ResourceSync'
|
14
|
+
spec.description = 'A Ruby client for the ResourceSync web synchronization framework'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
origin_uri = URI(`git config --get remote.origin.url`.chomp)
|
18
|
+
spec.homepage = URI::HTTP.build(host: origin_uri.host, path: origin_uri.path.chomp('.git')).to_s
|
19
|
+
|
20
|
+
spec.files = `git ls-files -z`.split("\x0")
|
21
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_dependency 'resync', '~> 0.1.0'
|
26
|
+
spec.add_dependency 'rubyzip', '~> 1.1.7'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'equivalent-xml', '~> 0.6.0'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10.4'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 0.29.1'
|
32
|
+
spec.add_development_dependency 'simplecov', '~> 0.9.2'
|
33
|
+
spec.add_development_dependency 'simplecov-console', '~> 0.2.0'
|
34
|
+
spec.add_development_dependency 'yard', '~> 0.8'
|
35
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="describedby"
|
5
|
+
href="http://example.com/info_about_set1_of_resources.xml"/>
|
6
|
+
<rs:ln rel="up"
|
7
|
+
href="http://example.com/resourcesync_description.xml"/>
|
8
|
+
<rs:md capability="capabilitylist"/>
|
9
|
+
<url>
|
10
|
+
<loc>http://example.com/dataset1/resourcelist.xml</loc>
|
11
|
+
<rs:md capability="resourcelist"/>
|
12
|
+
</url>
|
13
|
+
<url>
|
14
|
+
<loc>http://example.com/dataset1/resourcedump.xml</loc>
|
15
|
+
<rs:md capability="resourcedump"/>
|
16
|
+
</url>
|
17
|
+
<url>
|
18
|
+
<loc>http://example.com/dataset1/changelist.xml</loc>
|
19
|
+
<rs:md capability="changelist"/>
|
20
|
+
</url>
|
21
|
+
<url>
|
22
|
+
<loc>http://example.com/dataset1/changedump.xml</loc>
|
23
|
+
<rs:md capability="changedump"/>
|
24
|
+
</url>
|
25
|
+
</urlset>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="up"
|
5
|
+
href="http://example.com/dataset1/capabilitylist.xml"/>
|
6
|
+
<rs:md capability="changedump-manifest"
|
7
|
+
from="2013-01-02T00:00:00Z"
|
8
|
+
until="2013-01-03T00:00:00Z"/>
|
9
|
+
<url>
|
10
|
+
<loc>http://example.com/res7.html</loc>
|
11
|
+
<lastmod>2013-01-02T12:00:00Z</lastmod>
|
12
|
+
<rs:md change="created"
|
13
|
+
hash="md5:1c1b0e264fa9b7e1e9aa6f9db8d6362b"
|
14
|
+
length="4339"
|
15
|
+
type="text/html"
|
16
|
+
path="/changes/res7.html"/>
|
17
|
+
</url>
|
18
|
+
<url>
|
19
|
+
<loc>http://example.com/res9.pdf</loc>
|
20
|
+
<lastmod>2013-01-02T13:00:00Z</lastmod>
|
21
|
+
<rs:md change="updated"
|
22
|
+
hash="md5:f906610c3d4aa745cb2b986f25b37c5a"
|
23
|
+
length="38297"
|
24
|
+
type="application/pdf"
|
25
|
+
path="/changes/res9.pdf"/>
|
26
|
+
</url>
|
27
|
+
<url>
|
28
|
+
<loc>http://example.com/res5.tiff</loc>
|
29
|
+
<lastmod>2013-01-02T19:00:00Z</lastmod>
|
30
|
+
<rs:md change="deleted"/>
|
31
|
+
</url>
|
32
|
+
<url>
|
33
|
+
<loc>http://example.com/res7.html</loc>
|
34
|
+
<lastmod>2013-01-02T20:00:00Z</lastmod>
|
35
|
+
<rs:md change="updated"
|
36
|
+
hash="md5:0988647082c8bc51778894a48ec3b576"
|
37
|
+
length="5426"
|
38
|
+
type="text/html"
|
39
|
+
path="/changes/res7-v2.html"/>
|
40
|
+
</url>
|
41
|
+
</urlset>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="up"
|
5
|
+
href="http://example.com/dataset1/capabilitylist.xml"/>
|
6
|
+
<rs:md capability="changedump"
|
7
|
+
from="2013-01-01T00:00:00Z"/>
|
8
|
+
<url>
|
9
|
+
<loc>http://example.com/20130101-changedump.zip</loc>
|
10
|
+
<lastmod>2013-01-01T23:59:59Z</lastmod>
|
11
|
+
<rs:md type="application/zip"
|
12
|
+
length="3109"
|
13
|
+
from="2013-01-01T00:00:00Z"
|
14
|
+
until="2013-01-02T00:00:00Z"/>
|
15
|
+
<rs:ln rel="contents"
|
16
|
+
href="http://example.com/20130101-changedump-manifest.xml"
|
17
|
+
type="application/xml"/>
|
18
|
+
</url>
|
19
|
+
<url>
|
20
|
+
<loc>http://example.com/20130102-changedump.zip</loc>
|
21
|
+
<lastmod>2013-01-02T23:59:59Z</lastmod>
|
22
|
+
<rs:md type="application/zip"
|
23
|
+
length="6629"
|
24
|
+
from="2013-01-02T00:00:00Z"
|
25
|
+
until="2013-01-03T00:00:00Z"/>
|
26
|
+
<rs:ln rel="contents"
|
27
|
+
href="http://example.com/20130102-changedump-manifest.xml"
|
28
|
+
type="application/xml"/>
|
29
|
+
</url>
|
30
|
+
<url>
|
31
|
+
<loc>http://example.com/20130103-changedump.zip</loc>
|
32
|
+
<lastmod>2013-01-03T23:59:59Z</lastmod>
|
33
|
+
<rs:md type="application/zip"
|
34
|
+
length="8124"
|
35
|
+
from="2013-01-03T00:00:00Z"
|
36
|
+
until="2013-01-04T00:00:00Z"/>
|
37
|
+
<rs:ln rel="contents"
|
38
|
+
href="http://example.com/20130103-changedump-manifest.xml"
|
39
|
+
type="application/xml"/>
|
40
|
+
</url>
|
41
|
+
</urlset>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="up"
|
5
|
+
href="http://example.com/dataset1/capabilitylist.xml"/>
|
6
|
+
<rs:md capability="changelist"
|
7
|
+
from="2013-01-01T00:00:00Z"/>
|
8
|
+
<sitemap>
|
9
|
+
<loc>http://example.com/20130101-changelist.xml</loc>
|
10
|
+
<rs:md from="2013-01-01T00:00:00Z"
|
11
|
+
until="2013-01-02T00:00:00Z"/>
|
12
|
+
</sitemap>
|
13
|
+
<sitemap>
|
14
|
+
<loc>http://example.com/20130102-changelist.xml</loc>
|
15
|
+
<rs:md from="2013-01-02T00:00:00Z"
|
16
|
+
until="2013-01-03T00:00:00Z"/>
|
17
|
+
</sitemap>
|
18
|
+
<sitemap>
|
19
|
+
<loc>http://example.com/20130103-changelist.xml</loc>
|
20
|
+
<rs:md from="2013-01-03T00:00:00Z"/>
|
21
|
+
</sitemap>
|
22
|
+
</sitemapindex>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="up"
|
5
|
+
href="http://example.com/dataset1/capabilitylist.xml"/>
|
6
|
+
<rs:md capability="changelist"
|
7
|
+
from="2013-01-03T00:00:00Z"/>
|
8
|
+
<url>
|
9
|
+
<loc>http://example.com/res4</loc>
|
10
|
+
<lastmod>2013-01-03T17:00:00Z</lastmod>
|
11
|
+
<rs:md change="updated"
|
12
|
+
hash="sha-256:f4OxZX_x_DFGFDgghgdfb6rtSx-iosjf6735432nklj"
|
13
|
+
length="56778"
|
14
|
+
type="application/json"/>
|
15
|
+
<rs:ln rel="http://www.openarchives.org/rs/terms/patch"
|
16
|
+
href="http://example.com/res4-json-patch"
|
17
|
+
modified="2013-01-03T17:00:00Z"
|
18
|
+
hash="sha-256:y66dER_t_HWEIKpesdkeb7rtSc-ippjf9823742opld"
|
19
|
+
length="73"
|
20
|
+
type="application/json-patch"/>
|
21
|
+
</url>
|
22
|
+
<url>
|
23
|
+
<loc>http://example.com/res5-full.tiff</loc>
|
24
|
+
<lastmod>2013-01-03T18:00:00Z</lastmod>
|
25
|
+
<rs:md change="updated"
|
26
|
+
hash="sha-256:f4OxZX_x_FO5LcGBSKHWXfwtSx-j1ncoSt3SABJtkGk"
|
27
|
+
length="9788456778"
|
28
|
+
type="image/tiff"/>
|
29
|
+
<rs:ln rel="http://www.openarchives.org/rs/terms/patch"
|
30
|
+
href="http://example.com/res5-diff"
|
31
|
+
modified="2013-01-03T18:00:00Z"
|
32
|
+
hash="sha-256:h986gT_t_87HTkjHYE76G558hY-jdfgy76t55sadJUYT"
|
33
|
+
length="4533"
|
34
|
+
type="application/x-tiff-diff"/>
|
35
|
+
</url>
|
36
|
+
</urlset>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="up"
|
5
|
+
href="http://example.com/dataset1/capabilitylist.xml"/>
|
6
|
+
<rs:md capability="resourcedump-manifest"
|
7
|
+
at="2013-01-03T09:00:00Z"
|
8
|
+
completed="2013-01-03T09:02:00Z"/>
|
9
|
+
<url>
|
10
|
+
<loc>http://example.com/res1</loc>
|
11
|
+
<lastmod>2013-01-02T13:00:00Z</lastmod>
|
12
|
+
<rs:md hash="md5:1584abdf8ebdc9802ac0c6a7402c03b6"
|
13
|
+
length="8876"
|
14
|
+
type="text/html"
|
15
|
+
path="/resources/res1"/>
|
16
|
+
</url>
|
17
|
+
<url>
|
18
|
+
<loc>http://example.com/res2</loc>
|
19
|
+
<lastmod>2013-01-02T14:00:00Z</lastmod>
|
20
|
+
<rs:md hash="md5:1e0d5cb8ef6ba40c99b14c0237be735e sha-256:854f61290e2e197a11bc91063afce22e43f8ccc655237050ace766adc68dc784"
|
21
|
+
length="14599"
|
22
|
+
type="application/pdf"
|
23
|
+
path="/resources/res2"/>
|
24
|
+
</url>
|
25
|
+
</urlset>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="up"
|
5
|
+
href="http://example.com/dataset1/capabilitylist.xml"/>
|
6
|
+
<rs:md capability="resourcedump"
|
7
|
+
at="2013-01-03T09:00:00Z"
|
8
|
+
completed="2013-01-03T09:04:00Z"/>
|
9
|
+
<url>
|
10
|
+
<loc>http://example.com/resourcedump-part1.zip</loc>
|
11
|
+
<rs:md type="application/zip"
|
12
|
+
length="4765"
|
13
|
+
at="2013-01-03T09:00:00Z"
|
14
|
+
completed="2013-01-03T09:02:00Z"/>
|
15
|
+
<rs:ln rel="contents"
|
16
|
+
href="http://example.com/resourcedump_manifest-part1.xml"
|
17
|
+
type="application/xml"/>
|
18
|
+
</url>
|
19
|
+
<url>
|
20
|
+
<loc>http://example.com/resourcedump-part2.zip</loc>
|
21
|
+
<rs:md type="application/zip"
|
22
|
+
length="9875"
|
23
|
+
at="2013-01-03T09:01:00Z"
|
24
|
+
completed="2013-01-03T09:03:00Z"/>
|
25
|
+
<rs:ln rel="contents"
|
26
|
+
href="http://example.com/resourcedump_manifest-part2.xml"
|
27
|
+
type="application/xml"/>
|
28
|
+
</url>
|
29
|
+
<url>
|
30
|
+
<loc>http://example.com/resourcedump-part3.zip</loc>
|
31
|
+
<rs:md type="application/zip"
|
32
|
+
length="2298"
|
33
|
+
at="2013-01-03T09:03:00Z"
|
34
|
+
completed="2013-01-03T09:04:00Z"/>
|
35
|
+
<rs:ln rel="contents"
|
36
|
+
href="http://example.com/resourcedump_manifest-part3.xml"
|
37
|
+
type="application/xml"/>
|
38
|
+
</url>
|
39
|
+
</urlset>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="up"
|
5
|
+
href="http://example.com/dataset1/capabilitylist.xml"/>
|
6
|
+
<rs:md capability="resourcelist"
|
7
|
+
at="2013-01-03T09:00:00Z"
|
8
|
+
completed="2013-01-03T09:10:00Z"/>
|
9
|
+
<sitemap>
|
10
|
+
<loc>http://example.com/resourcelist1.xml</loc>
|
11
|
+
<rs:md at="2013-01-03T09:00:00Z"/>
|
12
|
+
</sitemap>
|
13
|
+
<sitemap>
|
14
|
+
<loc>http://example.com/resourcelist2.xml</loc>
|
15
|
+
<rs:md at="2013-01-03T09:03:00Z"/>
|
16
|
+
</sitemap>
|
17
|
+
<sitemap>
|
18
|
+
<loc>http://example.com/resourcelist3.xml</loc>
|
19
|
+
<rs:md at="2013-01-03T09:07:00Z"/>
|
20
|
+
</sitemap>
|
21
|
+
</sitemapindex>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="up"
|
5
|
+
href="http://example.com/dataset1/capabilitylist.xml"/>
|
6
|
+
<rs:ln rel="index"
|
7
|
+
href="http://example.com/dataset1/resourcelist-index.xml"/>
|
8
|
+
<rs:md capability="resourcelist"
|
9
|
+
at="2013-01-03T09:00:00Z"/>
|
10
|
+
<url>
|
11
|
+
<loc>http://example.com/res3</loc>
|
12
|
+
<lastmod>2013-01-02T13:00:00Z</lastmod>
|
13
|
+
<rs:md hash="md5:1584abdf8ebdc9802ac0c6a7402c8753"
|
14
|
+
length="4385"
|
15
|
+
type="application/pdf"/>
|
16
|
+
</url>
|
17
|
+
<url>
|
18
|
+
<loc>http://example.com/res4</loc>
|
19
|
+
<lastmod>2013-01-02T14:00:00Z</lastmod>
|
20
|
+
<rs:md hash="md5:4556abdf8ebdc9802ac0c6a7402c9881"
|
21
|
+
length="883"
|
22
|
+
type="image/png"/>
|
23
|
+
</url>
|
24
|
+
</urlset>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="describedby"
|
5
|
+
href="http://example.com/info_about_source.xml"/>
|
6
|
+
<rs:md capability="description"/>
|
7
|
+
<url>
|
8
|
+
<loc>http://example.com/capabilitylist1.xml</loc>
|
9
|
+
<rs:md capability="capabilitylist"/>
|
10
|
+
<rs:ln rel="describedby"
|
11
|
+
href="http://example.com/info_about_set1_of_resources.xml"/>
|
12
|
+
</url>
|
13
|
+
<url>
|
14
|
+
<loc>http://example.com/capabilitylist2.xml</loc>
|
15
|
+
<rs:md capability="capabilitylist"/>
|
16
|
+
<rs:ln rel="describedby"
|
17
|
+
href="http://example.com/info_about_set2_of_resources.xml"/>
|
18
|
+
</url>
|
19
|
+
<url>
|
20
|
+
<loc>http://example.com/capabilitylist3.xml</loc>
|
21
|
+
<rs:md capability="capabilitylist"/>
|
22
|
+
<rs:ln rel="describedby"
|
23
|
+
href="http://example.com/info_about_set3_of_resources.xml"/>
|
24
|
+
</url>
|
25
|
+
</urlset>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:md capability="resourcedump-manifest"
|
5
|
+
at="2015-05-05T16:19:25Z"/>
|
6
|
+
<url>
|
7
|
+
<loc>http://example.com/res1</loc>
|
8
|
+
<lastmod>2015-05-22T16:14:55Z</lastmod>
|
9
|
+
<rs:md hash="md5:51b99b46c9980623b36b27e06a7e4a46"
|
10
|
+
path="/resources/res1"/>
|
11
|
+
</url>
|
12
|
+
<url>
|
13
|
+
<loc>http://example.com/res2</loc>
|
14
|
+
<lastmod>2015-05-22T16:16:04Z</lastmod>
|
15
|
+
<rs:md hash="md5:6205d276e0c120eb4bac47c14a8297d8"
|
16
|
+
path="/resources/res2"/>
|
17
|
+
</url>
|
18
|
+
</urlset>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
3
|
+
xmlns:rs="http://www.openarchives.org/rs/terms/">
|
4
|
+
<rs:ln rel="up"
|
5
|
+
href="http://example.com/capabilitylist.xml"/>
|
6
|
+
<rs:md capability="resourcedump"
|
7
|
+
at="2015-05-22T16:06:04Z"
|
8
|
+
completed="2015-05-05T16:23:20Z"/>
|
9
|
+
<url>
|
10
|
+
<loc>http://example.com/resourcedump.zip</loc>
|
11
|
+
<rs:md type="application/zip"
|
12
|
+
length="1334"
|
13
|
+
at="2015-05-22T16:06:04Z"
|
14
|
+
completed="2015-05-05T16:23:20Z"/>
|
15
|
+
</url>
|
16
|
+
</urlset>
|
Binary file
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
2
|
+
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
3
|
+
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
4
|
+
aliquip ex ea commodo consequat. Duis aute irure dolor in
|
5
|
+
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
6
|
+
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
7
|
+
culpa qui officia deserunt mollit anim id est laborum.
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Quo usque tandem abutere, Catilina, patientia nostra? quam diu etiam
|
2
|
+
furor iste tuus nos eludet? quem ad finem sese effrenata iactabit
|
3
|
+
audacia? Nihilne te nocturnum praesidium Palati, nihil urbis vigiliae,
|
4
|
+
nihil timor populi, nihil concursus bonorum omnium, nihil hic
|
5
|
+
munitissimus habendi senatus locus, nihil horum ora voltusque
|
6
|
+
moverunt? Patere tua consilia non sentis, constrictam iam horum omnium
|
7
|
+
scientia teneri coniurationem tuam non vides?
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rspec/expectations'
|
2
|
+
|
3
|
+
RSpec::Matchers.define :request_for do |h|
|
4
|
+
match do |actual|
|
5
|
+
begin
|
6
|
+
!h.key?(:uri) || actual.uri == h[:uri] &&
|
7
|
+
!h.key?(:method) || actual.method == h[:method] &&
|
8
|
+
!h.key?(:headers) || actual.to_hash == h[:headers]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# ------------------------------------------------------------
|
2
|
+
# SimpleCov setup
|
3
|
+
|
4
|
+
if ENV['COVERAGE']
|
5
|
+
require 'simplecov'
|
6
|
+
require 'simplecov-console'
|
7
|
+
|
8
|
+
SimpleCov.minimum_coverage 100
|
9
|
+
SimpleCov.start do
|
10
|
+
add_filter '/spec/'
|
11
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
12
|
+
SimpleCov::Formatter::HTMLFormatter,
|
13
|
+
SimpleCov::Formatter::Console,
|
14
|
+
]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# ------------------------------------------------------------
|
19
|
+
# Rspec configuration
|
20
|
+
|
21
|
+
RSpec.configure do |config|
|
22
|
+
config.raise_errors_for_deprecations!
|
23
|
+
config.mock_with :rspec
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'rspec_custom_matchers'
|
27
|
+
|
28
|
+
# ------------------------------------------------------------
|
29
|
+
# resync-client
|
30
|
+
|
31
|
+
require 'resync/client'
|
data/spec/todo.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'rspec/core'
|
2
|
+
require 'resync/client'
|
3
|
+
|
4
|
+
# List of TODO items in spec form
|
5
|
+
module Resync
|
6
|
+
describe Client do
|
7
|
+
describe 'discovery' do
|
8
|
+
it 'retrieves a Source Description from a URI'
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'capability lists' do
|
12
|
+
it 'retrieves a Capability List from a URI'
|
13
|
+
end
|
14
|
+
|
15
|
+
describe 'resource lists' do
|
16
|
+
it 'retrieves a Resource List from a URI'
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'resource list indices' do
|
20
|
+
it 'retrieves a Resource List Index from a URI'
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'resource dumps' do
|
24
|
+
it 'retrieves a Resource Dump from a URI'
|
25
|
+
describe 'bitstream packages' do
|
26
|
+
it 'can download and cache a bitstream package'
|
27
|
+
it 'can extract a resource dump manifest from a ZIP bitstream package'
|
28
|
+
it 'can extract a resource from a ZIP bitstream package based on a path in a manifest'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'resource dump manifests' do
|
33
|
+
it 'retrieves a Resource Dump Manifest from a URI'
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'change lists' do
|
37
|
+
it 'retrieves a Change List from a URI'
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'change list indices' do
|
41
|
+
it 'retrieves a Change List Index from a URI'
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'change dumps' do
|
45
|
+
it 'retrieves a Change Dump from a URI'
|
46
|
+
describe 'bitstream packages' do
|
47
|
+
it 'gets the "contents" link URI for the change dump manifest, if present'
|
48
|
+
it 'can download and cache a bitstream package'
|
49
|
+
it 'can extract a change dump manifest from a ZIP bitstream package'
|
50
|
+
it 'can extract a resource from a ZIP bitstream package based on a path in a manifest'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'change dump manifests' do
|
55
|
+
it 'retrieves a Change Dump Manifest from a URI'
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'error handling' do
|
59
|
+
it 'handles server errors gracefully'
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'does something clever for mirrors, alternate representations, and related resources'
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|