2 # Add your own tasks in files placed in lib/tasks ending in .rake,
3 # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5 require File.expand_path('../config/application', __FILE__)
10 abort "Hm, pg_power is missing. Make sure you use 'bundle exec rake ...'"
13 Server::Application.load_tasks
17 # Copied from the definition in Rails 3.2.
18 # This may need to be updated if we upgrade Rails.
20 errors = %w(test:units test:functionals test:integration test:tasks).collect do |task|
22 Rake::Task[task].invoke
25 { :task => task, :exception => e }
30 puts errors.map { |e| "Errors running #{e[:task]}! #{e[:exception].inspect}" }.join("\n")
37 namespace :structure do
40 origfnm = File.expand_path('../db/structure.sql', __FILE__)
41 tmpfnm = Tempfile.new 'structure.sql', File.expand_path('..', origfnm)
43 tmpfile = File.new tmpfnm, 'w'
44 origfile = File.new origfnm
45 origfile.each_line do |line|
46 if /^SET lock_timeout = 0;/ =~ line
47 # Avoid edit wars between versions that do/don't write this line.
49 elsif /^COMMENT ON EXTENSION/ =~ line
50 # Avoid warning message when loading:
51 # "structure.sql:22: ERROR: must be owner of extension plpgsql"
58 File.rename tmpfnm, origfnm
61 File.unlink tmpfnm if tmpfnm