Sha256: d69dbca1d5b2a0667516ee2178d0cd810801c8b0ba976ce884c5af1657951cfe

Contents?: true

Size: 749 Bytes

Versions: 36

Compression:

Stored size: 749 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 unless file.keep_on_filesystem_after_upload_to_s3?
          :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

36 entries across 36 versions & 1 rubygems

Version Path
pageflow-12.6.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.5.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.4.1 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.4.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.3.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.2.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.1.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.4 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.3 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.2 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.1 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.0 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.0.rc7 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.0.rc6 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-0.11.4 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.0.rc5 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.0.rc4 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.0.rc3 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.0.rc2 app/jobs/pageflow/upload_file_to_s3_job.rb
pageflow-12.0.0.rc1 app/jobs/pageflow/upload_file_to_s3_job.rb