Class: Bard::Backup
- Inherits:
-
Object
- Object
- Bard::Backup
- Defined in:
- lib/bard/backup.rb,
lib/bard/backup/finder.rb,
lib/bard/backup/deleter.rb,
lib/bard/backup/railtie.rb,
lib/bard/backup/restore.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/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, Finder, LocalBackhoe, NotFound, Railtie, Restore, S3Destination, S3Tree, UploadDestination
Constant Summary collapse
- FILE_TREE_KEYS =
[:access_key_id, :secret_access_key, :session_token, :region, :encryption_key].freeze
- VERSION =
"0.12.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
- .available(destinations: nil) ⇒ Object
- .create!(destination_hashes = nil, **config) ⇒ Object
- .latest ⇒ Object
- .restore!(at:, drop_and_create: true, destinations: nil) ⇒ Object
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.
34 35 36 37 38 |
# File 'lib/bard/backup.rb', line 34 def initialize(timestamp:, size: nil, destinations: []) @timestamp = @size = size @destinations = destinations end |
Instance Attribute Details
#destinations ⇒ Object (readonly)
Returns the value of attribute destinations.
32 33 34 |
# File 'lib/bard/backup.rb', line 32 def destinations @destinations end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
32 33 34 |
# File 'lib/bard/backup.rb', line 32 def size @size end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
32 33 34 |
# File 'lib/bard/backup.rb', line 32 def @timestamp end |
Class Method Details
.available(destinations: nil) ⇒ Object
24 25 26 |
# File 'lib/bard/backup.rb', line 24 def self.available(destinations: nil) Finder.new(destinations). end |
.create!(destination_hashes = nil, **config) ⇒ Object
14 15 16 17 18 |
# File 'lib/bard/backup.rb', line 14 def self.create!(destination_hashes = nil, **config) backup = Database.create!(destination_hashes, **config) FileTree.create!(**config.slice(*FILE_TREE_KEYS)) backup end |
Instance Method Details
#as_json ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/bard/backup.rb', line 40 def as_json(*) { timestamp: &.iso8601, size: size, destinations: destinations }.compact end |