Class: Voodoo::Migration

Inherits:
Object
  • Object
show all
Defined in:
lib/voodoo/migration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Migration

Returns a new instance of Migration.



9
10
11
12
# File 'lib/voodoo/migration.rb', line 9

def initialize(name)
  @migration_name = name
  @migration_folder = create_folder(File.join(CONFIGURATION.migration_output_dir, name))
end

Instance Attribute Details

#migration_folderObject (readonly)

Returns the value of attribute migration_folder.



6
7
8
# File 'lib/voodoo/migration.rb', line 6

def migration_folder
  @migration_folder
end

#migration_nameObject (readonly)

Returns the value of attribute migration_name.



7
8
9
# File 'lib/voodoo/migration.rb', line 7

def migration_name
  @migration_name
end

Instance Method Details

#archive_folderObject



18
19
20
# File 'lib/voodoo/migration.rb', line 18

def archive_folder
  @archive_folder = create_folder(File.join(@migration_folder, 'archive'))
end

#compare_folder(source, target) ⇒ Object



26
27
28
# File 'lib/voodoo/migration.rb', line 26

def compare_folder(source, target)
  @compare_folder = create_folder(File.join(compare_base_folder, "#{source}_to_#{target}"))
end

#continue?Boolean

Returns:

  • (Boolean)


34
35
36
37
38
# File 'lib/voodoo/migration.rb', line 34

def continue?
  if agree("Continue? ") == false
    exit
  end
end

#copy_to_archive(archive_folder) ⇒ Object



40
41
42
43
# File 'lib/voodoo/migration.rb', line 40

def copy_to_archive(archive_folder)
  # add error handling
  FileUtils.cp_r(@migration_folder, archive_folder, :verbose => true)
end

#export_folder(source) ⇒ Object



30
31
32
# File 'lib/voodoo/migration.rb', line 30

def export_folder(source)
  @export_folder = create_folder(File.join(project_folder, source))
end

#log_folderObject



14
15
16
# File 'lib/voodoo/migration.rb', line 14

def log_folder
  @log_folder = create_folder(File.join(@migration_folder, 'logs'))
end

#sql_folderObject



22
23
24
# File 'lib/voodoo/migration.rb', line 22

def sql_folder
  @sql_folder = create_folder(File.join(@migration_folder, 'sql'))
end