Class: S3Archive::Postrotate

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

#logger

Constructor Details

#initialize(logfile_path) ⇒ Postrotate

Returns a new instance of Postrotate.



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

def initialize(logfile_path)
  @logfile_path = logfile_path
end

Instance Attribute Details

#logfile_pathObject (readonly)

Returns the value of attribute logfile_path.



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

def logfile_path
  @logfile_path
end

Class Method Details

.run(logfile_path) ⇒ Object



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

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

Instance Method Details

#runObject



24
25
26
27
28
29
# File 'lib/s3archive/postrotate.rb', line 24

def run
  raise "Could not find #{prev_logfile}" unless File.exists?(prev_logfile)
  bucket = S3Archive.config.bucket
  logger.info("* Uploading #{prev_logfile} to s3://#{bucket}/#{key}")
  S3FileSynchronizer.run(prev_logfile, bucket, key)
end