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 | :description "FIXME: write description" |
|
2 | :description "FIXME: write description" |
|
3 | :url "http://example.com/FIXME" |
|
3 | :url "http://example.com/FIXME" |
|
4 | :license {:name "Eclipse Public License" |
|
4 | :license {:name "Eclipse Public License" |
@@ -10,16 +10,33 | |||||
|
10 | people are used to seeing extensions in." |
|
10 | people are used to seeing extensions in." |
|
11 | (re-find #"\.[a-zA-Z0-9]+$" path)) |
|
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 | (defn gather-project-info |
|
26 | (defn gather-project-info |
|
14 | "Creates a dictionary of project information" |
|
27 | "Creates a dictionary of project information." |
|
15 | [] |
|
28 | [] |
|
16 | (let [all-files (map str (file-seq (clojure.java.io/file "."))) |
|
29 | (let [all-files (map str (file-seq (clojure.java.io/file "."))) |
|
17 | ; files (string/split (:out (shell/sh "hg" "st" "-m" "-a" "-r" "-d" "-c" "-n" )) #"\n") |
|
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 | {:files files |
|
36 | {:files files |
|
20 | :extensions (frequencies (map get-extension files )) |
|
37 | :extensions (frequencies (map get-extension files )) |
|
21 | :path (System/getProperty "user.dir") |
|
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 | :readme (if-let [filename (some #{"README.md" "README.txt" "README.mkd"} files)] (slurp filename) "") |
|
40 | :readme (if-let [filename (some #{"README.md" "README.txt" "README.mkd"} files)] (slurp filename) "") |
|
24 | }) ) |
|
41 | }) ) |
|
25 |
|
42 | ||
@@ -70,7 +87,7 | |||||
|
70 | :description "" |
|
87 | :description "" |
|
71 | :function check-untracked |
|
88 | :function check-untracked |
|
72 | :level :warning |
|
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 | {:name "No Todo" |
|
91 | {:name "No Todo" |
|
75 | :function check-taskpaper |
|
92 | :function check-taskpaper |
|
76 | :description "" |
|
93 | :description "" |
@@ -108,8 +125,9 | |||||
|
108 | "Run checks." |
|
125 | "Run checks." |
|
109 | [& args] |
|
126 | [& args] |
|
110 | (try |
|
127 | (try |
|
111 | (doseq [check checks] |
|
128 | (let [project-info (gather-project-info)] |
|
112 | (println (:output (perform-check check (gather-project-info) )))) |
|
129 | (doseq [check checks] |
|
|
130 | (println (:output (perform-check check project-info ))))) | ||
|
113 | (catch Exception ex |
|
131 | (catch Exception ex |
|
114 | (.printStackTrace ex) |
|
132 | (.printStackTrace ex) |
|
115 | (str "caught exception: " (.getMessage ex))) |
|
133 | (str "caught exception: " (.getMessage ex))) |
You need to be logged in to leave comments.
Login now