def test_deploy_ignore_version(self, mock_import, check_version, get_remote, get_sha, is_repo): config = load_config( remote_branch='test', ) gh_deploy.gh_deploy(config, ignore_version=True) check_version.assert_not_called()
def test_deploy_no_cname(self, mock_isfile, mock_import, get_remote, get_sha, is_repo): config = load_config( remote_branch='test', ) gh_deploy.gh_deploy(config)
def test_deploy_ignore_version_default(self, mock_import, check_version, get_remote, get_sha, is_repo): config = load_config( remote_branch='test', ) gh_deploy.gh_deploy(config) self.assert_mock_called_once(check_version)
def test_deploy_ignore_version_default(self, mock_import, check_version, get_remote, get_sha, is_repo): config = load_config( remote_branch='test', ) gh_deploy.gh_deploy(config) check_version.assert_called_once()
def test_deploy_no_cname(self, mock_isfile, mock_import, check_version, get_remote, get_sha, is_repo): config = load_config( remote_branch='test', ) gh_deploy.gh_deploy(config)
def handle_mkdocs_ghdeploy(): delete_branch('gh-pages') cfg = config.load_config( config_file=os.path.join(CWD, "docs/mkdocs.yml"), repo_url='[email protected]:sumeetpatil/TravisTest.git') build.build(cfg) print('Deploying {} Github Pages to {}#gh-pages') gh_deploy.gh_deploy(cfg, force=True)
def handle_mkdocs_ghdeploy(to_ghdeploy, kind, remote): if to_ghdeploy: delete_branch('gh-pages') cfg = config.load_config(config_file=os.path.join( CWD, select_config(kind)), remote_name=remote) build.build(cfg) print('Deploying {} Github Pages to {}#gh-pages'.format(kind, remote)) gh_deploy.gh_deploy(cfg, force=True)
def gh_deploy_command(clean, message, remote_branch, remote_name, force, ignore_version, shell, **kwargs): """Deploy your documentation to GitHub Pages""" cfg = config.load_config( remote_branch=remote_branch, remote_name=remote_name, **kwargs ) build.build(cfg, dirty=not clean) gh_deploy.gh_deploy(cfg, message=message, force=force, ignore_version=ignore_version, shell=shell)
def gh_deploy_command(config_file, clean, message, remote_branch, remote_name): """Deploy your documentation to GitHub Pages""" try: config = load_config(config_file=config_file, remote_branch=remote_branch, remote_name=remote_name) build.build(config, clean_site_dir=clean) gh_deploy.gh_deploy(config, message=message) except exceptions.ConfigurationError as e: # Avoid ugly, unhelpful traceback raise SystemExit('\n' + str(e))
def gh_deploy_command(config_file, clean, message, remote_branch, remote_name, force): """Deploy your documentation to GitHub Pages""" try: cfg = config.load_config(config_file=config_file, remote_branch=remote_branch, remote_name=remote_name) build.build(cfg, dirty=not clean) gh_deploy.gh_deploy(cfg, message=message, force=force) except exceptions.ConfigurationError as e: # pragma: no cover # Avoid ugly, unhelpful traceback raise SystemExit('\n' + str(e))
def test_deploy_error(self, mock_log, mock_import, check_version, get_sha, is_repo): error_string = 'TestError123' mock_import.side_effect = GhpError(error_string) config = load_config( remote_branch='test', ) with self.assertRaises(Abort): gh_deploy.gh_deploy(config) mock_log.error.assert_called_once_with( f'Failed to deploy to GitHub with error: \n{error_string}' )
def gh_deploy_command(config_file, clean, message, remote_branch, remote_name): """Deploy your documentation to GitHub Pages""" try: config = load_config( config_file=config_file, remote_branch=remote_branch, remote_name=remote_name ) build.build(config, clean_site_dir=clean) gh_deploy.gh_deploy(config, message=message) except exceptions.ConfigurationError as e: # Avoid ugly, unhelpful traceback raise SystemExit('\n' + str(e))
def gh_deploy_command(config_file, clean, message, remote_branch, remote_name, force): """Deploy your documentation to GitHub Pages""" try: cfg = config.load_config( config_file=config_file, remote_branch=remote_branch, remote_name=remote_name ) build.build(cfg, dirty=not clean) gh_deploy.gh_deploy(cfg, message=message, force=force) except exceptions.ConfigurationError as e: # pragma: no cover # Avoid ugly, unhelpful traceback raise SystemExit('\n' + str(e))
def deploy(args): """ Deploy to Github Pages Args: args (argparse.Namespace): A Namespace object contaning all the command line arguments Raises: exceptions.ConfigurationError """ try: cfg = config.load_config(config_file=args.config_file, remote_branch=args.remote_branch, remote_name=args.remote_name) gh_deploy.gh_deploy(cfg, message=args.message, force=args.force, ignore_version=args.ignore_version) except exceptions.ConfigurationError as e: raise SystemExit('\n' + str(e))
def handle(self, *args, **options): # the location where the markdown and other files live docs_dir = os.path.join(os.path.dirname(settings.MAIN_DOC_YAML), 'docs') if options['site_dir']: site_dir = options['site_dir'] else: site_dir = os.path.join(os.path.dirname(settings.MAIN_DOC_YAML), 'site') kwargs = {'config_file': settings.MAIN_DOC_YAML, 'site_dir': site_dir} # build docs build.build(mkdocs_config.load_config(**kwargs), dirty=False) # generate the openAPI spec: generator = SchemaGenerator(title='WebMEV REST API Specification') schema = generator.get_schema(request=None, public=True) renderer = JSONOpenAPIRenderer() output = renderer.render(schema, renderer_context={}) with open(os.path.join(site_dir, 'openapi_spec.json'), 'w') as fout: fout.write(output.decode()) # add the information relevant for the commit/push kwargs['remote_name'] = options['remote_name'] kwargs['remote_branch'] = options['remote_branch'] # due to the way config info is accessed from within the mkdocs gh_deploy # function below, it needs both dict-like access and attribute-like access # UserDict fits that bill config = UserDict(kwargs) config.config_file_path = settings.MAIN_DOC_YAML if options['push']: gh_deploy.gh_deploy(config, message=options['message'])
def test_deploy_hostname(self, mock_import, get_remote, get_sha, is_repo): config = load_config( remote_branch='test', ) gh_deploy.gh_deploy(config)