-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
440 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.. automodule:: sphinxcontrib.collections.drivers.git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.. automodule:: sphinxcontrib.collections.drivers.jinja | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.. automodule:: sphinxcontrib.collections.drivers.symlink | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Hey Hooo! | ||
|
||
It's {{name}} from {{city}}! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
git | ||
=== | ||
``git`` driver clones a given repository into a target folder. | ||
URL must be given by ``source`` parameter. | ||
.. code-block:: python | ||
collections = { | ||
'my_files': { | ||
'driver': 'git', | ||
'source': 'https://github.com/useblocks/sphinx_dummy.git', | ||
} | ||
} | ||
``Sphinx-Collections`` will clone the given repository into ``_collections/my_files/``. | ||
.. hint:: | ||
``Git`` binary must be installed on the system, so that the used Python library ``gitpython`` can use it. | ||
""" | ||
|
||
|
||
from shutil import rmtree | ||
|
||
from git import Repo | ||
from sphinxcontrib.collections.drivers import Driver | ||
|
||
|
||
class GitDriver(Driver): | ||
|
||
def run(self): | ||
self.info('Cloning git repository...') | ||
|
||
try: | ||
Repo.clone_from(self.config['source'], | ||
self.config['target']) | ||
except Exception as e: | ||
self.error('Problems during cloning repository.', e) | ||
|
||
def clean(self): | ||
try: | ||
rmtree(self.config['target']) | ||
self.info('Repository deleted: {}'.format(self.config['target'])) | ||
except FileNotFoundError: | ||
# Already cleaned? I'm okay with it. | ||
self.info('Cloned repository folder already cleaned.') | ||
except IOError as e: | ||
self.error('Problems during cleaning for collection {}'.format(self.config['name']), e) |
Oops, something went wrong.