resync 0.4.4 → 0.4.5
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 +4 -4
- data/.gitignore +50 -4
- data/.rubocop.yml +5 -0
- data/.ruby-version +1 -1
- data/CHANGES.md +10 -0
- data/Rakefile +4 -4
- data/lib/resync/capability_list.rb +3 -3
- data/lib/resync/link.rb +1 -1
- data/lib/resync/metadata.rb +1 -1
- data/lib/resync/resource.rb +1 -1
- data/lib/resync/shared/base_change_index.rb +1 -1
- data/lib/resync/shared/base_resource_list.rb +3 -3
- data/lib/resync/shared/descriptor.rb +3 -3
- data/lib/resync/shared/sorted_resource_list.rb +3 -6
- data/lib/resync/types/change.rb +1 -1
- data/lib/resync/types/change_frequency.rb +1 -1
- data/lib/resync/version.rb +1 -1
- data/lib/resync/xml.rb +1 -1
- data/lib/resync/xml_parser.rb +3 -3
- data/notes/resourcesync-1.0.9.html +3766 -0
- data/notes/resourcesync-1.0.html +3829 -0
- data/resync.gemspec +6 -5
- data/spec/.rubocop.yml +6 -0
- data/spec/acceptance/xml_parser_spec.rb +7 -7
- data/spec/rspec_custom_matchers.rb +3 -3
- data/spec/unit/resync/capability_list_spec.rb +1 -1
- data/spec/unit/resync/change_dump_manifest_spec.rb +2 -2
- data/spec/unit/resync/shared/augmented_examples.rb +1 -1
- data/spec/unit/resync/shared/base_resource_list_examples.rb +1 -1
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01d85ad76444c1c9ca87238aa1686209a9825da5
|
4
|
+
data.tar.gz: 3466a4b39cdc6d936801618a914bf634ff309ec8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 495c569a83abee87a05294d23fd6aa7b8ff063c7c049d52d72c7e0bb5206dd1f04c60fe8c8b5b2370f4bc61d9c5ca32cbd16cd0cb3c6fdc2e603d654f8f743a1
|
7
|
+
data.tar.gz: 19cd0c3f93813e2b3435a4f2eac4f21ec418c1c547d911fd7545b5798f27e0357607b2294d30389a30ea37d6db97ad9d93b9a8d70c32330d58710f5f2a994dbd
|
data/.gitignore
CHANGED
@@ -19,7 +19,7 @@ mkmf.log
|
|
19
19
|
|
20
20
|
*.gem
|
21
21
|
|
22
|
-
#
|
22
|
+
# IntelliJ
|
23
23
|
|
24
24
|
*.iml
|
25
25
|
*.ipr
|
@@ -27,10 +27,56 @@ mkmf.log
|
|
27
27
|
.rakeTasks
|
28
28
|
.idea
|
29
29
|
|
30
|
-
#
|
30
|
+
# Mac OS
|
31
|
+
|
32
|
+
.DS_Store
|
31
33
|
|
34
|
+
#### joe made this: http://goel.io/joe
|
35
|
+
|
36
|
+
#####=== Emacs ===#####
|
37
|
+
# -*- mode: gitignore; -*-
|
32
38
|
*~
|
39
|
+
\#*\#
|
40
|
+
/.emacs.desktop
|
41
|
+
/.emacs.desktop.lock
|
42
|
+
*.elc
|
43
|
+
auto-save-list
|
44
|
+
tramp
|
45
|
+
.\#*
|
33
46
|
|
34
|
-
#
|
47
|
+
# Org-mode
|
48
|
+
.org-id-locations
|
49
|
+
*_archive
|
50
|
+
|
51
|
+
# flymake-mode
|
52
|
+
*_flymake.*
|
53
|
+
|
54
|
+
# eshell files
|
55
|
+
/eshell/history
|
56
|
+
/eshell/lastdir
|
57
|
+
|
58
|
+
# elpa packages
|
59
|
+
/elpa/
|
60
|
+
|
61
|
+
# reftex files
|
62
|
+
*.rel
|
63
|
+
|
64
|
+
# AUCTeX auto folder
|
65
|
+
/auto/
|
66
|
+
|
67
|
+
# cask packages
|
68
|
+
.cask/
|
69
|
+
dist/
|
70
|
+
|
71
|
+
# Flycheck
|
72
|
+
flycheck_*.el
|
73
|
+
|
74
|
+
# server auth directory
|
75
|
+
/server/
|
76
|
+
|
77
|
+
# projectiles files
|
78
|
+
.projectile
|
79
|
+
|
80
|
+
# directory configuration
|
81
|
+
.dir-locals.el
|
35
82
|
|
36
|
-
.DS_Store
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.5
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 0.4.6 (next)
|
2
|
+
|
3
|
+
## 0.4.5 (27 April 2017)
|
4
|
+
|
5
|
+
- Update to Ruby 2.2.5
|
6
|
+
- Update to XML::MappingExtensions 0.4.8
|
7
|
+
- Update to MIME::Types 3.x
|
8
|
+
- Update to RuboCop 0.47
|
9
|
+
- Allow Rake versions > 10.x
|
10
|
+
|
1
11
|
## 0.4.4 (28 April 2016)
|
2
12
|
|
3
13
|
- Update to XML::MappingExtensions 0.3.5
|
data/Rakefile
CHANGED
@@ -8,18 +8,18 @@ namespace :spec do
|
|
8
8
|
|
9
9
|
desc 'Run all unit tests'
|
10
10
|
RSpec::Core::RakeTask.new(:unit) do |task|
|
11
|
-
task.rspec_opts = %w
|
11
|
+
task.rspec_opts = %w[--color --format documentation --order default]
|
12
12
|
task.pattern = 'unit/**/*_spec.rb'
|
13
13
|
end
|
14
14
|
|
15
15
|
desc 'Run all acceptance tests'
|
16
16
|
RSpec::Core::RakeTask.new(:acceptance) do |task|
|
17
17
|
ENV['COVERAGE'] = nil
|
18
|
-
task.rspec_opts = %w
|
18
|
+
task.rspec_opts = %w[--color --format documentation --order default]
|
19
19
|
task.pattern = 'acceptance/**/*_spec.rb'
|
20
20
|
end
|
21
21
|
|
22
|
-
task all: [
|
22
|
+
task all: %i[unit acceptance]
|
23
23
|
end
|
24
24
|
|
25
25
|
desc 'Run all tests'
|
@@ -45,7 +45,7 @@ RuboCop::RakeTask.new
|
|
45
45
|
|
46
46
|
desc 'List TODOs (from spec/todo.rb)'
|
47
47
|
RSpec::Core::RakeTask.new(:todo) do |task|
|
48
|
-
task.rspec_opts = %w
|
48
|
+
task.rspec_opts = %w[--color --format documentation --order default]
|
49
49
|
task.pattern = 'todo.rb'
|
50
50
|
end
|
51
51
|
|
@@ -69,8 +69,8 @@ module Resync
|
|
69
69
|
capabilities = {}
|
70
70
|
(resources || []).each do |resource|
|
71
71
|
capability = resource.capability
|
72
|
-
|
73
|
-
|
72
|
+
raise ArgumentError, "No capability found for resource with URI #{resource.uri}" unless capability
|
73
|
+
raise ArgumentError, "Duplicate resource for capability #{capability}" if capabilities.key?(capability)
|
74
74
|
capabilities[capability] = resource
|
75
75
|
end
|
76
76
|
capabilities
|
@@ -79,7 +79,7 @@ module Resync
|
|
79
79
|
def source_description_from(links)
|
80
80
|
return nil unless links
|
81
81
|
desc = links.map { |link| link.uri if link.rel == 'up' }.compact.first
|
82
|
-
|
82
|
+
raise ArgumentError, "No source descrption (<link rel='up'/>) provided" unless desc
|
83
83
|
desc
|
84
84
|
end
|
85
85
|
end
|
data/lib/resync/link.rb
CHANGED
@@ -51,7 +51,7 @@ module Resync
|
|
51
51
|
# @param path [String] For +ResourceDumpManifests+ and +ChangeDumpManifests+,
|
52
52
|
# the path to the referenced resource within the dump ZIP file.
|
53
53
|
# @raise [URI::InvalidURIError] if +uri+ cannot be converted to a URI.
|
54
|
-
def initialize( # rubocop:disable Metrics/
|
54
|
+
def initialize( # rubocop:disable Metrics/ParameterLists
|
55
55
|
rel:,
|
56
56
|
uri:,
|
57
57
|
|
data/lib/resync/metadata.rb
CHANGED
@@ -63,7 +63,7 @@ module Resync
|
|
63
63
|
# @param capability [String] identifies the type of a ResourceSync document.
|
64
64
|
# @param path [String] For +ResourceDumpManifests+ and +ChangeDumpManifests+,
|
65
65
|
# the path to the referenced resource within the dump ZIP file.
|
66
|
-
def initialize( # rubocop:disable Metrics/
|
66
|
+
def initialize( # rubocop:disable Metrics/ParameterLists
|
67
67
|
at_time: nil,
|
68
68
|
from_time: nil,
|
69
69
|
until_time: nil,
|
data/lib/resync/resource.rb
CHANGED
@@ -30,7 +30,7 @@ module Resync
|
|
30
30
|
# and 1.0 is the highest.
|
31
31
|
# @param links [Array<Link>] related links (i.e. +<rs:ln>+).
|
32
32
|
# @param metadata [Metadata] metadata about this resource.
|
33
|
-
def initialize( # rubocop:disable Metrics/
|
33
|
+
def initialize( # rubocop:disable Metrics/ParameterLists
|
34
34
|
uri:,
|
35
35
|
modified_time: nil,
|
36
36
|
changefreq: nil,
|
@@ -118,10 +118,10 @@ module Resync
|
|
118
118
|
# @raise [ArgumentError] if the specified metadata does not have the correct +capability+ attribute for this list type.
|
119
119
|
def metadata_with_correct_capability(metadata)
|
120
120
|
capability = self.class::CAPABILITY
|
121
|
-
|
121
|
+
raise ArgumentError, "Missing constant #{self.class}::CAPABILITY" unless capability
|
122
122
|
return Metadata.new(capability: capability) unless metadata
|
123
|
-
|
124
|
-
|
123
|
+
raise ArgumentError, ":metadata argument <#{metadata}> does not appear to be metadata" unless metadata.respond_to?(:capability)
|
124
|
+
raise ArgumentError, "Wrong capability for #{self.class.name} metadata; expected '#{capability}', was '#{metadata.capability}'" unless metadata.capability == capability
|
125
125
|
metadata
|
126
126
|
end
|
127
127
|
|
@@ -49,7 +49,7 @@ module Resync
|
|
49
49
|
# to hex-encoded digest values.
|
50
50
|
# @param path [String] For +ResourceDumpManifests+ and +ChangeDumpManifests+,
|
51
51
|
# the path to the referenced resource within the dump ZIP file.
|
52
|
-
def initialize( # rubocop:disable Metrics/
|
52
|
+
def initialize( # rubocop:disable Metrics/ParameterLists
|
53
53
|
modified_time: nil,
|
54
54
|
length: nil,
|
55
55
|
mime_type: nil,
|
@@ -113,12 +113,12 @@ module Resync
|
|
113
113
|
# Parameter validators
|
114
114
|
|
115
115
|
def time_or_nil(time)
|
116
|
-
|
116
|
+
raise ArgumentError, "time #{time} is not a Time" if time && !time.is_a?(Time)
|
117
117
|
time
|
118
118
|
end
|
119
119
|
|
120
120
|
def natural_number_or_nil(value)
|
121
|
-
|
121
|
+
raise ArgumentError, "value #{value} must be a non-negative integer" if value && (!value.is_a?(Integer) || value < 0)
|
122
122
|
value
|
123
123
|
end
|
124
124
|
|
@@ -53,14 +53,11 @@ module Resync
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def compare(left, right)
|
56
|
-
[
|
56
|
+
%i[modified_time from_time at_time until_time completed_time].each do |time_reader|
|
57
57
|
left_time = left.send(time_reader)
|
58
58
|
right_time = right.send(time_reader)
|
59
|
-
if left_time && right_time
|
60
|
-
|
61
|
-
elsif left_time || right_time
|
62
|
-
return left_time ? -1 : 1
|
63
|
-
end
|
59
|
+
return left_time <=> right_time if left_time && right_time
|
60
|
+
return left_time ? -1 : 1 if left_time || right_time
|
64
61
|
end
|
65
62
|
0
|
66
63
|
end
|
data/lib/resync/types/change.rb
CHANGED
@@ -5,7 +5,7 @@ module Resync
|
|
5
5
|
# The type of change indicated by a reference in a {ChangeList}, {ChangeDump}, etc.
|
6
6
|
# Values: +CREATED+, +UPDATED+, +DELETED+
|
7
7
|
class Change < TypesafeEnum::Base
|
8
|
-
[
|
8
|
+
%i[CREATED UPDATED DELETED].each { |c| new c }
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -5,7 +5,7 @@ module Resync
|
|
5
5
|
# The frequency of changes to a resource.
|
6
6
|
# Values: +ALWAYS+, +HOURLY+, +DAILY+, +WEEKLY+, +MONTHLY+, +YEARLY+, +NEVER+
|
7
7
|
class ChangeFrequency < TypesafeEnum::Base
|
8
|
-
[
|
8
|
+
%i[ALWAYS HOURLY DAILY WEEKLY MONTHLY YEARLY NEVER].each { |cf| new cf }
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/resync/version.rb
CHANGED
data/lib/resync/xml.rb
CHANGED
@@ -37,7 +37,7 @@ module Resync
|
|
37
37
|
when REXML::Element
|
38
38
|
xml
|
39
39
|
else
|
40
|
-
|
40
|
+
raise ArgumentError, "Unexpected argument type; expected XML document, String, or IO source, was #{xml.class}" unless can_parse(xml)
|
41
41
|
REXML::Document.new(xml).root
|
42
42
|
end
|
43
43
|
end
|
data/lib/resync/xml_parser.rb
CHANGED
@@ -42,7 +42,7 @@ module Resync
|
|
42
42
|
def self.find_root_type(types, root_element)
|
43
43
|
capability = capability_for(root_element)
|
44
44
|
root_type = types.find { |t| t::CAPABILITY == capability }
|
45
|
-
|
45
|
+
raise ArgumentError, "no mapped type for capability '#{capability}'" unless root_type
|
46
46
|
root_type
|
47
47
|
end
|
48
48
|
|
@@ -50,7 +50,7 @@ module Resync
|
|
50
50
|
|
51
51
|
def self.capability_for(root_element)
|
52
52
|
capability = capability_attribute_for(root_element).value
|
53
|
-
|
53
|
+
raise ArgumentError, "unable to identify capability of root element in #{root_element}" unless capability
|
54
54
|
capability
|
55
55
|
end
|
56
56
|
|
@@ -58,7 +58,7 @@ module Resync
|
|
58
58
|
|
59
59
|
def self.capability_attribute_for(root_element)
|
60
60
|
capability_attr = REXML::XPath.first(root_element, CAPABILITY_ATTRIBUTE)
|
61
|
-
|
61
|
+
raise ArgumentError, "unable to identify capability of root element in #{root_element}" unless capability_attr
|
62
62
|
capability_attr
|
63
63
|
end
|
64
64
|
|