Permalink
Browse files

Swagified djangobuilder.sh (see new '--noswag' option); it distinguis…

…h between server (git) hooks and devbox hooks
  • Loading branch information...
1 parent 6996823 commit 3d117b1e3d72cba6b644110d91fe22d0addf5cff @elimisteve elimisteve committed Apr 9, 2012
Showing with 35 additions and 16 deletions.
  1. +3 −0 devbox-hooks/prepare-commit-msg
  2. +30 −14 djangobuilder.py
  3. +2 −2 gitbuilder.sh
  4. 0 {hooks → server-hooks}/post-receive
@@ -0,0 +1,3 @@
+#!/bin/bash
+text=`cat .git/COMMIT_EDITMSG`
+echo "$text (swag)" > .git/COMMIT_EDITMSG
View
@@ -4,7 +4,7 @@
# Requires fabric, virtualenv, and virtualenvwrapper
#
-# FIXME This shouldn't be hard-coded
+# TODO: Should this be hard-coded?
GENERIC_SCRIPTS_PATH = 'generic_scripts/'
#import pbs
@@ -17,38 +17,46 @@
import argparse
-USAGE = 'usage: %s [-h] [-v] [--path PATH] [--cms | --zinnia]' % (sys.argv[0])
-#FUTURE_USAGE = USAGE + ' [--cms] [--zinnia]'
+USAGE = 'usage: %s --path PATH [-h] [-v] [--cms | --zinnia] --noswag' \
+ % (sys.argv[0])
if len(sys.argv) < 2:
print USAGE
sys.exit(0)
-# These are the arguements for the builder
-# We can extent the arguements as we want to add
-# more diversity
+# These are the arguements for the builder. We can extent the
+# arguments as we want to add more diversity
parser = argparse.ArgumentParser(description='''ProtoType Magic presents
Django Project Builder and so much more...''',
version='djangbuilder.py 0.2.3')
parser.add_argument('--path', action='store', dest='path',
help='''Use this to direct Django Project Builder
- to where the project should be made, including
- the project name at the end. e.g. /home/username/project_name''')
+ to where the project should be made, including the
+ project name at the end. e.g. /home/username/project_name'''
+ )
+parser.add_argument('--noswag', action='store_true', default=False,
+ help='''Stops appending " (swag)" to every commit message
+ (swag)''',
+ dest='noswag'
+ )
+
# This makes it so we don't derp and use --zinnia and --cms
cms_options = parser.add_mutually_exclusive_group()
cms_options.add_argument('--cms', action='store_true', default=False,
help='''This will include Django-CMS along with all
- typically used packages.''', dest='cms'
+ typically used packages.''',
+ dest='cms'
)
cms_options.add_argument('--zinnia', action='store_true', default=False,
- help='''This will include Zinnia (along with Django-CMS)
- and all the needed files and required packages.''',
+ help='''This will include Zinnia (along with
+ Django-CMS) and all the needed files and
+ required packages.''',
dest='zinnia'
)
-# This allows for ease of checking whether
-# either --zinnia or --cms was used
-arguments = parser.parse_args()
+# This allows for ease of checking whether either --zinnia or --cms
+# was used
+arguments = parser.parse_args()
# FIXME Every file in generic_scripts and *-needed should be listed
# here... or we can copy entire directories
@@ -157,6 +165,8 @@
if new_filename not in weird_files:
new_contents = contents % replacement_values
+ # TODO: What happens when we need string interpolations for
+ # weird files? .replace('%', '%%') ?
else:
new_contents = contents
f_write.write(new_contents)
@@ -174,6 +184,12 @@
shutil.copy('extra_settings/zinnia_settings.py',
PROJECT_PATH + 'extra_settings/')
+# TODO: Find a smart way to generalize this or something...
+if not arguments.noswag:
+ shutil.copy('devbox-hooks/prepare-commit-msg',
+ PROJECT_PATH + '.git/hooks/')
+ print "swag"
+
print "Copying directories..."
View
@@ -25,12 +25,12 @@ rm $PROJECT_NAME/bare/hooks/*
(source /usr/local/bin/virtualenvwrapper.sh && cpvirtualenv default $PROJECT_NAME)
# Put our custom hooks in place
-cp hooks/* $PROJECT_NAME/bare/hooks/
+cp server-hooks/* $PROJECT_NAME/bare/hooks/
for file in $PROJECT_NAME/bare/hooks/*; do
sed -i "s/PROJECT_NAME/$PROJECT_NAME/g" $file
done
echo -e "If you're on a server, run\n\n sudo bash -c \"./apachebuilder.sh $PROJECT_NAME\"\n\nto create and install an Apache config file, as well as set up sites-enabled and sites-available."
echo
-echo -e "On your local dev machine, run\n\n python djangobuilder.py $PROJECT_NAME\n\nthen push to (the probably remote) $PROJECT_NAME/bare/ directory"
+echo -e "On your local dev machine, run something like\n\n python djangobuilder.py --path path/to/$PROJECT_NAME\n\nthen push to (the probably remote) $PROJECT_NAME/bare/ directory"
#echo "Run proto-new-virtualhost-subdomain.py to manually create a new Apache config file."
File renamed without changes.

0 comments on commit 3d117b1

Please sign in to comment.