"Mob Session DONE [ci-skip]"

master
jem 5 years ago
parent 6f2a28df22
commit e29c246e3b

@ -1,8 +1,15 @@
; Copyright (c) meissa. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
(ns cryogen-core.classpath-able-io
(:require [clojure.java.io :as io]
[clojure.string :as s]))
; TODO: loading from cpasspath results in nil even if file exists
(defn file-from-cp
[resource-path]
(let [file-from-cp (io/file (io/resource resource-path))]
@ -28,18 +35,17 @@
from-fs
(file-from-cp resource-path))))
(defn copy-dir
[source-dir target-dir ignore-patterns]
(let [source-list (.list source-dir)]
(doseq [f source-list]
(let [target-file (io/file target-dir f)
source-file (io/file source-dir f)]
(if (.isDirectory source-file)
(copy-dir source-file target-file ignore-patterns)
(if (.isFile source-file)
(do
(io/make-parents target-file)
(io/copy f target-file)))))))
(io/copy f target-file))
(recur source-file target-file ignore-patterns))))))
(defn copy-resources
[fs-prefix source-path target-path ignore-patterns]

@ -1,3 +1,11 @@
; Copyright (c) meissa. All rights reserved.
; The use and distribution terms for this software are covered by the
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
; which can be found in the file epl-v10.html at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
(ns cryogen-core.classpath-able-io-test
(:require [clojure.test :refer :all]
[clojure.string :as s]
@ -15,6 +23,11 @@
(and (verify-file-exists path)
(.isDirectory (io/file path))))
(deftest test-filter-for-ignore-patterns
(is (=
["file.js"]
(sut/filter-for-ignore-patterns #".*\\.ignore" ["file.js" "file.ignore"]))))
(deftest test-file-from-cp
(is
(sut/file-from-cp ".gitkeep")))

Loading…
Cancel
Save