def add(self, path):
        project = Project(path)
        if project.getName() in self.projects:
            raise ProjectAlreadyAddedException(
                'Project %s was already added earlier.' % (path))

        self.projects[project.getName()] = project

        self.config.setProjects(self.getPlainProjects())
        return self.config.write()
    def __init__(self):
        self.config.load()

        config = self.config.get()
        if 'projects' not in config \
        or type(config['projects']) != dict \
        or len(config['projects']) == 0:
            projects = {}
        else:
            projects = config['projects']

        for projectPath in projects:
            try:
                project = Project(projects[projectPath])
                self.projects[project.getName()] = project
            except NoDockerComposeFileException:
                pass
 def remove(self, path):
     project = Project(path)
     self.checkProject(project.getName())
     del self.projects[project.getName()]
     self.config.setProjects(self.getPlainProjects())
     return self.config.write()