Class: SnapshotArchive::Stores::Mysql::Backup
- Inherits:
-
Object
- Object
- SnapshotArchive::Stores::Mysql::Backup
- Defined in:
- lib/snapshot_archive/stores.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#names ⇒ Object
readonly
Returns the value of attribute names.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(dir:, id:, args:) ⇒ Backup
constructor
A new instance of Backup.
Constructor Details
#initialize(dir:, id:, args:) ⇒ Backup
Returns a new instance of Backup.
42 43 44 45 46 |
# File 'lib/snapshot_archive/stores.rb', line 42 def initialize(dir:, id:, args:, **) @dir = dir @id = id @names = args end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
41 42 43 |
# File 'lib/snapshot_archive/stores.rb', line 41 def dir @dir end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
41 42 43 |
# File 'lib/snapshot_archive/stores.rb', line 41 def id @id end |
#names ⇒ Object (readonly)
Returns the value of attribute names.
41 42 43 |
# File 'lib/snapshot_archive/stores.rb', line 41 def names @names end |
Class Method Details
.call ⇒ Object
37 38 39 |
# File 'lib/snapshot_archive/stores.rb', line 37 def self.call(...) new(...).call end |
Instance Method Details
#call ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/snapshot_archive/stores.rb', line 48 def call Cfg.shell.debug("backing up #{names} into #{dir}") path = File.join(dir, "mysql.sql.gz") Cfg.shell.run(<<~SH) mysqldump \ --add-drop-database \ --databases #{names.join(" ")} \ | gzip > #{path} SH { type: "mysql", path: path, databases: names } end |