Skip to content

Commit 140fa17

Browse files
committed
Fix up handling of shell output to match up with the "new" clojure.java.shell
1 parent 38b5401 commit 140fa17

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/autodoc/branches.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
(defn system [& args]
2020
(pprint args)
21-
(println (apply sh (build-sh-args args))))
21+
(println (:out (apply sh (build-sh-args args)))))
2222

2323
(defn switch-branches
2424
"Switch to the specified branch"

src/autodoc/build_html.clj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -264,16 +264,16 @@ looks in the base template directory."
264264
"No usage documentation available")))
265265

266266
(def
267-
#^{:doc "Gets the commit hash for the last commit that included this file. We
267+
#^{:doc "Gets the commit hash for the last commit that included this file. We
268268
do this for source links so that we don't change them with every commit (unless that file
269269
actually changed). This reduces the amount of random doc file changes that happen."}
270-
get-last-commit-hash
271-
(memoize
272-
(fn [file branch]
273-
(let [hash (.trim (sh "git" "rev-list" "--max-count=1" "HEAD" file
274-
:dir (params :root)))]
275-
(when (not (.startsWith hash "fatal"))
276-
hash)))))
270+
get-last-commit-hash
271+
(memoize
272+
(fn [file branch]
273+
(let [hash (.trim (:out (sh "git" "rev-list" "--max-count=1" "HEAD" file
274+
:dir (params :root))))]
275+
(when (not (.startsWith hash "fatal"))
276+
hash)))))
277277

278278
(defn web-src-file [file branch]
279279
(when-let [web-src-dir (params :web-src-dir)]

src/autodoc/doc_files.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ transformations along the way."
4141
[src-file dst relative]
4242
(spit
4343
(File. (File. dst) (.replaceFirst relative "\\.markdown$" ".html"))
44-
(sh "markdown" (.getPath src-file))))
44+
(:out (sh "markdown" (.getPath src-file)))))
4545

4646
(defn xform-tree
4747
"Takes source and destination directories and copies the source to the destination,

src/autodoc/git_tools.clj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ root of a git repo)"
2525
(with-sh-dir dir
2626
(when-let [branch-str (first
2727
(filter #(.startsWith % "*")
28-
(.split (sh "git" "branch") "\n")))]
28+
(.split (:out (sh "git" "branch")) "\n")))]
2929
(.substring branch-str 2))))
3030

3131
(defn has-remote?
3232
"return true if there is a remote called origin that we could push back to"
3333
[dir]
3434
(with-sh-dir dir
35-
(some #(= % "origin") (.split (sh "git" "remote") "\n"))))
35+
(some #(= % "origin") (.split (:out (sh "git" "remote")) "\n"))))
3636

3737
(defn stage-new-doc-files
3838
"Add any new supplementary documents to the git staging area"
@@ -41,7 +41,7 @@ root of a git repo)"
4141
(map #(.getPath (File. (File. %) "doc"))
4242
(cons "." (map branch-subdir (next branches)))))]
4343
(with-sh-dir dir
44-
(println (apply sh "git" "add" "-v" dirs)))))
44+
(println (:out (apply sh "git" "add" "-v" dirs))))))
4545

4646
(defn stage-new-api-files
4747
"Add any new API namespace files to the git staging area"
@@ -50,19 +50,19 @@ root of a git repo)"
5050
(filter #(.endsWith (.getPath %) "-api.html")
5151
(file-seq dir)))]
5252
(with-sh-dir dir
53-
(println (apply sh "git" "add" "-v" files)))))
53+
(println (:out (apply sh "git" "add" "-v" files))))))
5454

5555
(defn stage-modified-files
5656
"Add any changed files to the git staging area"
5757
[dir]
5858
(with-sh-dir dir
59-
(println (sh "git" "add" "-u" "-v" "."))))
59+
(println (:out (sh "git" "add" "-u" "-v" ".")))))
6060

6161
(defn git-hash
6262
"Get the git hash for the head of the given branch (or tag)"
6363
[dir head len]
6464
(with-sh-dir dir
65-
(.substring (.trim (sh "git" "rev-parse" head)) 0 len)))
65+
(.substring (.trim (:out (sh "git" "rev-parse" head))) 0 len)))
6666

6767
(defn comment-for
6868
"Construct a git comment for all the appropriate branches"
@@ -76,13 +76,13 @@ root of a git repo)"
7676
"Commit the staged files in dir (a java.io.File)."
7777
[dir comment]
7878
(with-sh-dir dir
79-
(println (sh "git" "commit" "-m" comment))))
79+
(println (:out (sh "git" "commit" "-m" comment)))))
8080

8181
(defn git-push
8282
"Push the commit to a remote, if defined"
8383
[dir]
8484
(with-sh-dir dir
85-
(println (sh "git" "push" "origin" (current-branch dir)))))
85+
(println (:out (sh "git" "push" "origin" (current-branch dir))))))
8686

8787
(defn autodoc-commit [src-dir doc-dir branches]
8888
"Stage and commit all new and changed files in the autodoc tree"

0 commit comments

Comments
 (0)