filbunke 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/filbunke.gemspec +2 -2
  3. data/lib/filbunke/client.rb +17 -16
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0
1
+ 1.4.1
data/filbunke.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{filbunke}
8
- s.version = "1.4.0"
8
+ s.version = "1.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wouter de Bie"]
12
- s.date = %q{2010-11-22}
12
+ s.date = %q{2010-12-02}
13
13
  s.default_executable = %q{filbunked}
14
14
  s.description = %q{Filbunke client and library}
15
15
  s.email = %q{wouter@deltaprojects.se}
@@ -31,20 +31,26 @@ module Filbunke
31
31
  file = File.new(raw_file)
32
32
 
33
33
  local_file_path = ::File.join(repository.local_path, file.path)
34
- if file_needs_update?(file, local_file_path)
34
+ if file.state == "DELETED" then
35
+ delete_file!(local_file_path)
35
36
 
36
- if update_file!(file, local_file_path) then
37
- @callbacks.each do |callback|
38
- callback.on_update(file)
37
+ else
38
+
39
+ if file_needs_update?(file, local_file_path)
40
+
41
+ if update_file!(file, local_file_path) then
42
+ @callbacks.each do |callback|
43
+ callback.on_update(file)
44
+ end
45
+ yield file
46
+ else
47
+ @logger.log "Unable to get file #{file.url} ==> #{file.path}!"
48
+ failure = true
39
49
  end
40
- yield file
50
+
41
51
  else
42
- @logger.log "Unable to get file #{file.url} ==> #{file.path}!"
43
- failure = true
52
+ @logger.log "File exists with correct hash: #{local_file_path}"
44
53
  end
45
-
46
- else
47
- @logger.log "File exists with correct hash: #{local_file_path}"
48
54
  end
49
55
  end
50
56
  failure ? last_checkpoint : (new_checkpoint || last_checkpoint)
@@ -110,11 +116,6 @@ module Filbunke
110
116
 
111
117
  def update_file!(file, local_file_path)
112
118
 
113
- if file.state == "DELETED" then
114
- delete_file!(local_file_path)
115
- return true
116
- end
117
-
118
119
  if file.url =~ /^http:\/\//
119
120
  update_http_file!(file, local_file_path)
120
121
  elsif file.url =~ /^hdfs:\/\//
@@ -186,7 +187,7 @@ module Filbunke
186
187
  begin
187
188
  ::FileUtils.mkdir_p(::File.dirname(local_file_path))
188
189
 
189
- hdfs_cmd = "#{@repository.hadoop_binary} fs -copyToLocal #{file.url} #{local_file_path}.tmp &> /dev/null && mv #{local_file_path}.tmp #{local_file_path}"
190
+ hdfs_cmd = "rm -f #{local_file_path}.tmp; #{@repository.hadoop_binary} fs -copyToLocal #{file.url} #{local_file_path}.tmp &> /dev/null && mv #{local_file_path}.tmp #{local_file_path}"
190
191
  @logger.log "Trying to update #{local_file_path} with '#{hdfs_cmd}'"
191
192
  system hdfs_cmd
192
193
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 4
8
- - 0
9
- version: 1.4.0
8
+ - 1
9
+ version: 1.4.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Wouter de Bie
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-22 00:00:00 +01:00
17
+ date: 2010-12-02 00:00:00 +01:00
18
18
  default_executable: filbunked
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency