Sha256: cd808e19c03914c811f0c5042a67e246dd1c7cdffe635afcc84316b945eddcb1

Contents?: true

Size: 693 Bytes

Versions: 10

Compression:

Stored size: 693 Bytes

Contents

module Pageflow
  class UploadFileToS3Job
    @queue = :slow

    extend StateMachineJob

    def self.perform_with_result(file, options)
      if file && file.attachment_on_filesystem.file?
        if File.exists?(file.attachment_on_filesystem.path)
          file.attachment_on_s3 = file.attachment_on_filesystem
          file.save!

          file.attachment_on_filesystem.destroy
          :ok
        else
          logger.info "#{file.class.name} #{file.id} not yet transfered to instance."
          :pending
        end
      else
        logger.warn "#{file.class.name} #{file.id} does not have an attachment on the file system. ignoring."
        :error
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pageflow-0.4.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-0.3.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-0.2.1 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-0.2.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-0.1.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-0.0.5 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-0.0.4 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-0.0.3 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-0.0.2 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-0.0.1 app/jobs/pageflow/upload_file_to_s3_job.rb