Class: Bard::Backup
- Inherits:
-
Object
- Object
- Bard::Backup
- Defined in:
- lib/bard/backup.rb,
lib/bard/backup/s3_dir.rb,
lib/bard/backup/deleter.rb,
lib/bard/backup/railtie.rb,
lib/bard/backup/version.rb,
lib/bard/backup/destination.rb,
lib/bard/backup/latest_finder.rb,
lib/bard/backup/local_backhoe.rb,
lib/bard/backup/cached_local_backhoe.rb,
lib/bard/backup/destination/s3_destination.rb,
lib/bard/backup/destination/upload_destination.rb
Defined Under Namespace
Classes: CachedLocalBackhoe, Deleter, Destination, Error, LatestFinder, LocalBackhoe, NotFound, Railtie, S3Destination, S3Dir, UploadDestination
Constant Summary collapse
- VERSION =
"0.9.1"
Instance Attribute Summary collapse
-
#destinations ⇒ Object
readonly
Returns the value of attribute destinations.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(timestamp:, size: nil, destinations: []) ⇒ Backup
constructor
A new instance of Backup.
Constructor Details
#initialize(timestamp:, size: nil, destinations: []) ⇒ Backup
Returns a new instance of Backup.
32 33 34 35 36 |
# File 'lib/bard/backup.rb', line 32 def initialize(timestamp:, size: nil, destinations: []) = @size = size @destinations = destinations end |
Instance Attribute Details
#destinations ⇒ Object (readonly)
Returns the value of attribute destinations.
30 31 32 |
# File 'lib/bard/backup.rb', line 30 def destinations @destinations end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
30 31 32 |
# File 'lib/bard/backup.rb', line 30 def size @size end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
30 31 32 |
# File 'lib/bard/backup.rb', line 30 def end |
Class Method Details
.create!(destination_hashes = nil, **config) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bard/backup.rb', line 7 def self.create!(destination_hashes = nil, **config) if destination_hashes.nil? && !config.empty? destination_hashes = [config] end destination_hashes ||= Bard::Config.current.backup.destinations destinations = if destination_hashes.is_a?(Hash) [destination_hashes] else Array(destination_hashes) end result = nil destinations.each do |hash| result = Destination.build(hash).call end result end |
.latest ⇒ Object
26 27 28 |
# File 'lib/bard/backup.rb', line 26 def self.latest LatestFinder.new.call end |
Instance Method Details
#as_json ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/bard/backup.rb', line 38 def as_json(*) { timestamp: &.iso8601, size: size, destinations: destinations }.compact end |