From b4a6261b8d9c5048f24f8a35bac0ec0114752b65 Mon Sep 17 00:00:00 2001 From: Daniel Kontsek Date: Sun, 15 Apr 2018 23:52:19 +0200 Subject: [PATCH] Fixed esdc-docs git checkout Related to #338 --- core/management/commands/gendoc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/management/commands/gendoc.py b/core/management/commands/gendoc.py index da73e784..d86e898e 100644 --- a/core/management/commands/gendoc.py +++ b/core/management/commands/gendoc.py @@ -1,5 +1,6 @@ import os import re +import shutil from ._base import DanubeCloudCommand, CommandOption, CommandError, lcd @@ -63,13 +64,17 @@ def gendoc_user_guide(self, fallback_branch='master'): else: self.display('We are on branch "%s"' % branch) - if self._path_exists(self.DOC_TMP_DIR): + if self._path_exists(self.DOC_TMP_DIR, 'user-guide', 'conf.py'): existing_repo = True self.display('%s already exists in %s' % (self.DOC_REPO, self.DOC_TMP_DIR), color='yellow') with lcd(self.DOC_TMP_DIR): self.local('git fetch') self.display('%s has been successfully updated.' % self.DOC_REPO, color='green') else: + if self._path_exists(self.DOC_TMP_DIR): + self.display('Removing stale %s', self.DOC_TMP_DIR, color='yellow') + shutil.rmtree(self.DOC_TMP_DIR) + existing_repo = False self.local('git clone %s %s' % (self.DOC_REPO, self.DOC_TMP_DIR)) self.display('%s has been successfully cloned.' % self.DOC_TMP_DIR, color='green')