Sha256: 69fc3eec98713ea5d65199b2cd531d4bda6e16faf48ea00abd0df5a2aa0114c7
Contents?: true
Size: 864 Bytes
Versions: 3
Compression:
Stored size: 864 Bytes
Contents
require 'aws-sdk' require 'second_curtain/upload' require 'second_curtain/web_preview' class UploadManager def initialize (bucket, path_prefix) abort "error: Second Curtain must supply an S3 bucket" unless bucket abort "error: Second Curtain 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 preview = WebPreview.new(@uploads) index_object = @bucket.objects[@path_prefix + folder_name + "/index.html"] index_object.write(preview.generate_html) index_object.public_url.to_s end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
second_curtain-0.2.3 | lib/second_curtain/upload_manager.rb |
second_curtain-0.2.2 | lib/second_curtain/upload_manager.rb |
second_curtain-0.2.0 | lib/second_curtain/upload_manager.rb |