filbunke 1.13.2 → 1.13.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/VERSION +1 -1
- data/filbunke.gemspec +2 -2
- data/lib/filbunke/client.rb +12 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjBmZGY5ZWY1MjM2ZjM4ZTZkYWMxZjg3OTJkMmExMTQ5MTNkNjdkNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Yjk5ZTMzZmUxMzE3YzkxNzk4ZWNhMWUwZDU2NmYwMjFkZWNmZWMwNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzhiMmMyMzFiNzcxNTZlOTJjMjgzZTQ0ODRlNTE5YTZjYTExMTY2ZGM2OTA5
|
10
|
+
ZDZiMzJhZWVlN2EyOWMzZWJiNjQ1YjU1M2ZhMWYyOGNlY2YzMTk2NmJkZGFj
|
11
|
+
ZWQ3OWE3YTdjNTVkODc2ZjI1ZTcxYWVjNDE4NTc3NzIzYjlkYjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmY0ZWI5OTJjYWRiZjQxNmYwZjZlN2UxZGQ0MDQ4NTFkMzBmNWQ4ZDc0NzAz
|
14
|
+
MmMxYWEyMTM3ZDgzM2VkYTE3MWI3ZmI3OGIxNmUzMmQ0ZjYxYzhjMTEyZTRm
|
15
|
+
NzRkNzhlZmRlZWYxYzhjYzlkNmJiNmEzNjQ0NjNlMzQ4YjU1ZmY=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.13.
|
1
|
+
1.13.3
|
data/filbunke.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: filbunke 1.13.
|
5
|
+
# stub: filbunke 1.13.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "filbunke"
|
9
|
-
s.version = "1.13.
|
9
|
+
s.version = "1.13.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
data/lib/filbunke/client.rb
CHANGED
@@ -240,6 +240,8 @@ module Filbunke
|
|
240
240
|
end
|
241
241
|
|
242
242
|
def update_http_file!(file, local_file_path)
|
243
|
+
downloaded_file = nil
|
244
|
+
tmp_filename = "#{local_file_path}-#{(0...8).map { (65 + rand(26)).chr }.join}.tmp"
|
243
245
|
begin
|
244
246
|
async_request = if @repository.user
|
245
247
|
Typhoeus::Request.new(
|
@@ -255,8 +257,7 @@ module Filbunke
|
|
255
257
|
)
|
256
258
|
end
|
257
259
|
|
258
|
-
|
259
|
-
tmp_filename = "#{local_file_path}-#{(0...8).map { (65 + rand(26)).chr }.join}.tmp"
|
260
|
+
|
260
261
|
async_request.on_headers do |response|
|
261
262
|
if response.code != 200
|
262
263
|
raise "Failed to fetch response(#{response.code}) for url '#{response.effective_url}' ---\n\t #{response.inspect}"
|
@@ -274,10 +275,12 @@ module Filbunke
|
|
274
275
|
unless downloaded_file.nil?
|
275
276
|
downloaded_file.close
|
276
277
|
end
|
277
|
-
if
|
278
|
-
|
279
|
-
|
280
|
-
|
278
|
+
if ::File.exist?(tmp_filename)
|
279
|
+
if response.code == 200
|
280
|
+
::FileUtils.mv(tmp_filename, local_file_path)
|
281
|
+
else
|
282
|
+
::FileUtils.rm(tmp_filename)
|
283
|
+
end
|
281
284
|
end
|
282
285
|
true
|
283
286
|
end
|
@@ -287,6 +290,9 @@ module Filbunke
|
|
287
290
|
rescue RuntimeError, SystemCallError, StandardError => e
|
288
291
|
msg = ["#{e.class} - #{e.message}", *e.backtrace].join("\n\t")
|
289
292
|
@logger.error "Failed to update file #{file.url}: #{msg}"
|
293
|
+
if ::File.exist?(tmp_filename)
|
294
|
+
::FileUtils.rm(tmp_filename)
|
295
|
+
end
|
290
296
|
false
|
291
297
|
end
|
292
298
|
end
|