sluice 0.0.3 → 0.0.4

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 (3) hide show
  1. data/lib/sluice.rb +1 -1
  2. data/lib/sluice/storage/s3.rb +11 -5
  3. metadata +3 -3
data/lib/sluice.rb CHANGED
@@ -19,5 +19,5 @@ require 'sluice/storage/s3'
19
19
 
20
20
  module Sluice
21
21
  NAME = "sluice"
22
- VERSION = "0.0.3"
22
+ VERSION = "0.0.4"
23
23
  end
@@ -285,7 +285,9 @@ module Sluice
285
285
  # Download is a stand-alone operation vs move/copy/delete
286
286
  if operation == :download
287
287
  retry_x(
288
- download_file(s3, file, target), RETRIES,
288
+ Sluice::Storage::S3,
289
+ [:download_file, s3, file, target],
290
+ RETRIES,
289
291
  " +/> #{target}",
290
292
  "Problem downloading #{file.key}. Retrying.")
291
293
  end
@@ -293,7 +295,9 @@ module Sluice
293
295
  # A move or copy starts with a copy file
294
296
  if [:move, :copy].include? operation
295
297
  retry_x(
296
- file.copy(to_loc_or_dir.bucket, target), RETRIES,
298
+ file,
299
+ [:copy, to_loc_or_dir.bucket, target],
300
+ RETRIES,
297
301
  " +-> #{to_loc_or_dir.bucket}/#{target}",
298
302
  "Problem copying #{file.key}. Retrying.")
299
303
  end
@@ -301,7 +305,9 @@ module Sluice
301
305
  # A move or delete ends with a delete
302
306
  if [:move, :delete].include? operation
303
307
  retry_x(
304
- file.destroy(), RETRIES,
308
+ file,
309
+ [:destroy],
310
+ RETRIES,
305
311
  " x #{source}",
306
312
  "Problem destroying #{file.key}. Retrying.")
307
313
  end
@@ -323,10 +329,10 @@ module Sluice
323
329
  # +retries+:: Number of retries to attempt
324
330
  # +attempt_msg+:: Message to puts on each attempt
325
331
  # +failure_msg+:: Message to puts on each failure
326
- def retry_x(function, retries, attempt_msg, failure_msg)
332
+ def retry_x(object, send_args, retries, attempt_msg, failure_msg)
327
333
  i = 0
328
334
  begin
329
- function
335
+ object.send(*send_args)
330
336
  puts attempt_msg
331
337
  rescue
332
338
  raise unless i < retries
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sluice
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Dean