Indentation and whitespace fixes.
This commit is contained in:
parent
0e7599e729
commit
9a1ea45d23
5 changed files with 54 additions and 53 deletions
|
@ -19,8 +19,8 @@
|
||||||
(let [proj (binding [*ns* (find-ns 'leiningen.core)]
|
(let [proj (binding [*ns* (find-ns 'leiningen.core)]
|
||||||
(read-project (.getAbsolutePath
|
(read-project (.getAbsolutePath
|
||||||
(file dep "project.clj"))))]
|
(file dep "project.clj"))))]
|
||||||
(for [d [:source-path :compile-path :resources-path]]
|
(for [d [:source-path :compile-path :resources-path]]
|
||||||
(proj d))))))
|
(proj d))))))
|
||||||
|
|
||||||
(defn user-plugins []
|
(defn user-plugins []
|
||||||
(for [jar (.listFiles (file (home-dir) "plugins"))
|
(for [jar (.listFiles (file (home-dir) "plugins"))
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
(compilable-namespaces project)))
|
(compilable-namespaces project)))
|
||||||
|
|
||||||
(defn get-by-pattern
|
(defn get-by-pattern
|
||||||
"Gets a value from map m, but uses the keys as regex patterns,
|
"Gets a value from map m, but uses the keys as regex patterns, trying
|
||||||
trying to match against k instead of doing an exact match."
|
to match against k instead of doing an exact match."
|
||||||
[m k]
|
[m k]
|
||||||
(m (first (drop-while #(nil? (re-find (re-pattern %) k))
|
(m (first (drop-while #(nil? (re-find (re-pattern %) k))
|
||||||
(keys m)))))
|
(keys m)))))
|
||||||
|
|
|
@ -24,25 +24,25 @@
|
||||||
root# ~(.getParent (File. *file*))]
|
root# ~(.getParent (File. *file*))]
|
||||||
(alter-var-root #'project
|
(alter-var-root #'project
|
||||||
(fn [_#] (assoc m#
|
(fn [_#] (assoc m#
|
||||||
:name ~(name project-name)
|
:name ~(name project-name)
|
||||||
:group ~(or (namespace project-name)
|
:group ~(or (namespace project-name)
|
||||||
(name project-name))
|
(name project-name))
|
||||||
:version ~version
|
:version ~version
|
||||||
:compile-path (or (:compile-path m#)
|
:compile-path (or (:compile-path m#)
|
||||||
(str root# "/classes"))
|
(str root# "/classes"))
|
||||||
:source-path (or (:source-path m#)
|
:source-path (or (:source-path m#)
|
||||||
(str root# "/src"))
|
(str root# "/src"))
|
||||||
:library-path (or (:library-path m#)
|
:library-path (or (:library-path m#)
|
||||||
(str root# "/lib"))
|
(str root# "/lib"))
|
||||||
:test-path (or (:test-path m#)
|
:test-path (or (:test-path m#)
|
||||||
(str root# "/test"))
|
(str root# "/test"))
|
||||||
:resources-path (or (:resources-path m#)
|
:resources-path (or (:resources-path m#)
|
||||||
(str root# "/resources"))
|
(str root# "/resources"))
|
||||||
:test-resources-path
|
:test-resources-path
|
||||||
(or (:test-resources-path m#)
|
(or (:test-resources-path m#)
|
||||||
(str root# "/test-resources"))
|
(str root# "/test-resources"))
|
||||||
:jar-dir (or (:jar-dir m#) root#)
|
:jar-dir (or (:jar-dir m#) root#)
|
||||||
:root root#))))
|
:root root#))))
|
||||||
(def ~(symbol (name project-name)) project)))
|
(def ~(symbol (name project-name)) project)))
|
||||||
|
|
||||||
(defn abort [& msg]
|
(defn abort [& msg]
|
||||||
|
@ -62,11 +62,10 @@
|
||||||
|
|
||||||
(defn read-project
|
(defn read-project
|
||||||
([file]
|
([file]
|
||||||
(try
|
(try (load-file file)
|
||||||
(load-file file)
|
project
|
||||||
project
|
(catch java.io.FileNotFoundException _
|
||||||
(catch java.io.FileNotFoundException _
|
(abort "No project.clj found in this directory."))))
|
||||||
(abort "No project.clj found in this directory."))))
|
|
||||||
([] (read-project "project.clj")))
|
([] (read-project "project.clj")))
|
||||||
|
|
||||||
(def aliases (atom {"--help" "help" "-h" "help" "-?" "help" "-v" "version"
|
(def aliases (atom {"--help" "help" "-h" "help" "-?" "help" "-v" "version"
|
||||||
|
@ -133,7 +132,7 @@
|
||||||
(if (= '& (last (butlast defined-args)))
|
(if (= '& (last (butlast defined-args)))
|
||||||
(>= arg-count (- (count defined-args) 2))
|
(>= arg-count (- (count defined-args) 2))
|
||||||
(= arg-count (count defined-args))))
|
(= arg-count (count defined-args))))
|
||||||
(arglists task-name))))
|
(arglists task-name))))
|
||||||
|
|
||||||
(defn apply-task [task-name project args not-found]
|
(defn apply-task [task-name project args not-found]
|
||||||
(let [task (resolve-task task-name not-found)]
|
(let [task (resolve-task task-name not-found)]
|
||||||
|
|
|
@ -40,13 +40,13 @@
|
||||||
noroot #(trim-leading-str (unix-path %) root)
|
noroot #(trim-leading-str (unix-path %) root)
|
||||||
[resources classes src]
|
[resources classes src]
|
||||||
(map noroot (map project [:resources-path :compile-path :source-path]))]
|
(map noroot (map project [:resources-path :compile-path :source-path]))]
|
||||||
(doseq [child (file-seq (file (:path spec)))]
|
(doseq [child (file-seq (file (:path spec)))]
|
||||||
(when-not (skip-file? child)
|
(when-not (skip-file? child)
|
||||||
(let [path (reduce trim-leading-str (unix-path (str child))
|
(let [path (reduce trim-leading-str (unix-path (str child))
|
||||||
[root resources classes src "/"])]
|
[root resources classes src "/"])]
|
||||||
(.putNextEntry jar-os (doto (JarEntry. path)
|
(.putNextEntry jar-os (doto (JarEntry. path)
|
||||||
(.setTime (.lastModified child))))
|
(.setTime (.lastModified child))))
|
||||||
(copy child jar-os))))))
|
(copy child jar-os))))))
|
||||||
|
|
||||||
(defmethod copy-to-jar :bytes [project jar-os spec]
|
(defmethod copy-to-jar :bytes [project jar-os spec]
|
||||||
(.putNextEntry jar-os (JarEntry. (:path spec)))
|
(.putNextEntry jar-os (JarEntry. (:path spec)))
|
||||||
|
|
|
@ -56,19 +56,19 @@
|
||||||
|
|
||||||
(defn make-git-scm [git-dir]
|
(defn make-git-scm [git-dir]
|
||||||
(try
|
(try
|
||||||
(let [origin (read-git-origin git-dir)
|
(let [origin (read-git-origin git-dir)
|
||||||
head (read-git-head git-dir)
|
head (read-git-head git-dir)
|
||||||
urls (github-urls origin)
|
urls (github-urls origin)
|
||||||
scm (Scm.)]
|
scm (Scm.)]
|
||||||
(.setUrl scm (:browse urls))
|
(.setUrl scm (:browse urls))
|
||||||
(.setTag scm head)
|
(.setTag scm head)
|
||||||
(when (:public-clone urls)
|
(when (:public-clone urls)
|
||||||
(.setConnection scm (str "scm:git:" (:public-clone urls))))
|
(.setConnection scm (str "scm:git:" (:public-clone urls))))
|
||||||
(when (:dev-clone urls)
|
(when (:dev-clone urls)
|
||||||
(.setDeveloperConnection scm (str "scm:git:" (:dev-clone urls))))
|
(.setDeveloperConnection scm (str "scm:git:" (:dev-clone urls))))
|
||||||
scm)
|
scm)
|
||||||
(catch java.io.FileNotFoundException e
|
(catch java.io.FileNotFoundException e
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
(defn make-exclusion [excl]
|
(defn make-exclusion [excl]
|
||||||
(doto (Exclusion.)
|
(doto (Exclusion.)
|
||||||
|
@ -138,8 +138,8 @@ to exclude from transitive dependencies."
|
||||||
|
|
||||||
(defmacro add-a-resource [build method resource-path]
|
(defmacro add-a-resource [build method resource-path]
|
||||||
`(let [resource# (Resource.)]
|
`(let [resource# (Resource.)]
|
||||||
(.setDirectory resource# ~resource-path)
|
(.setDirectory resource# ~resource-path)
|
||||||
(~(symbol (name method)) ~build [resource#])))
|
(~(symbol (name method)) ~build [resource#])))
|
||||||
|
|
||||||
(defn make-model [project]
|
(defn make-model [project]
|
||||||
(let [model (doto (Model.)
|
(let [model (doto (Model.)
|
||||||
|
@ -151,8 +151,10 @@ to exclude from transitive dependencies."
|
||||||
(.setDescription (:description project))
|
(.setDescription (:description project))
|
||||||
(.setUrl (:url project)))
|
(.setUrl (:url project)))
|
||||||
build (doto (Build.)
|
build (doto (Build.)
|
||||||
(add-a-resource :.setResources (relative-path project :resources-path))
|
(add-a-resource :.setResources
|
||||||
(add-a-resource :.setTestResources (relative-path project :test-resources-path))
|
(relative-path project :resources-path))
|
||||||
|
(add-a-resource :.setTestResources
|
||||||
|
(relative-path project :test-resources-path))
|
||||||
(.setSourceDirectory (relative-path project :source-path))
|
(.setSourceDirectory (relative-path project :source-path))
|
||||||
(.setTestSourceDirectory (relative-path project :test-path)))]
|
(.setTestSourceDirectory (relative-path project :test-path)))]
|
||||||
(.setBuild model build)
|
(.setBuild model build)
|
||||||
|
|
Loading…
Reference in a new issue