Module: Dumpman::Commandor
Instance Method Summary collapse
- #create_db ⇒ Object
- #drop_db ⇒ Object
- #dump ⇒ Object
- #restore ⇒ Object
- #unzip ⇒ Object
- #zip ⇒ Object
Instance Method Details
#create_db ⇒ Object
42 43 44 |
# File 'lib/dumpman/comandor.rb', line 42 def create_db Dumpman::Database.create end |
#drop_db ⇒ Object
38 39 40 |
# File 'lib/dumpman/comandor.rb', line 38 def drop_db Dumpman::Database.drop end |
#dump ⇒ Object
28 29 30 |
# File 'lib/dumpman/comandor.rb', line 28 def dump Dumpman::Database.dump end |
#restore ⇒ Object
32 33 34 35 36 |
# File 'lib/dumpman/comandor.rb', line 32 def restore Dumpman::Database.drop Dumpman::Database.create Dumpman::Database.restore end |
#unzip ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dumpman/comandor.rb', line 16 def unzip # clean up from old zip File.delete(Dumpman.dump_file) if File.exists?(Dumpman.dump_file) Zip::File.open(Dumpman.dump_zip) do |zip_file| zip_file.each do |entry| puts "Extracting #{entry.name}" entry.extract(Dumpman.dump_file) end end end |
#zip ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/dumpman/comandor.rb', line 7 def zip # clean up from old dump File.delete(Dumpman.dump_zip) if File.exists?(Dumpman.dump_zip) Zip::File.open(Dumpman.dump_zip, Zip::File::CREATE) do |zipfile| zipfile.add(Dumpman.dump_file_name, Dumpman.dump_folder + '/' + Dumpman.dump_file_name) end end |