filbunke 1.5.3 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -15,6 +15,7 @@ begin
15
15
  gem.executables = ['filbunked']
16
16
  gem.add_dependency 'json', '>= 1.1.7'
17
17
  gem.add_dependency 'typhoeus', '>= 0.2.0'
18
+ gem.add_dependency 'open4', '>= 1.0.1'
18
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
20
  end
20
21
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.3
1
+ 1.6.0
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.5.3"
8
+ s.version = "1.6.0"
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-12-07}
12
+ s.date = %q{2010-12-10}
13
13
  s.default_executable = %q{filbunked}
14
14
  s.description = %q{Filbunke client and library}
15
15
  s.email = %q{wouter@deltaprojects.se}
@@ -49,15 +49,18 @@ Gem::Specification.new do |s|
49
49
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
50
50
  s.add_runtime_dependency(%q<json>, [">= 1.1.7"])
51
51
  s.add_runtime_dependency(%q<typhoeus>, [">= 0.2.0"])
52
+ s.add_runtime_dependency(%q<open4>, [">= 1.0.1"])
52
53
  else
53
54
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
54
55
  s.add_dependency(%q<json>, [">= 1.1.7"])
55
56
  s.add_dependency(%q<typhoeus>, [">= 0.2.0"])
57
+ s.add_dependency(%q<open4>, [">= 1.0.1"])
56
58
  end
57
59
  else
58
60
  s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
59
61
  s.add_dependency(%q<json>, [">= 1.1.7"])
60
62
  s.add_dependency(%q<typhoeus>, [">= 0.2.0"])
63
+ s.add_dependency(%q<open4>, [">= 1.0.1"])
61
64
  end
62
65
  end
63
66
 
@@ -210,19 +210,27 @@ module Filbunke
210
210
  def update_hdfs_file!(file, local_file_path)
211
211
  begin
212
212
  ::FileUtils.mkdir_p(::File.dirname(local_file_path))
213
-
214
- 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}"
213
+ ::FileUtils.rm_f("#{local_file_path}.tmp")
214
+ hdfs_cmd = "#{@repository.hadoop_binary} fs -copyToLocal #{file.url} #{local_file_path}.tmp"
215
215
  @logger.log "Trying to update #{local_file_path} with '#{hdfs_cmd}'"
216
- system hdfs_cmd
217
-
218
- if $?.exitstatus == 0 then
219
- return true
216
+
217
+ pid, stdin, stdout, stderr = Open4::popen4 hdfs_cmd
218
+ ignored, status = Process::waitpid2 pid
219
+
220
+ if status.exitstatus == 0 then
221
+ begin
222
+ ::FileUtils.mv "#{local_file_path}.tmp", local_file_path
223
+ return true
224
+ rescue StandardError => e
225
+ @logger.log "Failed to move hdfs file #{file.url}: #{e.message}"
226
+ return false
227
+ end
220
228
  else
221
- @logger.log "Failed to update file #{file.url}!"
229
+ @logger.log "Failed to update hdfs file #{file.url}! Unable to execute #{hfds_cmd}"
222
230
  return false
223
231
  end
224
232
  rescue StandardError => e
225
- @logger.log "Failed to update file #{file.url}: #{e.message}"
233
+ @logger.log "Failed to update hdfs file #{file.url}: #{e.message}"
226
234
  return false
227
235
  end
228
236
  end
@@ -35,7 +35,8 @@ module Filbunke
35
35
  end
36
36
 
37
37
  def run!
38
- @logger.log("Starting filbunked")
38
+ version = ::File.read(::File.expand_path(::File.join(::File.dirname(__FILE__), "../../VERSION"))).chomp
39
+ @logger.log("Starting filbunked version #{version}")
39
40
  while true
40
41
  begin
41
42
 
data/lib/filbunke.rb CHANGED
@@ -4,6 +4,7 @@ require 'net/http'
4
4
  require 'fileutils'
5
5
  require 'digest/md5'
6
6
  require 'typhoeus'
7
+ require 'open4'
7
8
 
8
9
  require 'filbunke/client.rb'
9
10
  require 'filbunke/file.rb'
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 5
8
- - 3
9
- version: 1.5.3
7
+ - 6
8
+ - 0
9
+ version: 1.6.0
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-12-07 00:00:00 +01:00
17
+ date: 2010-12-10 00:00:00 +01:00
18
18
  default_executable: filbunked
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -57,6 +57,20 @@ dependencies:
57
57
  version: 0.2.0
58
58
  type: :runtime
59
59
  version_requirements: *id003
60
+ - !ruby/object:Gem::Dependency
61
+ name: open4
62
+ prerelease: false
63
+ requirement: &id004 !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 1
69
+ - 0
70
+ - 1
71
+ version: 1.0.1
72
+ type: :runtime
73
+ version_requirements: *id004
60
74
  description: Filbunke client and library
61
75
  email: wouter@deltaprojects.se
62
76
  executables: