def _start_metadirs(exclude=None): """ Builds and returns all metadirs. exclude is the exclude_method optionally needed by the MetadirController constructor. """ metadirs = [] for project, project_attrs in config['projects'].iteritems(): # For each project, verify if the .baboon metadir is valid and # take some decisions about needed actions on the repository. metadir = MetadirController(project, project_attrs['path'], exclude) metadirs.append(metadir) metadir.go() return metadirs
def _delete_metadir(project_name, project_path): """ Delete the metadir on the project_path. Raised a CommandException on error. """ try: MetadirController(project_name, project_path).delete() except EnvironmentError: raise CommandException(500, "Cannot delete the metadir directory.")
def init(): """ Initialialize a new project. """ check_config() project = config['parser']['project'] project_path = _get_project_path(project) url = config['parser']['git-url'] print("Initialize the project %s..." % project) with AdminTransport(logger_enabled=False) as transport: ret_status, msg = transport.first_git_init(project, url) metadir_controller = MetadirController(project, project_path) metadir_controller.init_index() metadir_controller.create_baboon_index() metadir_controller.index.close() if not _on_action_finished(ret_status, msg): _delete_metadir(project, project_path)