How to use the mike.git_utils.read_file 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_git_utils.py View on Github external
def test_nonexistent_file(self):
        self.assertRaises(git_utils.GitError, git_utils.read_file, 'branch',
                          'nonexist.txt')
github jimporter / mike / test / unit / test_git_utils.py View on Github external
def test_read_file(self):
        self.assertEqual(git_utils.read_file('branch', 'file.txt'),
                         b'this is some text')
github jimporter / mike / test / unit / test_git_utils.py View on Github external
def test_read_file_as_text(self):
        self.assertEqual(git_utils.read_file('branch', 'file.txt',
                                             universal_newlines=True),
                         'this is some text')
github jimporter / mike / mike / commands.py View on Github external
def list_versions(branch='gh-pages'):
    try:
        return Versions.loads(git_utils.read_file(
            branch, versions_file, universal_newlines=True
        ))
    except git_utils.GitError:
        return Versions()
github jimporter / mike / mike / server.py View on Github external
def do_GET(self):
        path = self.send_headers()
        if path is not None:
            body = git_utils.read_file(self.branch, path)
            self.wfile.write(body)