Exemplo n.º 1
0
    def _save(self):
        """Clowder save command private implementation

        :raise ClowderExit:
        """

        if self.app.pargs.version.lower() == 'default':
            print(fmt.save_default_error(self.app.pargs.version))
            raise ClowderExit(1)

        CLOWDER_REPO.print_status()
        validate_projects_exist(CLOWDER_CONTROLLER)
        validate_groups(CLOWDER_CONTROLLER.groups)

        version_name = self.app.pargs.version.replace(
            '/', '-')  # Replace path separators with dashes
        version_dir = os.path.join(ROOT_DIR, '.clowder', 'versions',
                                   version_name)
        _make_dir(version_dir)

        yaml_file = os.path.join(version_dir, 'clowder.yaml')
        if os.path.exists(yaml_file):
            print(
                fmt.save_version_exists_error(version_name, yaml_file) + '\n')
            raise ClowderExit(1)

        print(fmt.save_version(version_name, yaml_file))
        save_yaml(CLOWDER_CONTROLLER.get_yaml(), yaml_file)
Exemplo n.º 2
0
    def _init(self):
        """Clowder init command private implementation

        :raise ClowderExit:
        """

        if os.path.isdir(CLOWDER_REPO.clowder_path):
            cprint('Clowder already initialized in this directory\n', 'red')
            raise ClowderExit(1)

        url_output = colored(self.app.pargs.url, 'green')
        print('Create clowder repo from ' + url_output + '\n')
        if self.app.pargs.branch is None:
            branch = 'master'
        else:
            branch = str(self.app.pargs.branch[0])
        CLOWDER_REPO.init(self.app.pargs.url, branch)
Exemplo n.º 3
0
    def _commit(self):
        """Clowder repo commit command private implementation"""

        CLOWDER_REPO.commit(self.app.pargs.message[0])
Exemplo n.º 4
0
    def _add(self):
        """Clowder repo add command private implementation"""

        CLOWDER_REPO.add(self.app.pargs.files)
Exemplo n.º 5
0
        def _status(self):
            """Clowder repo status command private implementation"""

            CLOWDER_REPO.git_status()
Exemplo n.º 6
0
        def _clean(self):
            """Clowder repo clean command private implementation"""

            CLOWDER_REPO.clean()
Exemplo n.º 7
0
        def _checkout(self):
            """Clowder repo checkout command private implementation"""

            CLOWDER_REPO.checkout(self.app.pargs.ref[0])
Exemplo n.º 8
0
    def _run(self):
        """Clowder repo run command private implementation"""

        CLOWDER_REPO.run_command(self.app.pargs.command[0])
Exemplo n.º 9
0
    def _push(self):
        """Clowder repo push command private implementation"""

        CLOWDER_REPO.push()