Module: Dumpman::Commandor

Extended by:
Commandor
Included in:
Commandor
Defined in:
lib/dumpman/comandor.rb

Instance Method Summary collapse

Instance Method Details

#create_dbObject



42
43
44
# File 'lib/dumpman/comandor.rb', line 42

def create_db
  Dumpman::Database.create
end

#drop_dbObject



38
39
40
# File 'lib/dumpman/comandor.rb', line 38

def drop_db
  Dumpman::Database.drop
end

#dumpObject



28
29
30
# File 'lib/dumpman/comandor.rb', line 28

def dump
  Dumpman::Database.dump
end

#restoreObject



32
33
34
35
36
# File 'lib/dumpman/comandor.rb', line 32

def restore
  Dumpman::Database.drop
  Dumpman::Database.create
  Dumpman::Database.restore
end

#unzipObject



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

#zipObject



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