Skip to content

Commit

Permalink
Test unpublish
Browse files Browse the repository at this point in the history
  • Loading branch information
tonsky committed May 31, 2022
1 parent 653ec22 commit 584a9b9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,3 +1,4 @@
firebase-key.json
node_modules
checkout
checkout/*
!checkout/.keep
Empty file added checkout/.keep
Empty file.
13 changes: 0 additions & 13 deletions extensions/tonsky/roam-calculator.json

This file was deleted.

8 changes: 4 additions & 4 deletions src/community_extensions/build.clj
Expand Up @@ -20,8 +20,8 @@

(defn -main [& {:as args-map}]
(doseq [[mode ext-id data] (core/diff args-map)]
(cond
(= "A" mode) (build ext-id data)
(= "M" mode) (build ext-id data)
(str/starts-with? "R" mode) :nop))
(case mode
"A" (build ext-id data)
"M" (build ext-id data)
nil))
(shutdown-agents))
6 changes: 3 additions & 3 deletions src/community_extensions/core.clj
Expand Up @@ -24,7 +24,7 @@
:when (str/starts-with? path "extensions/")
:let [[_ user repo] (re-matches #"extensions/([^/]+)/([^/]+)\.json" path)
ext-id (str user "+" repo)
data (-> (io/file path)
(slurp)
(json/parse-string))]]
file (io/file path)
data (when (.exists file)
(json/parse-string (slurp file)))]]
[mode ext-id data])))
10 changes: 5 additions & 5 deletions src/community_extensions/publish.clj
Expand Up @@ -111,9 +111,9 @@
(.build)
(.getService))]
(doseq [[mode ext-id data] (core/diff args-map)]
(cond
(= "A" mode) (publish db storage ext-id data)
(= "M" mode) (publish db storage ext-id data)
(str/starts-with? "R" mode) (unpublish db ext-id)))

(case mode
"A" (publish db storage ext-id data)
"M" (publish db storage ext-id data)
"D" (unpublish db ext-id)
nil))
(shutdown-agents)))

0 comments on commit 584a9b9

Please sign in to comment.