Skip to content

Commit

Permalink
Merge pull request #6 from thenonameguy/master
Browse files Browse the repository at this point in the history
Remove unnecessary usage of threading macros, use shorthand Java interop
  • Loading branch information
raszi committed Oct 20, 2015
2 parents 830d82c + 2ce2060 commit f5fe7aa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
11 changes: 6 additions & 5 deletions src/hu/ssh/github_changelog/cli.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
["-h" "--help"]])

(defn- usage [summary]
(->> ["Usage: program-name [options...] <user/repo>"
""
"Options:"
summary]
(join \newline)))
(join
\newline
["Usage: program-name [options...] <user/repo>"
""
"Options:"
summary]))

(defn -main [& args]
(let [{:keys [options arguments errors summary]} (cli/parse-opts args cli-options)
Expand Down
3 changes: 1 addition & 2 deletions src/hu/ssh/github_changelog/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
:post [(seq? %)]}
(let [git (git/clone (util/git-url prefix user repo))
tags (git/version-tags git)]
(->> (parse-tags tags)
(map (partial assoc-commits git)))))
(map (partial assoc-commits git) (parse-tags tags))))

(defn- find-pull
[pulls sha]
Expand Down
10 changes: 5 additions & 5 deletions src/hu/ssh/github_changelog/git.clj
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
(defn- get-merge-sha [repo tag]
{:pre [(repo? repo) (ref? tag)]
:post [(string? %)]}
(let [peeled (. repo peel tag)]
(. (if-let [peeled-id (. peeled getPeeledObjectId)] peeled-id (. peeled getObjectId)) name)))
(let [peeled (.peel repo tag)]
(.name (if-let [peeled-id (.getPeeledObjectId peeled)] peeled-id (.getObjectId peeled)))))

(defn- map-tag-name [tag]
{:pre [(ref? tag)]}
(string/replace (. tag getName) #"^refs/tags/", ""))
(string/replace (.getName tag) #"^refs/tags/", ""))

(defn- map-tag [repo tag]
{:pre [(repo? repo)]
Expand All @@ -51,14 +51,14 @@
(defn tags [git]
{:pre [(git? git)]
:post [(every? map? %)]}
(let [repo (. git getRepository)
(let [repo (.getRepository git)
tags (.. git tagList call)]
(map (partial map-tag repo) tags)))

(defn- get-commit-sha [log]
{:pre [(commit? log)]
:post [(string? %)]}
(. log name))
(.name log))

(defn commits [git from until]
{:pre [(git? git) (string? until) (or (nil? from) (string? from))]
Expand Down
5 changes: 3 additions & 2 deletions src/hu/ssh/github_changelog/github.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
(defn fetch-pulls [user repo {:keys [token]}]
{:pre [(string? user) (string? repo)]
:post [(seq? %)]}
(->> (pulls/pulls user repo (merge {:token token :all-pages true :state "closed"}))
(map #(assoc % :sha (pull-sha %)))))
(map
#(assoc % :sha (pull-sha %))
(pulls/pulls user repo (merge {:token token, :all-pages true, :state "closed"}))))

0 comments on commit f5fe7aa

Please sign in to comment.