filbunke 2.1.0 → 2.1.2

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.
Files changed (5) hide show
  1. checksums.yaml +13 -5
  2. data/VERSION +1 -1
  3. data/filbunke.gemspec +4 -4
  4. data/lib/filbunke/client.rb +12 -9
  5. metadata +10 -10
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bdf27520bab96738e5a12465ccd526ee4d3d837a
4
- data.tar.gz: dbb247721d46a2b8aafe2d5942120850b304fd3a
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWZhNTI3YWExNDIzZWI2OTNjN2I2Y2JlZGY1M2IwY2Y2M2ZiNGMwZQ==
5
+ data.tar.gz: !binary |-
6
+ MmUyZWUyNjllY2RiNjFhZmRhYTAyNDNiYzI0MTg5MjcyODNmMDY5Mg==
5
7
  SHA512:
6
- metadata.gz: 6754b1ac1376a1f491d7159fe09ab95b474637b144d2ab09fdbea87fd724234e2cf9ee5d535a6678cfbcca585dd681f186df7c193cceb6e0480d3f154536825c
7
- data.tar.gz: 17084f8cc91464c6a9a2d1a47f5b2df0c732bc338bbd877f2795af9e16d44c80c1aea2d0d38304adee1bd5e8c06dce0d8503518f720da45253e4dea1123c3ee9
8
+ metadata.gz: !binary |-
9
+ M2YxNjMxZjBkYThjYWIwMzg3ZmM2NGU2ODQyNWUyYjVkZGY0OGJhNjFiOTdh
10
+ OTU1Njk2NTAwMmVjNzFiMDUxOTA1OTM5NmUxY2JmODMwZGQ3MTljNTI4OTky
11
+ ODUwMmNmNzhiZDhmMTljYTM5YWZhZmEzOTJlMjY0NzhhMTYxNzE=
12
+ data.tar.gz: !binary |-
13
+ NjhkNWYzNmM5YjI1YTQ1MDI1OTBlZGVhODQ4NGJlNTZiODUxNDkzN2QzNTg2
14
+ Mjg3YzFhZWZjZjAwNDYyMTY3NzA5YjhjZWZhZDBhYzEwNWE0NmE5OWMwNWU3
15
+ MmI3ZjM1NjVkNjUxMmQwMDAxYTNkMzQ4ZTljZDI3OWI2ZmE2ZjY=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.2
data/filbunke.gemspec CHANGED
@@ -2,16 +2,16 @@
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 2.1.0 ruby lib
5
+ # stub: filbunke 2.1.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "filbunke"
9
- s.version = "2.1.0"
9
+ s.version = "2.1.2"
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"]
13
13
  s.authors = ["Wouter de Bie", "Bjorn Sperber", "Karl Ravn", "Magnus Spangdal"]
14
- s.date = "2016-03-05"
14
+ s.date = "2016-03-11"
15
15
  s.description = "Filbunke client and library"
16
16
  s.email = "technical@deltaprojects.com"
17
17
  s.executables = ["filbunked"]
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
  "test/test_filbunke.rb"
43
43
  ]
44
44
  s.homepage = "https://rubygems.org/gems/filbunke"
45
- s.rubygems_version = "2.4.5.1"
45
+ s.rubygems_version = "2.2.2"
46
46
  s.summary = "Filbunke client"
47
47
 
48
48
  if s.respond_to? :specification_version then
@@ -25,9 +25,9 @@ module Filbunke
25
25
  def with_updated_files(last_checkpoint)
26
26
  updates = get_updated_file_list(last_checkpoint)
27
27
  updated_files = updates["files"] || []
28
- new_checkpoint = updates["checkpoint"] || 0
28
+ new_checkpoint = updates["checkpoint"]
29
29
  if updated_files.empty?
30
- return new_checkpoint
30
+ return last_checkpoint
31
31
  end
32
32
  @logger.info "Updating repository: #{@repository.name}: #{updated_files.size} files. Checkpoint: #{last_checkpoint} ==> #{new_checkpoint}"
33
33
 
@@ -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,13 +257,12 @@ module Filbunke
255
257
  )
256
258
  end
257
259
 
258
- downloaded_file = nil
259
260
  async_request.on_headers do |response|
260
261
  if response.code != 200
261
262
  raise "Downloading file #{response.effective_url} failed with status code #{response.code} --- #{response.inspect}"
262
263
  end
263
264
  ::FileUtils.mkdir_p(::File.dirname(local_file_path))
264
- downloaded_file = ::File.new("#{local_file_path}.tmp", "wb")
265
+ downloaded_file = ::File.new(tmp_filename, "wb")
265
266
  @logger.debug("Updating file #{local_file_path}")
266
267
  end
267
268
 
@@ -273,10 +274,12 @@ module Filbunke
273
274
  async_request.on_complete do |response|
274
275
  unless downloaded_file.nil?
275
276
  downloaded_file.close unless downloaded_file.closed?
276
- if response.code == 200
277
- ::FileUtils.mv "#{local_file_path}.tmp", local_file_path
278
- else
279
- ::FileUtils.rm "#{local_file_path}.tmp" if ::File.exist? "#{local_file_path}.tmp"
277
+ if ::File.exist? tmp_filename
278
+ if response.code == 200
279
+ ::FileUtils.mv tmp_filename, local_file_path
280
+ else
281
+ ::FileUtils.rm tmp_filename
282
+ end
280
283
  end
281
284
  end
282
285
  true
@@ -289,7 +292,7 @@ module Filbunke
289
292
  @logger.error "Failed to update file #{file.url}: #{msg}"
290
293
  unless downloaded_file.nil?
291
294
  downloaded_file.close unless downloaded_file.closed?
292
- ::FileUtils.rm "#{local_file_path}.tmp" if ::File.exist? "#{local_file_path}.tmp"
295
+ ::FileUtils.rm tmp_filename if ::File.exist? tmp_filename
293
296
  end
294
297
  false
295
298
  end
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.0
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wouter de Bie
@@ -11,20 +11,20 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-03-05 00:00:00.000000000 Z
14
+ date: 2016-03-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: shoulda
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - "~>"
20
+ - - ~>
21
21
  - !ruby/object:Gem::Version
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
@@ -104,9 +104,9 @@ executables:
104
104
  extensions: []
105
105
  extra_rdoc_files: []
106
106
  files:
107
- - ".gitignore"
108
- - ".ruby-gemset"
109
- - ".ruby-version"
107
+ - .gitignore
108
+ - .ruby-gemset
109
+ - .ruby-version
110
110
  - Gemfile
111
111
  - LICENSE
112
112
  - README.rdoc
@@ -137,17 +137,17 @@ require_paths:
137
137
  - lib
138
138
  required_ruby_version: !ruby/object:Gem::Requirement
139
139
  requirements:
140
- - - ">="
140
+ - - ! '>='
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - ">="
145
+ - - ! '>='
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0'
148
148
  requirements: []
149
149
  rubyforge_project:
150
- rubygems_version: 2.4.5.1
150
+ rubygems_version: 2.2.2
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: Filbunke client