Example #1
0
 def action():
     path = Path.cwd()
     dirs = [d for d in path.iterdir() if d.is_dir() and d.match("ISSUE-*")]
     return [
         JsonConvert.FromFile(_generate_issue_file_path(i.parts[-1]))
         for i in dirs
     ]
Example #2
0
def get_issue(id):
    gm = GitManager()
    try:
        return gm.perform_git_workflow(
            lambda: JsonConvert.FromFile(_generate_issue_file_path(id)))
    except IOError:
        return None
Example #3
0
 def _get_comment(self, entry):
     try:
         return JsonConvert.FromFile(entry.path)
     except FileNotFoundError as err:
         msg = f"An invalid index entry has been found for file \"{err.filename}\"." \
               f" Please reconstruct the index for {self.folder_path}"
         raise index.IndexEntryInvalidError(msg)
Example #4
0
    def obtain_index(cls, path):
        index_path = cls._generate_index_path(path)

        if (index_path.exists()):
            return JsonConvert.FromFile(index_path)
        else:
            index = Index()
            return index
Example #5
0
    def obtain_tracker(cls):
        tracker = None    
        path = cls.get_path()

        if path.exists():
            tracker = JsonConvert.FromFile(path)
        else:
            tracker = Tracker()

        return tracker
Example #6
0
        def action():
            start_pos = (page - 1) * limit
            end = start_pos + limit

            path = Path.cwd()
            dirs = [
                d for d in path.iterdir() if d.is_dir() and d.match("ISSUE-*")
            ]
            range = dirs[start_pos:end]
            return [
                JsonConvert.FromFile(_generate_issue_file_path(i.parts[-1]))
                for i in range
            ], len(dirs)
Example #7
0
    def get_issue_from_issue_id(self, id):
        gm = GitManager()
        is_loaded = gm.is_inside_branch()

        if not is_loaded:
            gm.load_issue_branch()

        try:
            file = JsonConvert.FromFile(_generate_issue_file_path(id))
        except FileNotFoundError:
            return None

        if not is_loaded:
            gm.unload_issue_branch()

        return file