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__)
7 Server::Application.load_tasks
11 # Copied from the definition in Rails 3.2.
12 # This may need to be updated if we upgrade Rails.
14 errors = %w(test:units test:functionals test:integration test:tasks).collect do |task|
16 Rake::Task[task].invoke
19 { :task => task, :exception => e }
24 puts errors.map { |e| "Errors running #{e[:task]}! #{e[:exception].inspect}" }.join("\n")
31 namespace :structure do
34 origfnm = File.expand_path('../db/structure.sql', __FILE__)
35 tmpfnm = Tempfile.new 'structure.sql', File.expand_path('..', origfnm)
37 tmpfile = File.new tmpfnm, 'w'
38 origfile = File.new origfnm
39 origfile.each_line do |line|
40 if /^SET lock_timeout = 0;/ =~ line
41 # Avoid edit wars between versions that do/don't write this line.
43 elsif /^COMMENT ON EXTENSION/ =~ line
44 # Avoid warning message when loading:
45 # "structure.sql:22: ERROR: must be owner of extension plpgsql"
52 File.rename tmpfnm, origfnm
55 File.unlink tmpfnm if tmpfnm
61 # Work around Rails3+PostgreSQL9.5 incompatibility (pg_dump used to
62 # accept -i as a no-op, but now it's not accepted at all).
64 alias_method :orig_backtick, :`
65 def `(*args) #`#` sorry, parsers
66 args[0].sub!(/\Apg_dump -i /, 'pg_dump ') rescue nil