Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions src/playground/data/config.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns playground.data.config
(:require [cheshire.core :as json]
[clj-http.client :as http]
[clojure.string :as string]
[playground.utils.utils :as utils]))


Expand Down Expand Up @@ -33,12 +34,32 @@
(defonce *anychart-versions (atom []))


(defn- gh-names
"Fetch the :name field from a GitHub list endpoint (branches/tags)."
[url]
(->> (http/get url) :body (#(json/parse-string % true)) (map :name)))


(defn- tag->version
"Strip the leading v from semver release tags (v8.14.1 -> 8.14.1) so the
cdn.anychart.com/releases/<v>/ URLs resolve; leave aliases like v7/v8 as-is."
[name]
(string/replace name #"^v(\d+\.\d+\.\d+)$" "$1"))


(defn update-anychart-versions []
;; ACWEB-6: include release TAGS (v8.8.0..v8.14.1), not just branches, so the
;; editor's AnyChart-version selector shows the full release list. Tags are
;; v-prefixed but CDN release paths are bare, so strip the v from semver tags.
;; NOTE: per_page=100 single page (engine has ~24 branches / ~50 tags); add
;; pagination if either ever exceeds 100.
(try
(let [data (http/get "https://api.github.com/repos/AnyChart/AnyChart/branches?per_page=100")
branches (json/parse-string (:body data) true)
branches (map :name branches)]
(reset! *anychart-versions branches))
(reset! *anychart-versions
(distinct
(concat
(gh-names "https://api.github.com/repos/AnyChart/AnyChart/branches?per_page=100")
(map tag->version
(gh-names "https://api.github.com/repos/AnyChart/AnyChart/tags?per_page=100")))))
(catch Exception _ (reset! *anychart-versions '()))))


Expand Down
6 changes: 5 additions & 1 deletion src/playground/generator/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@
(timbre/info "Delete repos: " (pr-str (map :name deleted-repos)))
(doseq [repo deleted-repos]
(delete-repo db repo))
(let [result (map #(check-repository generator db % (get-repo-by-name-fn @% db-repos)) repos)]
;; ACWEB-6: force realization — check-repository must run for every repo
;; (sets :git, triggers startup sync). The notifier is a no-op stub, so the
;; lazy `map` was never realized → check-repository never ran → repos had
;; :git nil and no startup sync. `doall` decouples the sync from the notifier.
(let [result (doall (map #(check-repository generator db % (get-repo-by-name-fn @% db-repos)) repos))]
(notifier/complete-sync notifier
(remove :e result)
(filter :e result)))))
Expand Down