Class: Dsu::Migration::BaseService
- Inherits:
-
Object
- Object
- Dsu::Migration::BaseService
- Includes:
- Support::Fileable
- Defined in:
- lib/dsu/migration/base_service.rb
Direct Known Subclasses
Constant Summary
Constants included from Support::Fileable
Support::Fileable::MIGRATION_VERSION_FILE_NAME
Class Method Summary collapse
-
.from_migration_version ⇒ Object
The migration version that this migration is upgrading from.
- .migrates_to_latest_migration_version? ⇒ Boolean
-
.to_migration_version ⇒ Object
The migration version that this migration is upgrading to.
Instance Method Summary collapse
-
#initialize(options: {}) ⇒ BaseService
constructor
A new instance of BaseService.
- #migrate_if! ⇒ Object
Methods included from Support::Fileable
#backup_folder_for, #config_file_name, #config_folder, #config_path, #current_project_file, #current_project_file_name, #dsu_folder, #entries_file_name, #entries_folder, #entries_path, #gem_dir, #migration_version_folder, #migration_version_path, #project_file_for, #project_folder_for, #projects_folder, #root_folder, #seed_data_dsu_configuration_for, #seed_data_dsu_folder_for, #temp_folder, #theme_file_name, #themes_folder, #themes_path
Constructor Details
#initialize(options: {}) ⇒ BaseService
Returns a new instance of BaseService.
12 13 14 |
# File 'lib/dsu/migration/base_service.rb', line 12 def initialize(options: {}) = || {} end |
Class Method Details
.from_migration_version ⇒ Object
The migration version that this migration is upgrading from.
22 23 24 |
# File 'lib/dsu/migration/base_service.rb', line 22 def from_migration_version raise NotImplementedError, 'You must implement the #from_migration_version method in your subclass' end |
.migrates_to_latest_migration_version? ⇒ Boolean
17 18 19 |
# File 'lib/dsu/migration/base_service.rb', line 17 def migrates_to_latest_migration_version? to_migration_version == Migration::VERSION end |
.to_migration_version ⇒ Object
The migration version that this migration is upgrading to.
27 28 29 |
# File 'lib/dsu/migration/base_service.rb', line 27 def to_migration_version raise NotImplementedError, 'You must implement the #to_migration_version method in your subclass' end |
Instance Method Details
#migrate_if! ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/dsu/migration/base_service.rb', line 32 def migrate_if! return unless run_migration? puts "Running migrations #{from_migration_version} -> #{to_migration_version}..." puts "\tpretend?: #{pretend?}" if pretend? run_migration! update_migration_version! puts "\tMigration #{from_migration_version} -> #{to_migration_version} complete." end |