workspace.rake 667 Bytes
Newer Older
1 2 3 4 5 6 7 8 9
MIGRATION_MARKER_DIR = File.join(REPO_ROOT, '.ws_migrations_complete')
SKIP_MIGRATIONS = ENV['SKIP_WS_MIGRATIONS'] || false

directory MIGRATION_MARKER_DIR

namespace :ws do
    task :migrate => MIGRATION_MARKER_DIR do
        Dir['ws_migrations/*'].select{|m| File.executable?(m)}.each do |migration|
            completion_file = File.join(MIGRATION_MARKER_DIR, File.basename(migration))
10 11
            is_excluded = File.basename(migration).start_with?("README")
            if ! File.exist?(completion_file) && ! is_excluded
12 13 14 15 16
                sh(migration)
                File.write(completion_file, "")
            end
        end unless SKIP_MIGRATIONS
    end
17
end