Skip to content

Commit ad4a99f

Browse files
committed
feat: Add antq.date/get-last-updated-at
cf. #214
1 parent e021be0 commit ad4a99f

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

src/antq/date.clj

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(ns antq.date)
2+
3+
(defmulti get-last-updated-at
4+
(fn [dep _options]
5+
(:type dep)))
6+
7+
(defmethod get-last-updated-at :default
8+
[_ _]
9+
nil)

src/antq/date/git_sha.clj

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(ns antq.date.git-sha
2+
(:require
3+
[antq.date :as date]
4+
[antq.util.git :as u.git]))
5+
6+
(defmethod date/get-last-updated-at :git-sha
7+
[dep _options]
8+
(let [url (get-in dep [:extra :url])
9+
lib (some-> dep :name symbol)]
10+
(when (and url lib)
11+
(u.git/head-date url lib))))

src/antq/date/git_tag_and_sha.clj

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(ns antq.date.git-tag-and-sha
2+
(:require
3+
[antq.date :as date]
4+
[antq.util.git :as u.git]))
5+
6+
(defmethod date/get-last-updated-at :git-tag-and-sha
7+
[dep _options]
8+
(let [url (get-in dep [:extra :url])
9+
lib (some-> dep :name symbol)]
10+
(when (and url lib)
11+
(u.git/head-date url lib))))

src/antq/date/java.clj

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(ns antq.date.java
2+
(:require
3+
[antq.date :as date]
4+
[antq.util.dep :as u.dep]
5+
[antq.util.maven :as u.maven]))
6+
7+
(defmethod date/get-last-updated-at :java
8+
[dep _options]
9+
(u.maven/get-last-updated
10+
(:name dep)
11+
(u.dep/repository-opts dep)))

0 commit comments

Comments
 (0)