Sha256: 682b78bd92326911a34b5f88e5971cbdd6067c69e68115a27b8112819dad178f
Contents?: true
Size: 781 Bytes
Versions: 3
Compression:
Stored size: 781 Bytes
Contents
require 'aws-sdk' require 'upload' class UploadManager def initialize (bucket, path_prefix) abort "error: must supply an S3 bucket" unless bucket abort "error: must supply a path prefix of at least '/'" unless path_prefix @uploads = [] @path_prefix = path_prefix @bucket = bucket end def enqueue_upload(expected_path, actual_path) @uploads.push(Upload.new(expected_path, actual_path)) end def upload(folder_name) return nil unless @uploads.count > 0 @uploads.each do |upload| upload.upload(@bucket, @path_prefix) end index_object = @bucket.objects[@path_prefix + folder_name + "/index.html"] index_object.write(to_html) index_object.url_for(:read).to_s end def to_html "<html><body>#{@uploads.map(&:to_html).join}</body></html>" end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
second_curtain-0.1.1 | lib/second_curtain/upload_manager.rb |
second_curtain-0.1.0 | lib/second_shutter/upload_manager.rb |
upload-ios-snapshot-test-case-0.0.1 | lib/upload_manager.rb |