filbunke 2.1.3 → 2.1.7

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
- SHA1:
3
- metadata.gz: 44578b9db2dc8322b72700297dd29b692fe8d640
4
- data.tar.gz: 99b49067517d284e74aa463b0430dd9dd421ec94
2
+ SHA256:
3
+ metadata.gz: ad6c0602a7d2dd0e234114495836e1479ba02fa338befd5a3399e65aed9564d9
4
+ data.tar.gz: 79292e2acb04273425a16fd6cc33950a467e77f2021c0dee6a90aac4262f2f67
5
5
  SHA512:
6
- metadata.gz: 6d7ab975f18b1c882f7d927ed81d7fb2ccd97ed4b45e7cff39ede7da90079316c5a15a21135879a725b3ff0e8335d1bf5434c6be7f8bfc627ac1097d5e8ad261
7
- data.tar.gz: 8185277d98c33556f26c7b52197691206c7b9241a357724e068302458abe5bf4d485feb40c2ad162df790f31ac6c28ba3b35917d592b852ed10e5d6320606c80
6
+ metadata.gz: b7328935e1ebdb2f1e0c2536ac124233d154be026e86f33ae77f0fdca14f15b1c056f6927481305dd82fc2b376f700d4b5ebcae4ba5a67a73e6fa3188db8997d
7
+ data.tar.gz: 34824f421d84ef82cf3fe7f4506e8ecdcc6dbe198635263a82d98ee3aeddad18c95f3261650f2b7813b2e43ea84e9cb196864373d0ab183645dc6c0eabdae902
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2
1
+ 2.3
data/Rakefile CHANGED
@@ -4,11 +4,12 @@ require 'rake'
4
4
  begin
5
5
  require 'jeweler'
6
6
  required_dependencies = {
7
- "json" => "1.8.3",
8
- "typhoeus" => "1.0.1",
7
+ "addressable" => "2.8.0",
8
+ "json" => "2.6.1",
9
+ "typhoeus" => "1.4.0",
9
10
  "open4" => "1.3.4",
10
- "mime-types" => "2.6.2",
11
- "parallel" => "1.6.1"
11
+ "mime-types" => "3.4.1",
12
+ "parallel" => "1.21.0"
12
13
  }
13
14
  Jeweler::Tasks.new do |gem|
14
15
  gem.name = "filbunke"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.3
1
+ 2.1.7
data/filbunke.gemspec CHANGED
@@ -1,20 +1,20 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
3
+ # Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: filbunke 2.1.3 ruby lib
5
+ # stub: filbunke 2.1.7 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "filbunke"
9
- s.version = "2.1.3"
8
+ s.name = "filbunke".freeze
9
+ s.version = "2.1.7"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Wouter de Bie", "Bjorn Sperber", "Karl Ravn", "Magnus Spangdal"]
14
- s.date = "2016-03-11"
15
- s.description = "Filbunke client and library"
16
- s.email = "technical@deltaprojects.com"
17
- s.executables = ["filbunked"]
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Wouter de Bie".freeze, "Bjorn Sperber".freeze, "Karl Ravn".freeze, "Magnus Spangdal".freeze]
14
+ s.date = "2022-02-23"
15
+ s.description = "Filbunke client and library".freeze
16
+ s.email = "technical@deltaprojects.com".freeze
17
+ s.executables = ["filbunked".freeze]
18
18
  s.files = [
19
19
  ".gitignore",
20
20
  ".ruby-gemset",
@@ -41,35 +41,30 @@ Gem::Specification.new do |s|
41
41
  "test/helper.rb",
42
42
  "test/test_filbunke.rb"
43
43
  ]
44
- s.homepage = "https://rubygems.org/gems/filbunke"
45
- s.rubygems_version = "2.4.8"
46
- s.summary = "Filbunke client"
44
+ s.homepage = "https://rubygems.org/gems/filbunke".freeze
45
+ s.rubygems_version = "3.1.2".freeze
46
+ s.summary = "Filbunke client".freeze
47
47
 
48
48
  if s.respond_to? :specification_version then
49
49
  s.specification_version = 4
50
+ end
50
51
 
