How to use the mike.commands function in mike

To help you get started, we’ve selected a few mike examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jimporter / mike / test / unit / test_commands.py View on Github external
def test_versions_exist(self):
        with git_utils.Commit('gh-pages', 'add versions.json') as commit:
            commit.add_file(git_utils.FileInfo(
                'versions.json',
                '[{"version": "1.0", "title": "1.0", "aliases": []}]',
            ))

        self.assertEqual(list(commands.list_versions()), [
            versions.VersionInfo('1.0'),
        ])
github jimporter / mike / test / unit / test_commands.py View on Github external
def _deploy(self, branch='gh-pages'):
        commands.deploy(self.stage, '1.0', aliases=['stable'], branch=branch)
        commands.deploy(self.stage, '2.0', branch=branch)
github jimporter / mike / test / unit / test_commands.py View on Github external
def test_serve(self):
        class MyMockServer(MockServer):
            def serve_forever(self):
                self.handle_request(MockRequest())
                raise KeyboardInterrupt()

        handler_name = 'mike.server.GitBranchHTTPHandler'
        with mock.patch('http.server.HTTPServer', MyMockServer), \
             mock.patch(handler_name + '.wbufsize', -1), \
             mock.patch(handler_name + '.log_message') as m:  # noqa
            commands.serve(branch='branch', verbose=False)
            self.assertEqual(m.call_args[0][1:3], ('GET / HTTP/1.1', '200'))
github jimporter / mike / test / unit / test_commands.py View on Github external
def test_nonexistent(self):
        commands._makedirs('dir')
        assertDirectory('.', {'dir'})
github jimporter / mike / test / unit / test_commands.py View on Github external
def test_versions_nonexistent(self):
        self.assertEqual(list(commands.list_versions()), [])
github jimporter / mike / mike / driver.py View on Github external
def deploy(args):
    check_remote_status(args, strict=True)
    mkdocs.build(args.config_file)
    commands.deploy(mkdocs.site_dir(args.config_file), args.version,
                    args.title, args.alias, args.update_aliases, args.branch,
                    args.message)
    if args.push:
        git_utils.push_branch(args.remote, args.branch, args.force)
github jimporter / mike / mike / driver.py View on Github external
def serve(args):
    check_remote_status(args)
    commands.serve(args.dev_addr, args.branch)