Skip to content

Commit f76198b

Browse files
author
Bastien Guerry
committed
src/codegouvfr.clj: Fix output-latest-releases-xml
1 parent 77557e3 commit f76198b

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

src/codegouvfr.clj

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,9 @@
455455
(map #(str (get (val %) "releases_url") "?per_page=3"))
456456
(filter #(re-matches #"^https://.*" %))
457457
get-urls-json
458-
(map #(select-keys % [:url :html_url :tag_name :body :published_at]))
458+
(map #(select-keys % [:url :uuid :name :html_url :tag_name :body :published_at]))
459+
(map #(assoc % :repo_name
460+
(last (re-matches #"https://[^/]+/([^/]+/[^/]+).*" (:html_url %)))))
459461
(map #(update-in % [:body] (fn [s] (shorten-string s)))))]
460462
(doseq [[k v] @awesome]
461463
(let [rels (filter #(str/includes? (str/lower-case (:html_url %)) k) data)]
@@ -509,27 +511,11 @@
509511
:description "code.gouv.fr - Nouveaux logiciels libres au SILL - New SILL entries"})
510512
(spit "latest-sill.xml")))
511513

512-
;; (defn output-latest-owners-xml []
513-
;; (->> @owners
514-
;; (filter #(:created_at (val %)))
515-
;; (sort-by #(clojure.instant/read-instant-date (:created_at (val %))))
516-
;; reverse
517-
;; (take 10)
518-
;; (map (fn [[o o-data]]
519-
;; {:title (str "Nouveau compte dans code.gouv.fr : " (:name o-data))
520-
;; :link (:html_url o-data)
521-
;; :guid o
522-
;; :description (:description o-data)
523-
;; :pubDate (toInst (:created_at o-data))}))
524-
;; (rss/channel-xml
525-
;; {:title "code.gouv.fr/sources - Nouveaux comptes d'organisation"
526-
;; :link "https://code.gouv.fr/data/latest-repositories.xml"
527-
;; :description "code.gouv.fr/sources - Nouveaux comptes d'organisation"})
528-
;; (spit "latest-owners.xml")))
529-
530-
;; FIXME
531514
(defn output-latest-releases-xml []
532-
(->> @awesome-releases
515+
(->> @awesome
516+
vals
517+
(map #(get % "releases"))
518+
flatten
533519
(sort-by #(clojure.instant/read-instant-date (:published_at %)))
534520
reverse
535521
(take 10)
@@ -696,7 +682,6 @@
696682
(output-owners-csv)
697683
(output-annuaire-sup)
698684
(output-latest-sill-xml)
699-
;; (output-latest-owners-xml)
700685
(output-repositories-json)
701686
(output-repositories-json :full)
702687
(output-repositories-csv)

0 commit comments

Comments
 (0)