Back

recursive-delete (clj)

(source)

function

(recursive-delete f)
Delete a file, including all children if it's a directory

Examples

migratus
;;;; Copyright © 2011 Paul Stadig
;;;;
;;;; Licensed under the Apache License, Version 2.0 (the "License"); you may not
;;;; use this file except in compliance with the License.  You may obtain a copy
;;;; of the License at
;;;;
;;;;   http://www.apache.org/licenses/LICENSE-2.0
;;;;
;;;; Unless required by applicable law or agreed to in writing, software
;;;; distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
;;;; WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
;;;; License for the specific language governing permissions and limitations
;;;; under the License.
(ns migratus.test.database
  (:require [clojure.java.io :as io]
            [next.jdbc :as jdbc]
            [next.jdbc.result-set :as rs]
            [next.jdbc.quoted :as q]
            [next.jdbc.sql :as sql]
            [migratus.protocols :as proto]
            [migratus.core :as core]
            [clojure.test :refer :all]
            [migratus.database :refer :all :as db]
            [clojure.tools.logging :as log]
            [migratus.test.migration.edn :as test-edn]
            [migratus.test.migration.sql :as test-sql]
            [migratus.utils :as utils])
  (:import java.io.File
           java.sql.Connection
           java.util.jar.JarFile
           (java.util.concurrent CancellationException)))

(deftest test-migration-sql-edn-mixed
  (let [migration-dir (io/file "test/migrations-mixed")
        test-config   (merge config
                             test-edn/test-config
                             {:parent-migration-dir "test"
                              :migration-dir "migrations-mixed"})]
    (try
      (utils/recursive-delete (io/file test-edn/test-dir))
      (utils/recursive-delete migration-dir)
      (copy-dir (io/file "test/migrations") migration-dir)
      (copy-dir (io/file "test/migrations-edn") migration-dir)

      (finally
        (utils/recursive-delete migration-dir)))))
migratus
(ns migratus.test.migration.edn-with-args
  (:require [clojure.java.io :as io]
            [clojure.test :refer :all]
            [migratus.core :as core]
            [migratus.migration.edn :refer :all]
            migratus.mock
            [migratus.protocols :as proto]
            [migratus.utils :as utils])
  (:import java.io.File))

(use-fixtures :each
  (fn [f]
    ;; unload the namespace before each test to ensure that it's loaded
    ;; appropriately by the edn-migration code.
    (unload test-namespace)
    (utils/recursive-delete (io/file test-dir))
    (f)))
migratus
(ns migratus.test.migration.edn
  (:require [clojure.java.io :as io]
            [clojure.test :refer :all]
            [migratus.core :as core]
            [migratus.migration.edn :refer :all]
            migratus.mock
            [migratus.protocols :as proto]
            [migratus.utils :as utils])
  (:import java.io.File))

(use-fixtures :each
  (fn [f]
    ;; unload the namespace before each test to ensure that it's loaded
    ;; appropriately by the edn-migration code.
    (unload test-namespace)
    (utils/recursive-delete (io/file test-dir))
    (f)))