Class: DevArchive::Stores::Mysql::Backup
- Inherits:
-
Object
- Object
- DevArchive::Stores::Mysql::Backup
- Defined in:
- lib/dev_archive/stores.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#names ⇒ Object
readonly
Returns the value of attribute names.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(names, dir) ⇒ Backup
constructor
A new instance of Backup.
Constructor Details
#initialize(names, dir) ⇒ Backup
Returns a new instance of Backup.
31 32 33 34 |
# File 'lib/dev_archive/stores.rb', line 31 def initialize(names, dir) @names = names @dir = dir end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
30 31 32 |
# File 'lib/dev_archive/stores.rb', line 30 def dir @dir end |
#names ⇒ Object (readonly)
Returns the value of attribute names.
30 31 32 |
# File 'lib/dev_archive/stores.rb', line 30 def names @names end |
Class Method Details
.call(names, dir) ⇒ Object
26 27 28 |
# File 'lib/dev_archive/stores.rb', line 26 def self.call(names, dir) new(names, dir).call end |
Instance Method Details
#call ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/dev_archive/stores.rb', line 36 def call Cfg.shell.puts("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 |