Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fe309d
commit 6c36bbb
Showing
5 changed files
with
21 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,14 @@ | ||
(ns leiningen.clean | ||
"Remove compiled files and dependencies from project." | ||
(:use [clojure.contrib.io :only [file delete-file delete-file-recursively]])) | ||
(:use [leiningen.jar :only [get-jar-filename get-default-jar-name | ||
get-default-uberjar-name]] | ||
[clojure.contrib.io :only [file delete-file delete-file-recursively]])) | ||
|
||
(defn empty-directory | ||
"Recursively delete all the files in f, but not f itself. | ||
Raise an exception if any deletion fails unless silently is true." | ||
[f & [silently]] | ||
(let [f (file f)] | ||
(when (.isDirectory f) | ||
(doseq [child (.listFiles f)] | ||
(delete-file-recursively child silently))))) | ||
|
||
(defn clean [project] | ||
(println "Cleaning up") | ||
(delete-file (str (:jar-dir project) "/" (:name project) ".jar") true) | ||
(delete-file (str (:jar-dir project) "/" (:name project) "-standalone.jar") | ||
true) | ||
(doseq [d [(:compile-path project) | ||
(:library-path project) | ||
;; This must be hard-coded since it's needed in bin/lein | ||
"lib/dev"]] | ||
(empty-directory (file d) true))) | ||
(defn clean | ||
"Remove compiled files and dependencies from project." | ||
[project] | ||
(println "Cleaning up.") | ||
(doseq [f [(get-jar-filename project (get-default-jar-name project)) | ||
(get-jar-filename project (get-default-uberjar-name project)) | ||
(:compile-path project)]] | ||
(delete-file-recursively f true))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters