Class: DatabasePatcher::PatchCreator

Inherits:
Object
  • Object
show all
Defined in:
lib/database_patcher/patch_creator.rb

Instance Method Summary collapse

Constructor Details

#initialize(type, idenpotent, file_name_description) ⇒ PatchCreator

Returns a new instance of PatchCreator.



4
5
6
7
8
# File 'lib/database_patcher/patch_creator.rb', line 4

def initialize(type, idenpotent, file_name_description)
  @type = type
  @idenpotent = !!idenpotent
  @file_name_description = file_name_description
end

Instance Method Details

#makeObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/database_patcher/patch_creator.rb', line 10

def make
  if @idenpotentg
    file_path = base_path + extension
    FileUtils.touch(file_path)
    puts(file_path)
  else
    FileUtils.mkpath(base_path)
    FileUtils.touch(File.join(base_path, 'up' + extension))
    FileUtils.touch(File.join(base_path, 'down' + extension))
    puts(base_path)
  end
end