Skip to content

Commit

Permalink
global config
Browse files Browse the repository at this point in the history
  • Loading branch information
Robpol86 committed Aug 8, 2016
1 parent 0643e2a commit 2feb517
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sphinxcontrib/versioning/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
from docopt import docopt

from sphinxcontrib.versioning import __version__
from sphinxcontrib.versioning.configuration import GlobalConfig
from sphinxcontrib.versioning.git import clone, commit_and_push, get_root, GitError
from sphinxcontrib.versioning.lib import HandledError, TempDir
from sphinxcontrib.versioning.routines import build_all, gather_git_info, pre_build
Expand Down Expand Up @@ -121,6 +122,8 @@ def main_build(config, root, destination):
candidates = [r for r in versions.remotes if r['kind'] == 'tags']
if not candidates:
log.warning('No git tags with docs found in remote. Falling back to --root-ref value.')
GlobalConfig.GREATEST_TAG = False
GlobalConfig.RECENT_TAG = False
else:
multi_sort(candidates, ['semver' if config['--greatest-tag'] else 'chrono'])
root_ref = candidates[0]['name']
Expand Down
11 changes: 11 additions & 0 deletions sphinxcontrib/versioning/configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Store run-time configuration in a globally accessible class."""


class GlobalConfig(object):
"""The global config for the project. Should be updated only at the beginning of run-time.
Only define values set by external configuration sources.
"""

GREATEST_TAG = False
RECENT_TAG = False

0 comments on commit 2feb517

Please sign in to comment.