Skip to content
This repository has been archived by the owner on Jan 28, 2020. It is now read-only.

Commit

Permalink
Made a basic initialization function that creates the project and cop…
Browse files Browse the repository at this point in the history
…ies settings into it.
  • Loading branch information
jcsackett committed Jun 2, 2009
1 parent 455f60c commit 0ee8828
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions weaver.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/python
import sys
import os
import shutil

WEAVER_DIR = os.path.dirname(os.path.abspath(__file__))

def init(args):
target_dir = args[0]
try:
os.mkdir(target_dir)
except OSError:
print 'Cannot start project. A project with that name (%s) appears to already exist.' % target_dir
sys.exit(1)
else:
shutil.copy(
os.path.join(WEAVER_DIR, 'settings.py.tmpl'),
os.path.join(target_dir, 'settings.py')
)

commands = {
'init':init,
}

if __name__ == '__main__':
cmd = sys.argv[1]
args = sys.argv[2:]

commands[cmd](args)

0 comments on commit 0ee8828

Please sign in to comment.