Add mechanism for running migrations of developer workspaces

This commit is contained in:
Calen Pennington
2013-05-06 14:22:44 -04:00
parent 9d42bce54f
commit ed9b91e9d0
5 changed files with 61 additions and 3 deletions

16
rakefiles/workspace.rake Normal file
View File

@@ -0,0 +1,16 @@
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))
if ! File.exist?(completion_file)
sh(migration)
File.write(completion_file, "")
end
end unless SKIP_MIGRATIONS
end
end