Description:
Add git support.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -1,4 +1,4 | |||
|
1 |
(defproject project-checkup "0.1. |
|
|
1 | (defproject project-checkup "0.1.3-SNAPSHOT" | |
|
2 | 2 | :description "FIXME: write description" |
|
3 | 3 | :url "http://example.com/FIXME" |
|
4 | 4 | :license {:name "Eclipse Public License" |
@@ -10,16 +10,33 | |||
|
10 | 10 | people are used to seeing extensions in." |
|
11 | 11 | (re-find #"\.[a-zA-Z0-9]+$" path)) |
|
12 | 12 | |
|
13 | (defn gather-untracked | |
|
14 | [vcs-systems] | |
|
15 | "Gather untracked files in Git or Mercurial." | |
|
16 | (reduce into [ | |
|
17 | (if (contains? vcs-systems ".hg") | |
|
18 | (string/split (:out (shell/sh "chg" "st" "-u" "-n")) #"\n")) | |
|
19 | (if (contains? vcs-systems ".git") | |
|
20 | (string/split (:out (shell/sh "git" "ls-files" "--others" | |
|
21 | "--exclude-standard")) #"\n"))] | |
|
22 | ||
|
23 | ) | |
|
24 | ) | |
|
25 | ||
|
13 | 26 | (defn gather-project-info |
|
14 | "Creates a dictionary of project information" | |
|
27 | "Creates a dictionary of project information." | |
|
15 | 28 | [] |
|
16 | 29 | (let [all-files (map str (file-seq (clojure.java.io/file "."))) |
|
17 | 30 | ; files (string/split (:out (shell/sh "hg" "st" "-m" "-a" "-r" "-d" "-c" "-n" )) #"\n") |
|
18 | files (map #(clojure.string/replace % #"./(.*)" "$1") all-files ) ] | |
|
31 | ||
|
32 | files (map #(clojure.string/replace % #"./(.*)" "$1") all-files ) | |
|
33 | ;note that using some here means that if both are present, hg is | |
|
34 | ;ignored: | |
|
35 | vcs-systems (set (vector (some #{".git" ".hg"} files))) ] | |
|
19 | 36 | {:files files |
|
20 | 37 | :extensions (frequencies (map get-extension files )) |
|
21 | 38 | :path (System/getProperty "user.dir") |
|
22 | :untracked-files (string/split (:out (shell/sh "chg" "st" "-u" "-n")) #"\n") | |
|
39 | :untracked-files (gather-untracked vcs-systems) | |
|
23 | 40 | :readme (if-let [filename (some #{"README.md" "README.txt" "README.mkd"} files)] (slurp filename) "") |
|
24 | 41 | }) ) |
|
25 | 42 | |
@@ -70,7 +87,7 | |||
|
70 | 87 | :description "" |
|
71 | 88 | :function check-untracked |
|
72 | 89 | :level :warning |
|
73 | :follow-up "Commit or ignore files from 'hg st -u'." } | |
|
90 | :follow-up "Commit or ignore files from 'hg st -u' or 'git ls-files --others --exclude-standard'." } | |
|
74 | 91 | {:name "No Todo" |
|
75 | 92 | :function check-taskpaper |
|
76 | 93 | :description "" |
@@ -108,8 +125,9 | |||
|
108 | 125 | "Run checks." |
|
109 | 126 | [& args] |
|
110 | 127 | (try |
|
111 | (doseq [check checks] | |
|
112 | (println (:output (perform-check check (gather-project-info) )))) | |
|
128 | (let [project-info (gather-project-info)] | |
|
129 | (doseq [check checks] | |
|
130 | (println (:output (perform-check check project-info ))))) | |
|
113 | 131 | (catch Exception ex |
|
114 | 132 | (.printStackTrace ex) |
|
115 | 133 | (str "caught exception: " (.getMessage ex))) |
You need to be logged in to leave comments.
Login now