51
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
- s.add_development_dependency(%q<shoulda>, ["~> 0"])
53
- s.add_runtime_dependency(%q<json>, ["= 1.8.3"])
54
- s.add_runtime_dependency(%q<typhoeus>, ["= 1.0.1"])
55
- s.add_runtime_dependency(%q<open4>, ["= 1.3.4"])
56
- s.add_runtime_dependency(%q<mime-types>, ["= 2.6.2"])
57
- s.add_runtime_dependency(%q<parallel>, ["= 1.6.1"])
58
- else
59
- s.add_dependency(%q<shoulda>, ["~> 0"])
60
- s.add_dependency(%q<json>, ["= 1.8.3"])
61
- s.add_dependency(%q<typhoeus>, ["= 1.0.1"])
62
- s.add_dependency(%q<open4>, ["= 1.3.4"])
63
- s.add_dependency(%q<mime-types>, ["= 2.6.2"])
64
- s.add_dependency(%q<parallel>, ["= 1.6.1"])
65
- end
52
+ if s.respond_to? :add_runtime_dependency then
53
+ s.add_development_dependency(%q<shoulda>.freeze, ["~> 0"])
54
+ s.add_runtime_dependency(%q<addressable>.freeze, ["= 2.8.0"])
55
+ s.add_runtime_dependency(%q<json>.freeze, ["= 2.6.1"])
56
+ s.add_runtime_dependency(%q<typhoeus>.freeze, ["= 1.4.0"])
57
+ s.add_runtime_dependency(%q<open4>.freeze, ["= 1.3.4"])
58
+ s.add_runtime_dependency(%q<mime-types>.freeze, ["= 3.4.1"])
59
+ s.add_runtime_dependency(%q<parallel>.freeze, ["= 1.21.0"])
66
60
  else
67
- s.add_dependency(%q<shoulda>, ["~> 0"])
68
- s.add_dependency(%q<json>, ["= 1.8.3"])
69
- s.add_dependency(%q<typhoeus>, ["= 1.0.1"])
70
- s.add_dependency(%q<open4>, ["= 1.3.4"])
71
- s.add_dependency(%q<mime-types>, ["= 2.6.2"])
72
- s.add_dependency(%q<parallel>, ["= 1.6.1"])
61
+ s.add_dependency(%q<shoulda>.freeze, ["~> 0"])
62
+ s.add_dependency(%q<addressable>.freeze, ["= 2.8.0"])
63
+ s.add_dependency(%q<json>.freeze, ["= 2.6.1"])
64
+ s.add_dependency(%q<typhoeus>.freeze, ["= 1.4.0"])
65
+ s.add_dependency(%q<open4>.freeze, ["= 1.3.4"])
66
+ s.add_dependency(%q<mime-types>.freeze, ["= 3.4.1"])
67
+ s.add_dependency(%q<parallel>.freeze, ["= 1.21.0"])
73
68
  end
74
69
  end
75
70
 
@@ -27,7 +27,16 @@ module Filbunke
27
27
  updated_files = updates["files"] || []
28
28
  new_checkpoint = updates["checkpoint"]
29
29
  if updated_files.empty?
30
- return last_checkpoint
30
+ if updates.key?("files")
31
+ return begin
32
+ fetch_remote_last_checkpoint
33
+ rescue => e
34
+ @logger.warn "Failed to fetch remote last_checkpoint #{@repository.name} will fall back to local last_checkpoint=#{last_checkpoint}"
35
+ last_checkpoint
36
+ end
37
+ else
38
+ return last_checkpoint
39
+ end
31
40
  end
32
41
  @logger.info "Updating repository: #{@repository.name}: #{updated_files.size} files. Checkpoint: #{last_checkpoint} ==> #{new_checkpoint}"
33
42
 
@@ -109,7 +118,7 @@ module Filbunke
109
118
  begin
110
119
  register_http = Net::HTTP.new(@repository.host, @repository.port)
111
120
  register_http.start do |http|
112
- request = Net::HTTP::Put.new(register_path)
121
+ request = Net::HTTP::Put.new(Addressable::URI.encode(register_path))
113
122
  response = http.request(request)
114
123
  if response.code.to_i != 204
115
124
  raise "Failed to register updated file: #{path}"
@@ -126,7 +135,7 @@ module Filbunke
126
135
  begin
127
136
  register_http = Net::HTTP.new(@repository.host, @repository.port)
128
137
  register_http.start do |http|
129
- request = Net::HTTP::Delete.new(register_path)
138
+ request = Net::HTTP::Delete.new(Addressable::URI.encode(register_path))
130
139
  response = http.request(request)
131
140
  if response.code.to_i != 204
132
141
  raise "Failed to register deleted file: #{path}"
@@ -142,7 +151,7 @@ module Filbunke
142
151
  touch_http = Net::HTTP.new(@repository.host, @repository.port)
143
152
  touch_http.start do |http|
144
153
  touch_path = "/#{UPDATES_ACTION}/#{@repository.name}/#{TOUCH_ACTION}"
145
- request = Net::HTTP::Put.new(touch_path)
154
+ request = Net::HTTP::Put.new(Addressable::URI.encode(touch_path))
146
155
  response = http.request(request)
147
156
  if response.code.to_i != 204
148
157
  raise "Failed to touch repository: #{@repository.name}"
@@ -150,11 +159,11 @@ module Filbunke
150
159
  end
151
160
  end
152
161
 
153
- def last_checkpoint
162
+ def fetch_remote_last_checkpoint
154
163
  last_checkpoint_http = Net::HTTP.new(@repository.host, @repository.port)
155
164
  last_checkpoint_http.start do |http|
156
165
  last_checkpoint_path = "/#{UPDATES_ACTION}/#{@repository.name}/#{LAST_CHECKPOINT_ACTION}"
