Class: EDB::Dumper
- Inherits:
-
Object
- Object
- EDB::Dumper
- Defined in:
- lib/edb/dumper.rb
Constant Summary collapse
- PATTERN =
->(time) { "#{time.day}_#{time.month}_#{time.year}" }
Instance Method Summary collapse
-
#initialize(opts = nil) ⇒ Dumper
constructor
A new instance of Dumper.
- #run ⇒ Object
Constructor Details
Instance Method Details
#run ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/edb/dumper.rb', line 33 def run create_dir ::EDB.opts[:DBMS].each do |dbms| dbms_name = dbms[0] unless EDB::DBMS.supports?(dbms_name) module_not_supported(dbms_name) next end dir_name = File.join(@dir_name, dbms_name.to_s) FileUtils.mkdir(dir_name) unless Dir.exists?(dir_name) files = EDB::DBMS.backup(dbms_name, dir_name) if ::EDB.opts[:CRYPTOGRAPHY] != nil ::EDB.opts[:CRYPTOGRAPHY].each do |cryptography| algorithm = cryptography[0] if ::EDB::Cryptography.supports?(algorithm) files.each { |file| ::EDB::Cryptography.encrypt(algorithm, file) } else module_not_supported(algorithm) end end end if ::EDB.opts[:STORAGE] != nil ::EDB.opts[:STORAGE].each do |storage| service = storage[0] if ::EDB::Storage.supports?(service) files.each { |file| ::EDB::Storage.upload(service, file) } else module_not_supported(service) end end end end end |