Class: Voodoo::Migration
- Inherits:
-
Object
- Object
- Voodoo::Migration
- Defined in:
- lib/voodoo/migration.rb
Instance Attribute Summary collapse
-
#migration_folder ⇒ Object
readonly
Returns the value of attribute migration_folder.
-
#migration_name ⇒ Object
readonly
Returns the value of attribute migration_name.
Instance Method Summary collapse
- #archive_folder ⇒ Object
- #compare_folder(source, target) ⇒ Object
- #continue? ⇒ Boolean
- #copy_to_archive(archive_folder) ⇒ Object
- #export_folder(source) ⇒ Object
-
#initialize(name) ⇒ Migration
constructor
A new instance of Migration.
- #log_folder ⇒ Object
- #sql_folder ⇒ Object
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_folder ⇒ Object (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_name ⇒ Object (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_folder ⇒ Object
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
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_folder ⇒ Object
14 15 16 |
# File 'lib/voodoo/migration.rb', line 14 def log_folder @log_folder = create_folder(File.join(@migration_folder, 'logs')) end |
#sql_folder ⇒ Object
22 23 24 |
# File 'lib/voodoo/migration.rb', line 22 def sql_folder @sql_folder = create_folder(File.join(@migration_folder, 'sql')) end |