Skip to content

Commit

Permalink
minor: automatically determine repo name
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fiers committed Oct 23, 2012
1 parent c1d6f9a commit d34d636
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bin/moa_template_setup
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ Little helper script to prepare a template directory
"""
import argparse
import datetime
import logging
import os
import sys
import jinja2

logging.basicConfig(level=logging.DEBUG)
l = logging.getLogger("Moa template setup")
import Yaco

LICENSES = {
Expand All @@ -17,7 +20,8 @@ LICENSES = {
}

parser = argparse.ArgumentParser(description="Prepare a template for github")
parser.add_argument('dir', help='containing the directory')
parser.add_argument('dir', nargs='?', default='.',
help='containing the directory')
parser.add_argument('-f', '--force', help='force overwriting of files',
action='store_true', default=False)
parser.add_argument('-l', '--license', nargs='?', default='gplv3',
Expand All @@ -34,6 +38,10 @@ def process_dir():
indir = args.dir
os.chdir(indir)

fulldir = os.path.abspath(indir).rstrip('/')
name = fulldir.split('/')[-1]
l.info("assuming remote git repo will be %s" % name)

os.system('git init')
template_file = 'template'
if not os.path.exists(template_file):
Expand Down Expand Up @@ -67,7 +75,7 @@ def process_dir():

print "possible commands that might need to be executed"
print "writing README.md"
print "hub create"
print "hub create %s" % name
print 'git commit -m "autogenerated license & readme"'
print 'git push origin master'

Expand Down

0 comments on commit d34d636

Please sign in to comment.