157
- request = Net::HTTP::Get.new(last_checkpoint_path)
166
+ request = Net::HTTP::Get.new(Addressable::URI.encode(last_checkpoint_path))
158
167
  response = http.request(request)
159
168
  if response.code.to_i != 200
160
169
  raise "Failed to get last checkpoint for repository: #{@repository.name}"
@@ -220,7 +229,7 @@ module Filbunke
220
229
  updates_path = "#{updates_path}&batch_size=#{@repository.batch_size}" if @repository.batch_size > 0
221
230
  begin
222
231
  @logger.info "Fetching updated file list from #{updates_path}"
223
- request = Net::HTTP::Get.new(updates_path)
232
+ request = Net::HTTP::Get.new(Addressable::URI.encode(updates_path))
224
233
  response = http.request(request)
225
234
  if response.code.to_i == 200
226
235
  JSON.parse(response.body)
@@ -245,14 +254,14 @@ module Filbunke
245
254
  begin
246
255
  async_request = if @repository.user
247
256
  Typhoeus::Request.new(
248
- URI.escape(file.url),
257
+ Addressable::URI.encode(file.url),
249
258
  :followlocation => true,
250
259
  :username => @repository.user,
251
260
  :password => @repository.pass
252
261
  )
253
262
  else
254
263
  Typhoeus::Request.new(
255
- URI.escape(file.url),
264
+ Addressable::URI.encode(file.url),
256
265
  :followlocation => true
257
266
  )
258
267
  end
data/lib/filbunke.rb CHANGED
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
  require 'digest/md5'
6
6
  require 'typhoeus'
7
7
  require 'open4'
8
- require 'uri'
8
+ require 'addressable'
9
9
  require 'logger'
10
10
  require 'parallel'
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filbunke
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wouter de Bie
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-03-11 00:00:00.000000000 Z
14
+ date: 2022-02-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: shoulda
@@ -27,34 +27,48 @@ dependencies:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: addressable
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - '='
35
+ - !ruby/object:Gem::Version
36
+ version: 2.8.0
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - '='
42
+ - !ruby/object:Gem::Version
43
+ version: 2.8.0
30
44
  - !ruby/object:Gem::Dependency
31
45
  name: json
32
46
  requirement: !ruby/object:Gem::Requirement
33
47
  requirements:
34
48
  - - '='
35
49
  - !ruby/object:Gem::Version
36
- version: 1.8.3
50
+ version: 2.6.1
37
51
  type: :runtime
38
52
  prerelease: false
39
53
  version_requirements: !ruby/object:Gem::Requirement
40
54
  requirements:
41
55
  - - '='
42
56
  - !ruby/object:Gem::Version
43
- version: 1.8.3
57
+ version: 2.6.1
44
58
  - !ruby/object:Gem::Dependency
45
59
  name: typhoeus
46
60
  requirement: !ruby/object:Gem::Requirement
47
61
  requirements:
48
62
  - - '='
49
63
  - !ruby/object:Gem::Version
50
- version: 1.0.1
64
+ version: 1.4.0
51
65
  type: :runtime
52
66
  prerelease: false
53
67
  version_requirements: !ruby/object:Gem::Requirement
54
68
  requirements:
55
69
  - - '='
56
70
  - !ruby/object:Gem::Version
57
- version: 1.0.1
71
+ version: 1.4.0
58
72
  - !ruby/object:Gem::Dependency
59
73
  name: open4
60
74
  requirement: !ruby/object:Gem::Requirement
@@ -75,28 +89,28 @@ dependencies:
75
89
  requirements:
76
90
  - - '='
77
91
  - !ruby/object:Gem::Version
78
- version: 2.6.2
92
+ version: 3.4.1
79
93
  type: :runtime
80
94
  prerelease: false
81
95
  version_requirements: !ruby/object:Gem::Requirement
82
96
  requirements:
83
97
  - - '='
84
98
  - !ruby/object:Gem::Version
85
- version: 2.6.2
99
+ version: 3.4.1
86
100
  - !ruby/object:Gem::Dependency
87
101
  name: parallel
88
102
  requirement: !ruby/object:Gem::Requirement
89
103
  requirements:
90
104
  - - '='
91
105
  - !ruby/object:Gem::Version
92
- version: 1.6.1
106
+ version: 1.21.0
93
107
  type: :runtime
94
108
  prerelease: false
95
109
  version_requirements: !ruby/object:Gem::Requirement
96
110
  requirements:
97
111
  - - '='
98
112
  - !ruby/object:Gem::Version
99
- version: 1.6.1
113
+ version: 1.21.0
100
114
  description: Filbunke client and library
101
115
  email: technical@deltaprojects.com
102
116
  executables:
@@ -146,8 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
160
  - !ruby/object:Gem::Version
147
161
  version: '0'
148
162
  requirements: []
149
- rubyforge_project:
150
- rubygems_version: 2.4.8
163
+ rubygems_version: 3.1.2
151
164
  signing_key:
152
165
  specification_version: 4
153
166
  summary: Filbunke client