Merge pull request #3549 from InspectorCaracal/patch-29

Update static files from the git integration command when code updates
This commit is contained in:
Griatch 2024-06-14 12:34:30 +02:00 committed by GitHub
commit 29f6121ef2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,6 +2,7 @@ import datetime
import git import git
from django.conf import settings from django.conf import settings
from django.core.management import call_command
import evennia import evennia
from evennia import CmdSet, InterruptCommand from evennia import CmdSet, InterruptCommand
@ -140,21 +141,25 @@ class GitCommand(MuxCommand):
Provide basic Git functionality within the game. Provide basic Git functionality within the game.
""" """
caller = self.caller caller = self.caller
reload = False
if self.action == "status": if self.action == "status":
caller.msg(self.get_status()) caller.msg(self.get_status())
elif self.action == "branch" or (self.action == "checkout" and not self.args): elif self.action == "branch" or (self.action == "checkout" and not self.args):
caller.msg(self.get_branches()) caller.msg(self.get_branches())
elif self.action == "checkout": elif self.action == "checkout":
if self.checkout(): reload = self.checkout()
evennia.SESSION_HANDLER.portal_restart_server()
elif self.action == "pull": elif self.action == "pull":
if self.pull(): reload = self.pull()
evennia.SESSION_HANDLER.portal_restart_server()
else: else:
caller.msg("You can only git status, git branch, git checkout, or git pull.") caller.msg("You can only git status, git branch, git checkout, or git pull.")
return return
if reload:
# reload the server and the static file cache
evennia.SESSION_HANDLER.portal_restart_server()
call_command("collectstatic", interactive=False)
class CmdGitEvennia(GitCommand): class CmdGitEvennia(GitCommand):
""" """