|
8 | 8 | ;; - spit tags.json for awesome software |
9 | 9 | ;; - define and add an awesome-like score? |
10 | 10 |
|
| 11 | +(deps/add-deps '{:deps {clj-rss/clj-rss {:mvn/version "0.4.0"}}}) |
| 12 | +(require '[clj-rss.core :as rss]) |
| 13 | + |
11 | 14 | ;; Initialize atoms |
12 | 15 | (def hosts (atom ())) |
13 | 16 | (def forges (atom ())) |
|
140 | 143 | json/generate-string |
141 | 144 | (spit "owners.json")) |
142 | 145 |
|
| 146 | +(defn toInst [^String s] |
| 147 | + (.toInstant (clojure.instant/read-instant-date s))) |
| 148 | + |
| 149 | +(->> @owners |
| 150 | + (filter #(:created_at (val %))) |
| 151 | + (sort-by #(clojure.instant/read-instant-date (:created_at (val %)))) |
| 152 | + reverse |
| 153 | + (take 10) |
| 154 | + (map (fn [[o o-data]] |
| 155 | + {:title (str "Nouveau compte dans code.gouv.fr : " (:name o-data)) |
| 156 | + :link (:html_url o-data) |
| 157 | + :guid o |
| 158 | + :description (:description o-data) |
| 159 | + :pubDate (toInst (:created_at o-data))})) |
| 160 | + (rss/channel-xml |
| 161 | + {:title "code.gouv.fr/sources - Nouveaux comptes d'organisation" |
| 162 | + :link "https://code.gouv.fr/data/latest-repositories.xml" |
| 163 | + :description "code.gouv.fr/sources - Nouveaux comptes d'organisation"}) |
| 164 | + (spit "latest-owners.xml")) |
| 165 | + |
143 | 166 | ;; Spit repositories.json |
144 | 167 | (->> |
145 | 168 | @repositories |
|
169 | 192 | json/generate-string |
170 | 193 | (spit "repositories.json")) |
171 | 194 |
|
| 195 | +(->> @repositories |
| 196 | + (filter #(:created_at (val %))) |
| 197 | + (sort-by #(clojure.instant/read-instant-date (:created_at (val %)))) |
| 198 | + reverse |
| 199 | + (take 10) |
| 200 | + (map (fn [[r r-data]] |
| 201 | + (let [name (let [fn (:full_name r-data)] (or (last (re-matches #".+/([^/]+)/?" fn)) fn))] |
| 202 | + {:title (str "Nouveau dépôt de code source dans code.gouv.fr : " name) |
| 203 | + :link (:html_url r-data) |
| 204 | + :guid r |
| 205 | + :description (:description r-data) |
| 206 | + :pubDate (toInst (:created_at r-data))}))) |
| 207 | + (rss/channel-xml |
| 208 | + {:title "code.gouv.fr/sources - Nouveaux dépôts de code source" |
| 209 | + :link "https://code.gouv.fr/data/latest-repositories.xml" |
| 210 | + :description "code.gouv.fr/sources - Nouveaux dépôts de code source"}) |
| 211 | + (spit "latest-repositories.xml")) |
| 212 | + |
172 | 213 | ;; Output platforms.csv |
173 | 214 | (shell/sh "rm" "-f" "platforms.csv") |
174 | 215 | (doseq [{:keys [name kind]} @hosts] |
|
0 commit comments