lib/parallel_tests/tasks.rb in parallel_tests-2.3.1 vs lib/parallel_tests/tasks.rb in parallel_tests-2.4.0
- old
+ new
@@ -41,10 +41,14 @@
else
command
end
end
+ def suppress_schema_load_output(command)
+ ParallelTests::Tasks.suppress_output(command, "^ ->\\|^-- ")
+ end
+
def check_for_pending_migrations
["db:abort_if_pending_migrations", "app:db:abort_if_pending_migrations"].each do |abort_migrations|
if Rake::Task.task_defined?(abort_migrations)
Rake::Task[abort_migrations].invoke
break
@@ -70,10 +74,16 @@
end
end
end
namespace :parallel do
+ desc "setup test databases via db:setup --> parallel:setup[num_cpus]"
+ task :setup, :count do |_,args|
+ command = "rake db:setup RAILS_ENV=#{ParallelTests::Tasks.rails_env}"
+ ParallelTests::Tasks.run_in_parallel(ParallelTests::Tasks.suppress_schema_load_output(command), args)
+ end
+
desc "create test databases via db:create --> parallel:create[num_cpus]"
task :create, :count do |_,args|
ParallelTests::Tasks.run_in_parallel("rake db:create RAILS_ENV=#{ParallelTests::Tasks.rails_env}", args)
end
@@ -105,10 +115,10 @@
# just load the schema (good for integration server <-> no development db)
desc "load dumped schema for test databases via db:schema:load --> parallel:load_schema[num_cpus]"
task :load_schema, :count do |_,args|
command = "rake #{ParallelTests::Tasks.purge_before_load} db:schema:load RAILS_ENV=#{ParallelTests::Tasks.rails_env}"
- ParallelTests::Tasks.run_in_parallel(ParallelTests::Tasks.suppress_output(command, "^ ->\\|^-- "), args)
+ ParallelTests::Tasks.run_in_parallel(ParallelTests::Tasks.suppress_schema_load_output(command), args)
end
# load the structure from the structure.sql file
desc "load structure for test databases via db:structure:load --> parallel:load_structure[num_cpus]"
task :load_structure, :count do |_,args|