Skip to content

Commit

Permalink
use exit codes
Browse files Browse the repository at this point in the history
  • Loading branch information
peuter committed Oct 19, 2016
1 parent 6f713b0 commit 27dec4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .doc/commands/doc.py
Expand Up @@ -22,6 +22,7 @@
import sh
import shutil
import json
import sys
from argparse import ArgumentParser
from . import Command

Expand All @@ -36,7 +37,8 @@ def __init__(self):

def _get_doc_version(self):
git = sh.Command("git")
branch = git("rev-parse", "--abbrev-ref", "HEAD").strip()
branch = git("rev-parse", "--abbrev-ref", "HEAD").strip() if os.environ.get('TRAVIS_BRANCH') is None \
else os.environ.get('TRAVIS_BRANCH')
print("'%s'" % branch)
if branch == "develop":
return self.config.get("DEFAULT", "develop-version-mapping")
Expand Down Expand Up @@ -113,6 +115,7 @@ def run(self, args):

if 'doc' not in options or options.doc == "manual":
self._run(options.language, options.target, options.browser, force=options.force, skip_screenshots=not options.complete)
sys.exit(0)
elif options.doc == "source":
grunt = sh.Command("grunt")
if options.target is not None:
Expand All @@ -122,4 +125,4 @@ def run(self, args):
grunt("api-doc", "--subDir=jsdoc", "--browserName=%s" % options.browser, "--targetDir=%s" % target_dir, _out=self.process_output, _err=self.process_output)
else:
self.log.error("generation of '%s' documentation is not available" % options.type)
exit(1)
sys.exit(1)
2 changes: 1 addition & 1 deletion .doc/main.py
Expand Up @@ -53,7 +53,7 @@ def main():

elif options.action not in commands:
print("action '%s' is not available" % options.action)
exit(1)
sys.exit(1)

else:
handler = commands[options.action]()
Expand Down

0 comments on commit 27dec4a

Please sign in to comment.