From 9480ef0322a8c0ee494d3875c785e0129ef04a25 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Mon, 27 Feb 2012 15:02:35 -0300 Subject: [PATCH] List all pending migrations at once --- lib/tasks/plugins.rake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/tasks/plugins.rake b/lib/tasks/plugins.rake index 825c701..94bb6c2 100644 --- a/lib/tasks/plugins.rake +++ b/lib/tasks/plugins.rake @@ -8,16 +8,16 @@ namespace :noosfero do end task :abort_if_pending_migrations do if defined? ActiveRecord - plugin_migration_dirs.each do |path| - pending_migrations = ActiveRecord::Migrator.new(:up, path).pending_migrations + pending_migrations = plugin_migration_dirs.map do |path| + ActiveRecord::Migrator.new(:up, path).pending_migrations + end.flatten - if pending_migrations.any? - puts "You have #{pending_migrations.size} pending migrations:" - pending_migrations.each do |pending_migration| - puts ' %4d %s' % [pending_migration.version, pending_migration.name] - end - abort %{Run "rake db:migrate" to update your database then try again.} + if pending_migrations.any? + puts "You have #{pending_migrations.size} pending migrations:" + pending_migrations.each do |pending_migration| + puts ' %4d %s' % [pending_migration.version, pending_migration.name] end + abort %{Run "rake db:migrate" to update your database then try again.} end end end -- libgit2 0.21.2