Skip to content

Commit 84781d6

Browse files
committed
Release 0.1.0.
1 parent 6a339a6 commit 84781d6

File tree

3 files changed

+33
-21
lines changed

3 files changed

+33
-21
lines changed

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
# melange
1+
# Melange
22

33
See with the eyes of the Kwisatz Haderach.
44

55
## Usage
66

7-
$ lein melange show
8-
$ lein melange clone
9-
$ lein melange test
7+
$ lein plugin install melange 0.1.0
8+
9+
$ lein melange show # Show all downstream dependents
10+
$ lein melange clone # Clone all dependents into dependents/ dir
11+
$ lein melange test # Run tests of all dependents
1012

1113
## License
1214

13-
Copyright (C) 2012 The Seattle Clojure Group
15+
Copyright © 2012 The Seattle Clojure Group
1416

1517
Distributed under the Eclipse Public License, the same as Clojure.

project.clj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
(defproject melange "1.0.0-SNAPSHOT"
2-
:description "FIXME: write description"
1+
(defproject melange "0.1.0"
2+
:description "See with the eyes of the Kwisatz Haderach."
33
:eval-in-leiningen true)

src/leiningen/melange.clj

+24-14
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,36 @@
33
(:require [leiningen.test :as test]
44
[leiningen.core :as core]
55
[clojure.java.io :as io]
6-
[clojure.pprint :as pprint]
6+
[clojure.string :as string]
77
[clojure.java.shell :as sh]))
88

99
(defonce project-graph (read-string (slurp (io/resource "project_graph.clj"))))
1010

1111
(defn show [project entry]
12-
(doseq [dependent (:dependents entry)]
13-
(println "==" dependent ":" (-> dependent
14-
project-graph
15-
:github-url))))
12+
(doseq [dep-name (:dependents entry)
13+
:let [dep (project-graph dep-name)]]
14+
(println "==" (name dep-name))
15+
(doseq [k [:description :homepage :github-url]
16+
:when (not (string/blank? (dep k)))]
17+
(println " " (dep k)))))
1618

1719
(defn clone [project entry]
1820
(.mkdirs (io/file (:root project) "dependents"))
1921
(doseq [dependent (:dependents entry)
2022
:let [url (:github-url (project-graph dependent))]
2123
:when url]
2224
(println "Cloning" dependent "...")
23-
(let [retval (sh/sh "git" "clone"
24-
(str url ".git")
25+
(let [retval (sh/sh "git" "clone" (str url ".git")
2526
(str "dependents/" (name dependent)))]
2627
(when (pos? (:exit retval))
27-
(println "Clone failed:")
28-
(println (:out retval))
29-
(println (:err retval))))))
28+
(println "Clone failed:" (:out retval) (:err retval))))))
3029

3130
(defn has-tests? [project]
3231
(and (not (:eval-in-leiningen project))
3332
(seq (filter #(.endsWith (.getName %) ".clj")
3433
(file-seq (io/file (:test-path project)))))))
3534

35+
;; TODO: detect other testing frameworks
3636
(defn test-project [project summary dependent]
3737
(println "Running tests for" dependent)
3838
(let [project (core/read-project
@@ -46,14 +46,24 @@
4646
(do (println dependent "appears to have no tests.")
4747
summary))))
4848

49+
(defn test-print-summary [results total]
50+
(println "Test results:")
51+
(doseq [[dependent passed?] results]
52+
(println " " dependent " - "(if passed? "pass" "FAIL")))
53+
(println (count (filter val results)) "passed out of" total))
54+
4955
(defn test [project entry]
5056
(let [dependents (.list (io/file (:root project) "dependents"))
5157
results (reduce (partial test-project project) {} dependents)]
52-
(println "Test results:")
53-
(pprint/pprint results)
54-
(println (count (filter val results)) "passed out of" (count dependents))))
58+
(if (seq dependents)
59+
(test-print-summary results (count dependents))
60+
(println "No dependent clones present; run \"lein melange clone\"."))))
61+
62+
(defn melange
63+
"Operate on downstream dependents.
5564
56-
(defn melange [project command & args]
65+
Commands: show, clone, test"
66+
[project command & args]
5767
(let [name (-> project :name keyword)
5868
entry (project-graph name)]
5969
(if-let [command-fn (ns-resolve 'leiningen.melange (symbol command))]

0 commit comments

Comments
 (0)