Description:
Expand the changelog check and do a little refactoring.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r32:30b92d1615f7 -

@@ -11,4 +11,5
11
11
12 ### Fixed
12 ### Fixed
13 - Fix issue causing .taskpaper files to not be correctly identified.
13 - Fix issue causing .taskpaper files to not be correctly identified.
14 - Fix issue where empty strings would be leftover and count as untracked.
14
15
@@ -7,19 +7,19
7
7
8 (defn get-extension [path]
8 (defn get-extension [path]
9 "Extracts the extension of a path.
9 "Extracts the extension of a path.
10 Returns the extension with the period, e.g., '.txt' because that's the format
10 Returns the extension with the period, e.g., '.txt' because that's the
11 people are used to seeing extensions in."
11 format people are used to seeing extensions in."
12 (re-find #"\.[a-zA-Z0-9]+$" path))
12 (re-find #"\.[a-zA-Z0-9]+$" path))
13
13
14 (defn gather-untracked
14 (defn gather-untracked
15 [vcs-systems]
15 [vcs-systems]
16 "Gather untracked files in Git or Mercurial."
16 "Gather untracked files in Git or Mercurial."
17 (reduce into [
17 (filter (comp not empty?) (reduce into [
18 (if (contains? vcs-systems ".hg")
18 (if (contains? vcs-systems ".hg")
19 (string/split (:out (shell/sh "chg" "st" "-u" "-n")) #"\n"))
19 (string/split (:out (shell/sh "chg" "st" "-u" "-n")) #"\n"))
20 (if (contains? vcs-systems ".git")
20 (if (contains? vcs-systems ".git")
21 (string/split (:out (shell/sh "git" "ls-files" "--others"
21 (string/split (:out (shell/sh "git" "ls-files" "--others"
22 "--exclude-standard")) #"\n"))]))
22 "--exclude-standard")) #"\n"))])))
23 (defn gather-project-info
23 (defn gather-project-info
24 "Creates a dictionary of project information."
24 "Creates a dictionary of project information."
25 []
25 []
@@ -32,6 +32,14
32 :untracked-files (gather-untracked vcs-systems)
32 :untracked-files (gather-untracked vcs-systems)
33 :readme (if-let [filename (some #{"README.md" "README.txt" "README.mkd"} files)] (slurp filename) "") }) )
33 :readme (if-let [filename (some #{"README.md" "README.txt" "README.mkd"} files)] (slurp filename) "") }) )
34
34
35
36 (def doc-extensions ["" ".txt" ".mkd" ".md" ".rst"])
37
38 (defn create-valid-names [exts names]
39 "Creates valid file names based on a sequence of exts and names."
40 (set (for [ext exts name names]
41 (str name ext))))
42
35 (defn color [color string]
43 (defn color [color string]
36 (let [color-sequence (case color
44 (let [color-sequence (case color
37 :green "\u001B[32m"
45 :green "\u001B[32m"
@@ -53,8 +61,10
53 (boolean (some #{"README.md" "README.txt" "README.mkd" "README"} files))))
61 (boolean (some #{"README.md" "README.txt" "README.mkd" "README"} files))))
54
62
55 (defn check-changelog [project]
63 (defn check-changelog [project]
56 (let [{files :files } project]
64 (let [{files :files } project
57 (boolean (some #{"CHANGELOG.md" "CHANGELOG.txt" "CHANGELOG.mkd" "CHANGELOG"} files))))
65 changelog-names #{"CHANGELOG" "HISTORY" "NEWS" "RELEASES"}]
66 (boolean (some (create-valid-names doc-extensions changelog-names) files))))
67
58
68
59 (defn check-untracked [project]
69 (defn check-untracked [project]
60 (let [{untracked :untracked-files } project]
70 (let [{untracked :untracked-files } project]
You need to be logged in to leave comments. Login now