resync-client 0.4.5 → 0.4.6

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: aa4c934bab5f910e12150c2cafd5c6ce45e74e52
4
- data.tar.gz: 1506085c4edec3af5e91d880c092ae4c3462d7d7
3
+ metadata.gz: e80e1bb83812f0b30e430a3acda5190b8dfefda9
4
+ data.tar.gz: 8711fbe32e6148e47e907a42872b697cb0f2270c
5
5
  SHA512:
6
- metadata.gz: 1164e90bd20134fb7abfa42363586636b0ea43bdb8afcbc76af6b2a12987381c449c5151b5b07e571ab7485f02fc401b9147ef40d3be0dfb9603e7ec43561d2e
7
- data.tar.gz: f6e9891cecb8ee287265391c41e27d34badbc15e612656a36b9ce8226fc5e4d625b9a436757a57111022e3eabb935554cbfe26dd9019d136cd3dfd7a99ac56ff
6
+ metadata.gz: c22c1d4221cff5e30392ce2cc4cca0f1f9dcdd40d128065ba72a1fbabd0439fa9d64be8f0b4c5b34a3e4c7c5561702a5ac537769271f7c05f4bb0f86218af0d6
7
+ data.tar.gz: cc49a1e20af322c80b260698464234e6578ec201e9c0728b4ecbd649c5a5d8d43b5653aa2c59405dcd21454a7b04e26e2e16fa69c1971b9954e8011d4399c02e
data/.rubocop.yml CHANGED
@@ -17,7 +17,3 @@ Style/EmptyLinesAroundModuleBody:
17
17
  # Allow one line around block body (Style/EmptyLines will still disallow two or more)
18
18
  Style/EmptyLinesAroundBlockBody:
19
19
  Enabled: false
