Esempio n. 1
0
    def _execute(self, command, args):

        self.logger = get_logger(CommandGitHubDeploy.name,
                                 self.site.loghandlers)
        self._source_branch = self.site.config.get('GITHUB_SOURCE_BRANCH',
                                                   'master')
        self._deploy_branch = self.site.config.get('GITHUB_DEPLOY_BRANCH',
                                                   'gh-pages')
        self._remote_name = self.site.config.get('GITHUB_REMOTE_NAME',
                                                 'origin')

        self._ensure_git_repo()

        if not self._prompt_continue():
            return

        build = main(['build'])
        if build != 0:
            self.logger.error('Build failed, not deploying to GitHub')
            sys.exit(build)

        only_on_output, _ = real_scan_files(self.site)
        for f in only_on_output:
            os.unlink(f)

        self._checkout_deploy_branch()

        self._copy_output()

        self._commit_and_push()

        return
Esempio n. 2
0
    def _execute(self, command, args):

        self.logger = get_logger(
            CommandGitHubDeploy.name, self.site.loghandlers
        )

        # Check if ghp-import is installed
        check_ghp_import_installed()

        # Build before deploying
        build = main(['build'])
        if build != 0:
            self.logger.error('Build failed, not deploying to GitHub')
            sys.exit(build)

        # Clean non-target files
        l = self._doitargs['cmds'].get_plugin('list')(config=self.config, **self._doitargs)
        only_on_output, _ = real_scan_files(l, self.site)
        for f in only_on_output:
            os.unlink(f)

        # Commit and push
        self._commit_and_push()

        return
Esempio n. 3
0
    def _execute(self, options, args):
        """Run the deployment."""
        self.logger = get_logger(CommandGitHubDeploy.name)

        # Check if ghp-import is installed
        check_ghp_import_installed()

        # Build before deploying
        build = main(['build'])
        if build != 0:
            self.logger.error('Build failed, not deploying to GitHub')
            return build

        # Clean non-target files
        only_on_output, _ = real_scan_files(self.site)
        for f in only_on_output:
            os.unlink(f)

        # Remove drafts and future posts if requested (Issue #2406)
        undeployed_posts = clean_before_deployment(self.site)
        if undeployed_posts:
            self.logger.notice(
                "Deleted {0} posts due to DEPLOY_* settings".format(
                    len(undeployed_posts)))

        # Commit and push
        self._commit_and_push(options['commit_message'])

        return
Esempio n. 4
0
    def _execute(self, options, args):
        """Run the deployment."""
        self.logger = get_logger(CommandGitHubDeploy.name, STDERR_HANDLER)

        # Check if ghp-import is installed
        check_ghp_import_installed()

        # Build before deploying
        build = main(['build'])
        if build != 0:
            self.logger.error('Build failed, not deploying to GitHub')
            return build

        # Clean non-target files
        only_on_output, _ = real_scan_files(self.site)
        for f in only_on_output:
            os.unlink(f)

        # Remove drafts and future posts if requested (Issue #2406)
        undeployed_posts = clean_before_deployment(self.site)
        if undeployed_posts:
            self.logger.notice("Deleted {0} posts due to DEPLOY_* settings".format(len(undeployed_posts)))

        # Commit and push
        self._commit_and_push(options['commit_message'])

        return
Esempio n. 5
0
    def _execute(self, command, args):

        self.logger = get_logger(
            CommandGitHubDeploy.name, self.site.loghandlers
        )
        self._source_branch = self.site.config.get(
            'GITHUB_SOURCE_BRANCH', 'master'
        )
        self._deploy_branch = self.site.config.get(
            'GITHUB_DEPLOY_BRANCH', 'gh-pages'
        )
        self._remote_name = self.site.config.get(
            'GITHUB_REMOTE_NAME', 'origin'
        )
        self._pull_before_commit = self.site.config.get(
            'GITHUB_PULL_BEFORE_COMMIT', False
        )

        self._ensure_git_repo()

        self._exit_if_output_committed()

        if not self._prompt_continue():
            return

        build = main(['build'])
        if build != 0:
            self.logger.error('Build failed, not deploying to GitHub')
            sys.exit(build)

        only_on_output, _ = real_scan_files(self.site)
        for f in only_on_output:
            os.unlink(f)

        self._checkout_deploy_branch()

        self._copy_output()

        self._commit_and_push()

        return
Esempio n. 6
0
    def _execute(self, command, args):
        """Run the deployment."""
        self.logger = get_logger(CommandGitHubDeploy.name, STDERR_HANDLER)

        # Check if ghp-import is installed
        check_ghp_import_installed()

        # Build before deploying
        build = main(['build'])
        if build != 0:
            self.logger.error('Build failed, not deploying to GitHub')
            return build

        # Clean non-target files
        only_on_output, _ = real_scan_files(self.site)
        for f in only_on_output:
            os.unlink(f)

        # Commit and push
        self._commit_and_push()

        return
Esempio n. 7
0
    def _execute(self, options, args):
        """Run the deployment."""
        self.logger = get_logger(CommandGitHubDeploy.name, STDERR_HANDLER)

        # Check if ghp-import is installed
        check_ghp_import_installed()

        # Build before deploying
        build = main(['build'])
        if build != 0:
            self.logger.error('Build failed, not deploying to GitHub')
            return build

        # Clean non-target files
        only_on_output, _ = real_scan_files(self.site)
        for f in only_on_output:
            os.unlink(f)

        # Commit and push
        self._commit_and_push(options['commit_message'])

        return
Esempio n. 8
0
    def _execute(self, command, args):

        self.logger = get_logger(CommandGitHubDeploy.name, self.site.loghandlers)

        # Check if ghp-import is installed
        check_ghp_import_installed()

        # Build before deploying
        build = main(["build"])
        if build != 0:
            self.logger.error("Build failed, not deploying to GitHub")
            return build

        # Clean non-target files
        only_on_output, _ = real_scan_files(self.site)
        for f in only_on_output:
            os.unlink(f)

        # Commit and push
        self._commit_and_push()

        return
Esempio n. 9
0
    def _execute(self, command, args):

        self.logger = get_logger(
            CommandGitHubDeploy.name, self.site.loghandlers
        )

        # Check if ghp-import is installed
        check_ghp_import_installed()

        # Build before deploying
        build = main(['build'])
        if build != 0:
            self.logger.error('Build failed, not deploying to GitHub')
            sys.exit(build)

        # Clean non-target files
        only_on_output, _ = real_scan_files(self.site)
        for f in only_on_output:
            os.unlink(f)

        # Commit and push
        self._commit_and_push()

        return
Esempio n. 10
0
 def _execute(self, options, args):
     """Run the orphans command."""
     orphans = real_scan_files(self.site)[0]
     print('\n'.join([p for p in orphans if not os.path.isdir(p)]))
Esempio n. 11
0
 def _execute(self, options, args):
     """Run the orphans command."""
     orphans = real_scan_files(self.site)[0]
     print('\n'.join([p for p in orphans if not os.path.isdir(p)]))
Esempio n. 12
0
 def _execute(self, options, args):
     l = self._doitargs['cmds'].get_plugin('list')(config=self.config, **self._doitargs)
     orphans = real_scan_files(l, self.site)[0]
     print('\n'.join([p for p in orphans if not os.path.isdir(p)]))