Class: DbDump

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/closer/helpers/snapshots/db_dump.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_featureObject

Returns the value of attribute current_feature.



7
8
9
# File 'lib/closer/helpers/snapshots/db_dump.rb', line 7

def current_feature
  @current_feature
end

Instance Method Details

#dump(dir = nil) ⇒ Object



18
19
20
21
# File 'lib/closer/helpers/snapshots/db_dump.rb', line 18

def dump(dir = nil)
  raise 'DBダンプの削除に失敗しました。' unless system("rm -f #{dump_dir(dir)}/*.gz")
  raise 'DBダンプに失敗しました。' unless dump_mysql(dump_dir(dir))
end

#load(dir) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/closer/helpers/snapshots/db_dump.rb', line 9

def load(dir)
  db = Dir.glob(File.join(dump_dir, '*.dump.gz')).first
  db ||= Dir.glob(File.join(dir, '*.dump.gz')).first

  if db
    raise 'DBロードに失敗しました。' unless load_mysql(db)
  end
end