Class: DatabasePatcher::Action::PatchCreator

Inherits:
DatabasePatcher::Action show all
Defined in:
lib/database_patcher/action/patch_creator.rb

Instance Attribute Summary

Attributes inherited from DatabasePatcher::Action

#interface

Instance Method Summary collapse

Constructor Details

#initialize(type, idenpotent, file_name_description, interface = DatabasePatcher::Interface::Null) ⇒ PatchCreator

Returns a new instance of PatchCreator.



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

def initialize(type, idenpotent, file_name_description, interface = DatabasePatcher::Interface::Null)
  super(interface)
  @type = type
  @idenpotent = !!idenpotent
  @file_name_description = file_name_description
end

Instance Method Details

#makeObject



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

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