resync 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e70fce0b524e1decc437cb83c31ef62d4f90402
4
- data.tar.gz: 442ae82605b8ab0b3c808baf19a64c20ae086a43
3
+ metadata.gz: 01d85ad76444c1c9ca87238aa1686209a9825da5
4
+ data.tar.gz: 3466a4b39cdc6d936801618a914bf634ff309ec8
5
5
  SHA512:
6
- metadata.gz: 98e4a481281ef924edc259449cdb5c407016fcad35b0912ac18e65c7fe95e767092dcab010a53d85656a09e95fd619702858ebac68d3b2f97ea610af42f76628
7
- data.tar.gz: 450a3df07cceafbf62ae9551efefcb0c4ced58d864facb3c17a33728f541e1208b9ae06b5fc32f2a92b70df53920177866de60ae96aeb8ae607bc13332efef93
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
- # IntellJ
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
- # Emacs
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
- # Mac OS
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
@@ -21,3 +21,8 @@ Style/EmptyLinesAroundBlockBody:
21
21
  # Suppress complaints about post-2.0 syntax
22
22
  AllCops:
23
23
  TargetRubyVersion: 2.2
24
+
25
+ # Make our own decisions about readability
26
+ Style/TernaryParentheses:
27
+ Enabled: false
28
+
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.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(--color --format documentation --order default)
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(--color --format documentation --order default)
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: [:unit, :acceptance]
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(--color --format documentation --order default)
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
- fail ArgumentError, "No capability found for resource with URI #{resource.uri}" unless capability
73
- fail ArgumentError, "Duplicate resource for capability #{capability}" if capabilities.key?(capability)
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
- fail ArgumentError, "No source descrption (<link rel='up'/>) provided" unless desc
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/MethodLength, Metrics/ParameterLists
54
+ def initialize( # rubocop:disable Metrics/ParameterLists
55
55
  rel:,
56
56
  uri:,
57
57
 
@@ -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/MethodLength, Metrics/ParameterLists
66
+ def initialize( # rubocop:disable Metrics/ParameterLists
67
67
  at_time: nil,
68
68
  from_time: nil,
69
69
  until_time: nil,
@@ -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/MethodLength, Metrics/ParameterLists
33
+ def initialize( # rubocop:disable Metrics/ParameterLists
34
34
  uri:,
35
35
  modified_time: nil,
36
36
  changefreq: nil,
@@ -29,7 +29,7 @@ module Resync
29
29
  end
30
30
 
31
31
  def loosely(in_range, resource)
32
- (resource.from_time || resource.until_time) ? strictly(in_range, resource) : true
32
+ resource.from_time || resource.until_time ? strictly(in_range, resource) : true
33
33
  end
34
34
  end
35
35
  end
@@ -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
- fail ArgumentError, "Missing constant #{self.class}::CAPABILITY" unless capability
121
+ raise ArgumentError, "Missing constant #{self.class}::CAPABILITY" unless capability
122
122
  return Metadata.new(capability: capability) unless metadata
123
- fail ArgumentError, ":metadata argument <#{metadata}> does not appear to be metadata" unless metadata.respond_to?(:capability)
124
- fail ArgumentError, "Wrong capability for #{self.class.name} metadata; expected '#{capability}', was '#{metadata.capability}'" unless metadata.capability == capability
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/MethodLength, Metrics/ParameterLists
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
- fail ArgumentError, "time #{time} is not a Time" if time && !time.is_a?(Time)
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
- fail ArgumentError, "value #{value} must be a non-negative integer" if value && (!value.is_a?(Integer) || value < 0)
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
- [:modified_time, :from_time, :at_time, :until_time, :completed_time].each do |time_reader|
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
- return left_time <=> right_time
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
@@ -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
- [:CREATED, :UPDATED, :DELETED].each { |c| new c }
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
- [:ALWAYS, :HOURLY, :DAILY, :WEEKLY, :MONTHLY, :YEARLY, :NEVER].each { |cf| new cf }
8
+ %i[ALWAYS HOURLY DAILY WEEKLY MONTHLY YEARLY NEVER].each { |cf| new cf }
9
9
  end
10
10
  end
11
11
  end
@@ -1,4 +1,4 @@
1
1
  module Resync
2
2
  # The version of this gem.
3
- VERSION = '0.4.4'.freeze
3
+ VERSION = '0.4.5'.freeze
4
4
  end
data/lib/resync/xml.rb CHANGED
@@ -37,7 +37,7 @@ module Resync
37
37
  when REXML::Element
38
38
  xml
39
39
  else
40
- fail ArgumentError, "Unexpected argument type; expected XML document, String, or IO source, was #{xml.class}" unless can_parse(xml)
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
@@ -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
- fail ArgumentError, "no mapped type for capability '#{capability}'" unless root_type
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
- fail ArgumentError, "unable to identify capability of root element in #{root_element}" unless capability
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
- fail ArgumentError, "unable to identify capability of root element in #{root_element}" unless capability_attr
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