Class: S3Archive::CompressAndUpload

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/s3archive/compress_and_upload.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

#logger

Constructor Details

#initialize(path) ⇒ CompressAndUpload

Returns a new instance of CompressAndUpload.



20
21
22
# File 'lib/s3archive/compress_and_upload.rb', line 20

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



19
20
21
# File 'lib/s3archive/compress_and_upload.rb', line 19

def path
  @path
end

Class Method Details

.run(path) ⇒ Object



15
16
17
# File 'lib/s3archive/compress_and_upload.rb', line 15

def self.run(path)
  new(path).run
end

Instance Method Details

#runObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/s3archive/compress_and_upload.rb', line 24

def run
  unless File.exists?(path)
    logger.error("COULD NOT FIND '#{path}'")
    return
  end

  logger.info("* Processing #{path}")

  compress! if compress?
  upload!
  delete_tempfile! if compress?
end