From 140fa177a044498e21dfabcf69eba0729747394c Mon Sep 17 00:00:00 2001 From: Tom Faulhaber Date: Fri, 29 Oct 2010 23:12:45 -0700 Subject: [PATCH] Fix up handling of shell output to match up with the "new" clojure.java.shell --- src/autodoc/branches.clj | 2 +- src/autodoc/build_html.clj | 16 ++++++++-------- src/autodoc/doc_files.clj | 2 +- src/autodoc/git_tools.clj | 16 ++++++++-------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/autodoc/branches.clj b/src/autodoc/branches.clj index 2d2c136..be9b98d 100644 --- a/src/autodoc/branches.clj +++ b/src/autodoc/branches.clj @@ -18,7 +18,7 @@ (defn system [& args] (pprint args) - (println (apply sh (build-sh-args args)))) + (println (:out (apply sh (build-sh-args args))))) (defn switch-branches "Switch to the specified branch" diff --git a/src/autodoc/build_html.clj b/src/autodoc/build_html.clj index b4e1d06..df96ce6 100644 --- a/src/autodoc/build_html.clj +++ b/src/autodoc/build_html.clj @@ -264,16 +264,16 @@ looks in the base template directory." "No usage documentation available"))) (def - #^{:doc "Gets the commit hash for the last commit that included this file. We + #^{:doc "Gets the commit hash for the last commit that included this file. We do this for source links so that we don't change them with every commit (unless that file actually changed). This reduces the amount of random doc file changes that happen."} - get-last-commit-hash - (memoize - (fn [file branch] - (let [hash (.trim (sh "git" "rev-list" "--max-count=1" "HEAD" file - :dir (params :root)))] - (when (not (.startsWith hash "fatal")) - hash))))) + get-last-commit-hash + (memoize + (fn [file branch] + (let [hash (.trim (:out (sh "git" "rev-list" "--max-count=1" "HEAD" file + :dir (params :root))))] + (when (not (.startsWith hash "fatal")) + hash))))) (defn web-src-file [file branch] (when-let [web-src-dir (params :web-src-dir)] diff --git a/src/autodoc/doc_files.clj b/src/autodoc/doc_files.clj index cd849ed..e63017e 100644 --- a/src/autodoc/doc_files.clj +++ b/src/autodoc/doc_files.clj @@ -41,7 +41,7 @@ transformations along the way." [src-file dst relative] (spit (File. (File. dst) (.replaceFirst relative "\\.markdown$" ".html")) - (sh "markdown" (.getPath src-file)))) + (:out (sh "markdown" (.getPath src-file))))) (defn xform-tree "Takes source and destination directories and copies the source to the destination, diff --git a/src/autodoc/git_tools.clj b/src/autodoc/git_tools.clj index 8fd3fef..5f50bd6 100644 --- a/src/autodoc/git_tools.clj +++ b/src/autodoc/git_tools.clj @@ -25,14 +25,14 @@ root of a git repo)" (with-sh-dir dir (when-let [branch-str (first (filter #(.startsWith % "*") - (.split (sh "git" "branch") "\n")))] + (.split (:out (sh "git" "branch")) "\n")))] (.substring branch-str 2)))) (defn has-remote? "return true if there is a remote called origin that we could push back to" [dir] (with-sh-dir dir - (some #(= % "origin") (.split (sh "git" "remote") "\n")))) + (some #(= % "origin") (.split (:out (sh "git" "remote")) "\n")))) (defn stage-new-doc-files "Add any new supplementary documents to the git staging area" @@ -41,7 +41,7 @@ root of a git repo)" (map #(.getPath (File. (File. %) "doc")) (cons "." (map branch-subdir (next branches)))))] (with-sh-dir dir - (println (apply sh "git" "add" "-v" dirs))))) + (println (:out (apply sh "git" "add" "-v" dirs)))))) (defn stage-new-api-files "Add any new API namespace files to the git staging area" @@ -50,19 +50,19 @@ root of a git repo)" (filter #(.endsWith (.getPath %) "-api.html") (file-seq dir)))] (with-sh-dir dir - (println (apply sh "git" "add" "-v" files))))) + (println (:out (apply sh "git" "add" "-v" files)))))) (defn stage-modified-files "Add any changed files to the git staging area" [dir] (with-sh-dir dir - (println (sh "git" "add" "-u" "-v" ".")))) + (println (:out (sh "git" "add" "-u" "-v" "."))))) (defn git-hash "Get the git hash for the head of the given branch (or tag)" [dir head len] (with-sh-dir dir - (.substring (.trim (sh "git" "rev-parse" head)) 0 len))) + (.substring (.trim (:out (sh "git" "rev-parse" head))) 0 len))) (defn comment-for "Construct a git comment for all the appropriate branches" @@ -76,13 +76,13 @@ root of a git repo)" "Commit the staged files in dir (a java.io.File)." [dir comment] (with-sh-dir dir - (println (sh "git" "commit" "-m" comment)))) + (println (:out (sh "git" "commit" "-m" comment))))) (defn git-push "Push the commit to a remote, if defined" [dir] (with-sh-dir dir - (println (sh "git" "push" "origin" (current-branch dir))))) + (println (:out (sh "git" "push" "origin" (current-branch dir)))))) (defn autodoc-commit [src-dir doc-dir branches] "Stage and commit all new and changed files in the autodoc tree"