Module: MigrationsWatchdog
- Defined in:
- lib/migrations_watchdog.rb,
lib/migrations_watchdog/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
Class Method Details
.check(paths) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/migrations_watchdog.rb', line 7 def self.check(paths) migration_files = [] others = [] paths.each do |file| if file.match('\Adb/structure.sql') || file.match('\Adb/migrate') migration_files.push(file) elsif file.match('.*\.rb') # We could do a short circuit here but let's collect all files for # better error message others.push(file) end end if migration_files.size > 0 && others.size > 0 raise Error.new("Migrations and app code detected. Move out the following files:\n#{others.join('\b')}") end true end |