Merge branch '11917-dont-clear-cache'
[arvados.git] / services / api / Rakefile
index fbbf53e3c6ac3d1c247b556db29f2f23141c4285..fad803cb94501b9deebe5b9c31a1ad3c559e72d1 100644 (file)
@@ -1,15 +1,13 @@
 #!/usr/bin/env rake
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 # Add your own tasks in files placed in lib/tasks ending in .rake,
 # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
 
 require File.expand_path('../config/application', __FILE__)
 
-begin
-  ok = PgPower
-rescue
-  abort "Hm, pg_power is missing. Make sure you use 'bundle exec rake ...'"
-end
-
 Server::Application.load_tasks
 
 namespace :test do
@@ -39,10 +37,17 @@ namespace :db do
       require 'tempfile'
       origfnm = File.expand_path('../db/structure.sql', __FILE__)
       tmpfnm = Tempfile.new 'structure.sql', File.expand_path('..', origfnm)
+      copyright_done = false
       begin
         tmpfile = File.new tmpfnm, 'w'
         origfile = File.new origfnm
         origfile.each_line do |line|
+          if !copyright_done
+            if !/Copyright .* Arvados/.match(line)
+               tmpfile.write "-- Copyright (C) The Arvados Authors. All rights reserved.\n--\n-- SPDX-License-Identifier: AGPL-3.0\n\n"
+            end
+            copyright_done = true
+          end
           if /^SET lock_timeout = 0;/ =~ line
             # Avoid edit wars between versions that do/don't write this line.
             next
@@ -63,3 +68,13 @@ namespace :db do
     end
   end
 end
+
+# Work around Rails3+PostgreSQL9.5 incompatibility (pg_dump used to
+# accept -i as a no-op, but now it's not accepted at all).
+module Kernel
+  alias_method :orig_backtick, :`
+  def `(*args) #`#` sorry, parsers
+    args[0].sub!(/\Apg_dump -i /, 'pg_dump ') rescue nil
+    orig_backtick(*args)
+  end
+end