Indentation and whitespace fixes.

This commit is contained in:
Phil Hagelberg 2010-08-08 13:58:08 -07:00
parent 0e7599e729
commit 9a1ea45d23
5 changed files with 54 additions and 53 deletions

View file

@ -19,8 +19,8 @@
(let [proj (binding [*ns* (find-ns 'leiningen.core)]
(read-project (.getAbsolutePath
(file dep "project.clj"))))]
(for [d [:source-path :compile-path :resources-path]]
(proj d))))))
(for [d [:source-path :compile-path :resources-path]]
(proj d))))))
(defn user-plugins []
(for [jar (.listFiles (file (home-dir) "plugins"))

View file

@ -42,8 +42,8 @@
(compilable-namespaces project)))
(defn get-by-pattern
"Gets a value from map m, but uses the keys as regex patterns,
trying to match against k instead of doing an exact match."
"Gets a value from map m, but uses the keys as regex patterns, trying
to match against k instead of doing an exact match."
[m k]
(m (first (drop-while #(nil? (re-find (re-pattern %) k))
(keys m)))))

View file

@ -24,25 +24,25 @@
root# ~(.getParent (File. *file*))]
(alter-var-root #'project
(fn [_#] (assoc m#
:name ~(name project-name)
:group ~(or (namespace project-name)
(name project-name))
:version ~version
:compile-path (or (:compile-path m#)
(str root# "/classes"))
:source-path (or (:source-path m#)
(str root# "/src"))
:library-path (or (:library-path m#)
(str root# "/lib"))
:test-path (or (:test-path m#)
(str root# "/test"))
:resources-path (or (:resources-path m#)
(str root# "/resources"))
:test-resources-path
(or (:test-resources-path m#)
(str root# "/test-resources"))
:jar-dir (or (:jar-dir m#) root#)
:root root#))))
:name ~(name project-name)
:group ~(or (namespace project-name)
(name project-name))
:version ~version
:compile-path (or (:compile-path m#)
(str root# "/classes"))
:source-path (or (:source-path m#)
(str root# "/src"))
:library-path (or (:library-path m#)
(str root# "/lib"))
:test-path (or (:test-path m#)
(str root# "/test"))
:resources-path (or (:resources-path m#)
(str root# "/resources"))
:test-resources-path
(or (:test-resources-path m#)
(str root# "/test-resources"))
:jar-dir (or (:jar-dir m#) root#)
:root root#))))
(def ~(symbol (name project-name)) project)))
(defn abort [& msg]
@ -62,11 +62,10 @@
(defn read-project
([file]
(try
(load-file file)
project
(catch java.io.FileNotFoundException _
(abort "No project.clj found in this directory."))))
(try (load-file file)
project
(catch java.io.FileNotFoundException _
(abort "No project.clj found in this directory."))))
([] (read-project "project.clj")))
(def aliases (atom {"--help" "help" "-h" "help" "-?" "help" "-v" "version"
@ -133,7 +132,7 @@
(if (= '& (last (butlast defined-args)))
(>= arg-count (- (count defined-args) 2))
(= arg-count (count defined-args))))
(arglists task-name))))
(arglists task-name))))
(defn apply-task [task-name project args not-found]
(let [task (resolve-task task-name not-found)]

View file

@ -40,13 +40,13 @@
noroot #(trim-leading-str (unix-path %) root)
[resources classes src]
(map noroot (map project [:resources-path :compile-path :source-path]))]
(doseq [child (file-seq (file (:path spec)))]
(when-not (skip-file? child)
(let [path (reduce trim-leading-str (unix-path (str child))
[root resources classes src "/"])]
(.putNextEntry jar-os (doto (JarEntry. path)
(.setTime (.lastModified child))))
(copy child jar-os))))))
(doseq [child (file-seq (file (:path spec)))]
(when-not (skip-file? child)
(let [path (reduce trim-leading-str (unix-path (str child))
[root resources classes src "/"])]
(.putNextEntry jar-os (doto (JarEntry. path)
(.setTime (.lastModified child))))
(copy child jar-os))))))
(defmethod copy-to-jar :bytes [project jar-os spec]
(.putNextEntry jar-os (JarEntry. (:path spec)))

View file

@ -56,19 +56,19 @@
(defn make-git-scm [git-dir]
(try
(let [origin (read-git-origin git-dir)
head (read-git-head git-dir)
urls (github-urls origin)
scm (Scm.)]
(.setUrl scm (:browse urls))
(.setTag scm head)
(when (:public-clone urls)
(.setConnection scm (str "scm:git:" (:public-clone urls))))
(when (:dev-clone urls)
(.setDeveloperConnection scm (str "scm:git:" (:dev-clone urls))))
scm)
(catch java.io.FileNotFoundException e
nil)))
(let [origin (read-git-origin git-dir)
head (read-git-head git-dir)
urls (github-urls origin)
scm (Scm.)]
(.setUrl scm (:browse urls))
(.setTag scm head)
(when (:public-clone urls)
(.setConnection scm (str "scm:git:" (:public-clone urls))))
(when (:dev-clone urls)
(.setDeveloperConnection scm (str "scm:git:" (:dev-clone urls))))
scm)
(catch java.io.FileNotFoundException e
nil)))
(defn make-exclusion [excl]
(doto (Exclusion.)
@ -138,8 +138,8 @@ to exclude from transitive dependencies."
(defmacro add-a-resource [build method resource-path]
`(let [resource# (Resource.)]
(.setDirectory resource# ~resource-path)
(~(symbol (name method)) ~build [resource#])))
(.setDirectory resource# ~resource-path)
(~(symbol (name method)) ~build [resource#])))
(defn make-model [project]
(let [model (doto (Model.)
@ -151,8 +151,10 @@ to exclude from transitive dependencies."
(.setDescription (:description project))
(.setUrl (:url project)))
build (doto (Build.)
(add-a-resource :.setResources (relative-path project :resources-path))
(add-a-resource :.setTestResources (relative-path project :test-resources-path))
(add-a-resource :.setResources
(relative-path project :resources-path))
(add-a-resource :.setTestResources
(relative-path project :test-resources-path))
(.setSourceDirectory (relative-path project :source-path))
(.setTestSourceDirectory (relative-path project :test-path)))]
(.setBuild model build)