Class: Squasher::Cleaner
- Inherits:
-
Object
- Object
- Squasher::Cleaner
- Defined in:
- lib/squasher/cleaner.rb
Constant Summary collapse
- MIGRATION_NAME =
'squasher_clean'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.process(*args) ⇒ Object
7 8 9 |
# File 'lib/squasher/cleaner.rb', line 7 def self.process(*args) new(*args).process end |
Instance Method Details
#process ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/squasher/cleaner.rb', line 11 def process Squasher.error(:migration_folder_missing) unless config.migrations_folder? migration_file = config.migration_file(, MIGRATION_NAME) if prev_migration FileUtils.rm(prev_migration) end File.open(migration_file, 'wb') do |stream| stream << ::Squasher::Render.render(MIGRATION_NAME, config) end Squasher.rake("db:migrate", :db_cleaning) end |