Skip to content

Commit

Permalink
feat: Add antq.date/get-last-updated-at
Browse files Browse the repository at this point in the history
cf. #214
  • Loading branch information
liquidz committed May 5, 2023
1 parent e021be0 commit ad4a99f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/antq/date.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(ns antq.date)

(defmulti get-last-updated-at
(fn [dep _options]
(:type dep)))

(defmethod get-last-updated-at :default
[_ _]
nil)
11 changes: 11 additions & 0 deletions src/antq/date/git_sha.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(ns antq.date.git-sha
(:require
[antq.date :as date]
[antq.util.git :as u.git]))

(defmethod date/get-last-updated-at :git-sha
[dep _options]
(let [url (get-in dep [:extra :url])
lib (some-> dep :name symbol)]
(when (and url lib)
(u.git/head-date url lib))))
11 changes: 11 additions & 0 deletions src/antq/date/git_tag_and_sha.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(ns antq.date.git-tag-and-sha
(:require
[antq.date :as date]
[antq.util.git :as u.git]))

(defmethod date/get-last-updated-at :git-tag-and-sha
[dep _options]
(let [url (get-in dep [:extra :url])
lib (some-> dep :name symbol)]
(when (and url lib)
(u.git/head-date url lib))))
11 changes: 11 additions & 0 deletions src/antq/date/java.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(ns antq.date.java
(:require
[antq.date :as date]
[antq.util.dep :as u.dep]
[antq.util.maven :as u.maven]))

(defmethod date/get-last-updated-at :java
[dep _options]
(u.maven/get-last-updated
(:name dep)
(u.dep/repository-opts dep)))

0 comments on commit ad4a99f

Please sign in to comment.