gitSync when changing playgrounds file

This commit is contained in:
2023-04-12 08:58:34 -06:00
parent f1b70b42dd
commit 737e1a2066
2 changed files with 10 additions and 7 deletions

View File

@@ -39,7 +39,8 @@
(method changePlaygrounds [:Dynamic->Void change]
(change playgrounds)
(File.saveContent (joinPath archiveDir "playgrounds.json") (haxe.Json.stringify playgrounds "\t")))
(File.saveContent (joinPath archiveDir "playgrounds.json") (haxe.Json.stringify playgrounds "\t"))
(gitSync))
(method :String currentPlayground []
(dictGet playgrounds "default"))
@@ -87,11 +88,7 @@
(doFor system systems
(system.checkEntryInOrOut this e)))
(method _saveEntry [:Entry e]
(File.saveContent
(joinPath archiveDir "entries" (e.id.withExtension "json"))
(tink.Json.stringify e))
(method gitSync []
// Sync with git if the archive is a repository:
(whenLet [(Some gitDir) gitDir
gitDo ->gitArgs (assertProcess "git" gitArgs [] true archiveDir)]
@@ -101,6 +98,12 @@
(gitDo ["commit" "--no-verify" "-m" "$(Date.now)"])
(gitDo ["push"])))
(method _saveEntry [:Entry e]
(File.saveContent
(joinPath archiveDir "entries" (e.id.withExtension "json"))
(tink.Json.stringify e))
(gitSync))
(method fullString [:Entry e]
(haxe.Json.stringify e null "\t"))

View File

@@ -5,7 +5,7 @@
(defNew [&prop :ArchiveController controller]
[&mut :Bool setup false]
(super
"KeyShortcutSystem"aaa
"KeyShortcutSystem"
->[archive e]
(hasComponent e KeyShortcut)
->[archive e &opt ui]