Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrowley committed Feb 22, 2012
1 parent 93fb52d commit 0fd1165
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin/blueprint-create
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import sys

import blueprint.cli
from blueprint import context_managers
import blueprint.git

parser = optparse.OptionParser('Usage: %prog [-d <subtrahend>] [-P|-C|-S|...] '
'[-m <message>] [-r] [-q] <name>')
Expand Down Expand Up @@ -57,6 +58,14 @@ if 1 != len(args):
parser.print_usage()
sys.exit(1)

if not blueprint.git.configured():
logging.error('please give Git your name and email address so commits have an author')
logging.error('')
logging.error(' git config --global user.email "[email protected]"')
logging.error(' git config --global user.name "Your Name"')
logging.error('')
sys.exit(1)

b = blueprint.cli.create(options, args)

try:
Expand Down
9 changes: 9 additions & 0 deletions blueprint/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,12 @@ def commit_tree(tree, message='', parent=None):
if 0 != status:
return None
return stdout.rstrip()


def configured():
"""
Return `True` if the author is configured in Git. This allows Blueprint
to bail out early for users that don't have things configured just right.
"""
return not git('config', 'user.name', raise_exc=False)[0] \
and not git('config', 'user.email', raise_exc=False)[0]

0 comments on commit 0fd1165

Please sign in to comment.