20
-
21
- # Allow %r notation for regexes with a single / character
22
- Style/RegexpLiteral:
23
- MaxSlashes: 0
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.2
1
+ 2.2.5
data/CHANGES.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.4.6
2
+
3
+ - Update to [resync](https://github.com/CDLUC3/resync) 0.4.5
4
+ - Update to Ruby 2.2.5
5
+ - Update to RuboCop 0.47
6
+ - Allow Rake versions > 10.x
7
+
1
8
  ## 0.4.5
2
9
 
3
10
  - Update to [resync](https://github.com/CDLUC3/resync) 0.4.4
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
 
@@ -74,17 +74,17 @@ module Resync
74
74
  private
75
75
 
76
76
  def make_request(uri, limit, &block) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
77
- fail "Redirect limit (#{redirect_limit}) exceeded retrieving URI #{uri}" if limit <= 0
77
+ raise "Redirect limit (#{redirect_limit}) exceeded retrieving URI #{uri}" if limit <= 0
78
78
  req = Net::HTTP::Get.new(uri, 'User-Agent' => user_agent)
79
79
  Net::HTTP.start(uri.hostname, uri.port, use_ssl: (uri.scheme == 'https')) do |http|
80
80
  http.request(req) do |response|
81
81
  case response
82
82
  when Net::HTTPSuccess
83
- block.call(response)
83
+ yield(response)
84
84
  when Net::HTTPInformation, Net::HTTPRedirection
85
85
  make_request(redirect_uri_for(response, uri), limit - 1, &block)
86
86
  else
87
- fail "Error #{response.code}: #{response.message} retrieving URI #{uri}"
87
+ raise "Error #{response.code}: #{response.message} retrieving URI #{uri}"
88
88
  end
89
89
  end
90
90
  end
@@ -19,14 +19,14 @@ module Resync
19
19
  # Delegates to {Client#get} to get the contents of this +:uri+.
20
20
  # The downloaded content will only be downloaded once; subsequent
21
21
  # calls to this method will return the cached content.
22
- def get # rubocop:disable Style/AccessorMethodName
22
+ def get
23
23
  @content ||= client.get(uri)
24
24
  end
25
25
 
26
26
  # Delegates to {Client#download_to_temp_file} to download the
27
27
  # contents of +:uri+ to a file. Subsequent calls will download
28
28
  # the contents again, each time to a fresh temporary file.
29
- def download_to_temp_file # rubocop:disable Style/AccessorMethodName
29
+ def download_to_temp_file
30
30
  client.download_to_temp_file(uri)
31
31
  end
32
32
 
@@ -1,6 +1,6 @@
1
1
  module Resync
2
2
  class Client
3
3
  # The version of this gem.
4
- VERSION = '0.4.5'
4
+ VERSION = '0.4.6'.freeze
5
5
  end
6
6
  end
@@ -63,19 +63,19 @@ module Resync
63
63
  private
64
64
 
65
65
  def resource=(value)
66
- fail ArgumentError, 'nil is not a resource' unless value
66
+ raise ArgumentError, 'nil is not a resource' unless value
67
67
  self.metadata = value.metadata
68
68
  @resource = value
69
69
  end
70
70
 
71
71
  def metadata=(value)
72
- fail 'no metadata found' unless value
72
+ raise 'no metadata found' unless value
73
73
  self.path = value.path
74
74
  @metadata = value
75
75
  end
76
76
 
77
77
  def path=(value)
78
- fail 'no path found in metadata' unless value
78
+ raise 'no path found in metadata' unless value
79
79
  @path = value.start_with?('/') ? value.slice(1..-1) : value
80
80
  end
81
81
 
@@ -67,7 +67,7 @@ module Resync
67
67
  def zipfile=(value)
68
68
  @zipfile = value.is_a?(::Zip::File) ? value : ::Zip::File.open(value)
69
69
  manifest_entry = zipfile.find_entry('manifest.xml')
70
- fail "No manifest.xml found in zipfile #{zipfile.name}" unless manifest_entry
70
+ raise "No manifest.xml found in zipfile #{zipfile.name}" unless manifest_entry
71
71
  manifest_stream = manifest_entry.get_input_stream
72
72
  self.manifest = XMLParser.parse(manifest_stream)
73
73
  end
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
 
@@ -15,7 +16,7 @@ Gem::Specification.new do |spec|
15
16
  spec.license = 'MIT'
16
17
 
17
18
  origin = `git config --get remote.origin.url`.chomp
18
- origin_uri = origin.start_with?('http') ? URI(origin) : URI(origin.sub('git@github.com:', 'https://github.com/'))
19
+ origin_uri = origin.start_with?('http') ? URI(origin) : URI(origin.gsub(%r{git@([^:]+)(.com|.org)[^\/]+}, 'http://\1\2'))
19
20
  spec.homepage = URI::HTTP.build(host: origin_uri.host, path: origin_uri.path.chomp('.git')).to_s
20
21
 
21
22
  spec.files = `git ls-files -z`.split("\x0")
@@ -24,13 +25,13 @@ Gem::Specification.new do |spec|
24
25
  spec.require_paths = ['lib']
25
26
 
26
27
  spec.add_dependency 'promise', '~> 0.3', '>= 0.3.1'
27
- spec.add_dependency 'resync', '~> 0.4', '>= 0.4.4'
28
+ spec.add_dependency 'resync', '~> 0.4', '>= 0.4.5'
28
29
  spec.add_dependency 'rubyzip', '~> 1.1'
29
30
 
30
31
  spec.add_development_dependency 'equivalent-xml', '~> 0.6.0'
31
- spec.add_development_dependency 'rake', '~> 10.4'
32
+ spec.add_development_dependency 'rake', '>= 10.4'
32
33
  spec.add_development_dependency 'rspec', '~> 3.2'
33
- spec.add_development_dependency 'rubocop', '~> 0.29.1'
34
+ spec.add_development_dependency 'rubocop', '~> 0.47'
34
35
  spec.add_development_dependency 'simplecov', '~> 0.9.2'
35
36
  spec.add_development_dependency 'simplecov-console', '~> 0.2.0'
36
37
  spec.add_development_dependency 'yard', '~> 0.8'
data/spec/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ inherit_from: ../.rubocop.yml
2
+
3
+ Metrics/MethodLength:
4
+ Enabled: false
5
+
6
+ Metrics/ModuleLength:
7
+ Enabled: false
8
+
9
+ Metrics/BlockLength:
10
+ Enabled: false
11
+
12
+ Style/MultilineTernaryOperator:
13
+ Enabled: false
@@ -17,12 +17,9 @@ RSpec::Matchers.define :be_time do |expected|
17
17
  end
18
18
 
19
19
  match do |actual|
20
- if expected
21
- fail "Expected value #{expected} is not a Time" unless expected.is_a?(Time)
22
- actual.is_a?(Time) && (to_string(expected) == to_string(actual))
23
- else
24
- return actual.nil?
25
- end
20
+ return actual.nil? unless expected
21
+ raise "Expected value #{expected} is not a Time" unless expected.is_a?(Time)
22
+ actual.is_a?(Time) && (to_string(expected) == to_string(actual))
26
23
  end
27
24
 
28
25
  failure_message do |actual|
@@ -18,7 +18,8 @@ module Resync
18
18
  <loc>http://example.com/20130103-changedump.xml</loc>
19
19
  <rs:md from='2013-01-03T00:00:00Z' until='2013-01-04T00:00:00Z'/>
20
20
  </sitemap>
21
- </sitemapindex>"))
21
+ </sitemapindex>"
22
+ ))
22
23
 
