class Rstreet::BucketCommunicator
Public Class Methods
new(s3_bucket, dry_run)
click to toggle source
# File lib/bucket_communicator.rb, line 7 def initialize(s3_bucket, dry_run) @s3, @dry_run = S3.new(s3_bucket), dry_run end
Public Instance Methods
pull_manifest(manifest_uploadable)
click to toggle source
# File lib/bucket_communicator.rb, line 11 def pull_manifest(manifest_uploadable) manifest_file = @s3.get_file(manifest_uploadable) if manifest_file ManifestBuilder.new(manifest_file).read else ManifestBuilder.empty_manifest end end
upload(uploadables)
click to toggle source
# File lib/bucket_communicator.rb, line 20 def upload(uploadables) # TODO: refactor into sep procs uploadables.map do |u| if dry_run? puts "dry run upload: #{u.name}" else begin @s3.put_file(u) puts "uploaded: #{u.name}" rescue StandardError => e puts "error uploading: #{u.name}", e end end end end
Private Instance Methods
dry_run?()
click to toggle source
# File lib/bucket_communicator.rb, line 38 def dry_run? @dry_run end