Class: Bard::Backup
- Inherits:
-
Object
- Object
- Bard::Backup
- Defined in:
- lib/bard/backup.rb,
lib/bard/backup/deleter.rb,
lib/bard/backup/railtie.rb,
lib/bard/backup/s3_tree.rb,
lib/bard/backup/version.rb,
lib/bard/backup/database.rb,
lib/bard/backup/encryptor.rb,
lib/bard/backup/file_tree.rb,
lib/bard/backup/destination.rb,
lib/bard/backup/latest_finder.rb,
lib/bard/backup/local_backhoe.rb,
lib/bard/backup/rails_credentials.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
Modules: Database, RailsCredentials Classes: CachedLocalBackhoe, Deleter, Destination, Encryptor, Error, FileTree, LatestFinder, LocalBackhoe, NotFound, Railtie, S3Destination, S3Tree, UploadDestination
Constant Summary collapse
- FILE_TREE_KEYS =
[:access_key_id, :secret_access_key, :session_token, :region, :encryption_key].freeze
- VERSION =
"0.10.0"
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.
23 24 25 26 27 |
# File 'lib/bard/backup.rb', line 23 def initialize(timestamp:, size: nil, destinations: []) @timestamp = @size = size @destinations = destinations end |
Instance Attribute Details
#destinations ⇒ Object (readonly)
Returns the value of attribute destinations.
21 22 23 |
# File 'lib/bard/backup.rb', line 21 def destinations @destinations end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
21 22 23 |
# File 'lib/bard/backup.rb', line 21 def size @size end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
21 22 23 |
# File 'lib/bard/backup.rb', line 21 def @timestamp end |
Class Method Details
.create!(destination_hashes = nil, **config) ⇒ Object
11 12 13 14 15 |
# File 'lib/bard/backup.rb', line 11 def self.create!(destination_hashes = nil, **config) backup = Database.create!(destination_hashes, **config) FileTree.create!(**config.slice(*FILE_TREE_KEYS)) backup end |
.latest ⇒ Object
17 18 19 |
# File 'lib/bard/backup.rb', line 17 def self.latest LatestFinder.new.call end |
Instance Method Details
#as_json ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/bard/backup.rb', line 29 def as_json(*) { timestamp: &.iso8601, size: size, destinations: destinations }.compact end |