23
24
  @change_dumps = [
24
25
  "<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9' xmlns:rs='http://www.openarchives.org/rs/terms/'>
@@ -9,19 +9,25 @@ module Resync
9
9
  modified_time: Time.utc(2013, 1, 1, 23, 59, 59),
10
10
  metadata: Metadata.new(
11
11
  from_time: Time.utc(2013, 1, 1),
12
- until_time: Time.utc(2013, 1, 2))),
12
+ until_time: Time.utc(2013, 1, 2)
13
+ )
14
+ ),
13
15
  Resource.new(
14
16
  uri: URI('http://example.com/20130102-changedump.zip'),
15
17
  modified_time: Time.utc(2013, 1, 2, 23, 59, 59),
16
18
  metadata: Metadata.new(
17
19
  from_time: Time.utc(2013, 1, 2),
18
- until_time: Time.utc(2013, 1, 3))),
20
+ until_time: Time.utc(2013, 1, 3)
21
+ )
22
+ ),
19
23
  Resource.new(
20
24
  uri: URI('http://example.com/20130103-changedump.zip'),
21
25
  modified_time: Time.utc(2013, 1, 3, 23, 59, 59),
22
26
  metadata: Metadata.new(
23
27
  from_time: Time.utc(2013, 1, 3),
24
- until_time: Time.utc(2013, 1, 4)))
28
+ until_time: Time.utc(2013, 1, 4)
29
+ )
30
+ )
25
31
  ]
26
32
  @dump = ChangeDump.new(resources: @resources)
27
33
 
@@ -55,7 +55,7 @@ module Resync
55
55
  expect(lazy_flat_mapped).to eq(all_packages)
56
56
  end
57
57
 
58
- it 'supports lazy iteration 'do
58
+ it 'supports lazy iteration ' do
59
59
  manifests = Array.new(3) { instance_double(ChangeDumpManifest) }
60
60
  all_packages = Array.new(3) do |index|
61
61
  zip_package = instance_double(Client::Zip::ZipPackage)
@@ -159,7 +159,7 @@ module Resync
159
159
  expect(flat_mapped).to eq(all_packages)
160
160
  end
161
161
 
162
- it 'supports lazy iteration 'do
162
+ it 'supports lazy iteration ' do
163
163
  manifests = Array.new(3) { instance_double(ChangeDumpManifest) }
164
164
  all_packages = Array.new(3) do |index|
165
165
  zip_package = instance_double(Client::Zip::ZipPackage)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resync-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Moles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-28 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: promise
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: '0.4'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 0.4.4
42
+ version: 0.4.5
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: '0.4'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 0.4.4
52
+ version: 0.4.5
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rubyzip
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -82,14 +82,14 @@ dependencies:
82
82
  name: rake
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - "~>"
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '10.4'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - "~>"
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '10.4'
95
95
  - !ruby/object:Gem::Dependency
@@ -112,14 +112,14 @@ dependencies:
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: 0.29.1
115
+ version: '0.47'
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: 0.29.1
122
+ version: '0.47'
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: simplecov
125
125
  requirement: !ruby/object:Gem::Requirement
@@ -200,6 +200,7 @@ files:
200
200
  - lib/resync/client/zip/bitstream.rb
201
201
  - lib/resync/client/zip/zip_package.rb
202
202
  - resync-client.gemspec
203
+ - spec/.rubocop.yml
203
204
  - spec/acceptance/example_spec.rb
204
205
  - spec/data/examples/capability-list.xml
205
206
  - spec/data/examples/change-dump-manifest.xml
@@ -241,7 +242,7 @@ files:
241
242
  - spec/unit/resync/client/list_index_spec.rb
242
243
  - spec/unit/resync/client/mixins_spec.rb
243
244
  - spec/unit/resync/client/zip_package_spec.rb
244
- homepage: http://github.com/CDLUC3/resync-client
245
+ homepage: http://github.com/resync-client
245
246
  licenses:
246
247
  - MIT
247
248
  metadata: {}
@@ -261,11 +262,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
262
  version: '0'
262
263
  requirements: []
263
264
  rubyforge_project:
264
- rubygems_version: 2.4.6
265
+ rubygems_version: 2.6.8
265
266
  signing_key:
266
267
  specification_version: 4
267
268
  summary: Client library for ResourceSync
268
269
  test_files:
270
+ - spec/.rubocop.yml
269
271
  - spec/acceptance/example_spec.rb
270
272
  - spec/data/examples/capability-list.xml
271
273
  - spec/data/examples/change-dump-manifest.xml
@@ -307,4 +309,3 @@ test_files:
307
309
  - spec/unit/resync/client/list_index_spec.rb
308
310
  - spec/unit/resync/client/mixins_spec.rb
309
311
  - spec/unit/resync/client/zip_package_spec.rb
310
- has_rdoc: