-
Notifications
You must be signed in to change notification settings - Fork 18
/
init.sh
executable file
·70 lines (56 loc) · 2.93 KB
/
init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# The variable values here are just examples. Replace them all with real values
# of your own app.
# Your full name, will appear in AUTHORS, LICENSE and setup.py
VAR_FULL_NAME='Your Name'
# Your email address, used in setup.py, shown on pypi.python.org
export VAR_AUTHOR_EMAIL='[email protected]'
# The project name as it would appear as the main headline in the README
# You should google for your app name first and make sure that no one else has
# taken it.
VAR_APP_NAME='Django Reusable App Template'
# The package name, which would be added to INSTALLED_APPS
VAR_PACKAGE_NAME='reusable_app_template'
# Example URL path the app should be loaded at
VAR_URL_HOOK='app-url'
# The package name as defined in setup.py - this is also what you would search
# for on pypi.python.org. You should search pypi.python.org first and make sure
# that your package name is not taken already.
VAR_PYPI_NAME='django-reusable-app-template'
# A short description which will be parsed by pypi.python.org
VAR_DESCRIPTION='A reusable Django app that does nothing much.'
# Path to your repo on Github (without the .git at the end)
VAR_GITHUB_REPO='github.com/mbrochh/django-reusable-app-template'
# Keywords for your app, used in setup.py
VAR_KEYWORDS='django, app, reusable'
# Current year, will be shown in the license file. You can set it to any year
# (i.e. 2001) or just leave this default and compute it automatically
VAR_YEAR=`date +'%Y'`
# ============================================================================
rm -rf .git
rm README.rst
rm AUTHORS
CMD=(find ./template -type f \( ! -iname '*.pyc' ! -iname 'init.sh' \) -print0)
"${CMD[@]}" | xargs -0 perl -pi -e "s#VAR_YEAR#${VAR_YEAR}#g"
"${CMD[@]}" | xargs -0 perl -pi -e "s#VAR_FULL_NAME#${VAR_FULL_NAME}#g"
"${CMD[@]}" | xargs -0 perl -pi -e 's#VAR_AUTHOR_EMAIL#$ENV{VAR_AUTHOR_EMAIL}#g'
"${CMD[@]}" | xargs -0 perl -pi -e "s#VAR_APP_NAME#${VAR_APP_NAME}#g"
"${CMD[@]}" | xargs -0 perl -pi -e "s#VAR_PACKAGE_NAME#${VAR_PACKAGE_NAME}#g"
"${CMD[@]}" | xargs -0 perl -pi -e "s#VAR_PYPI_NAME#${VAR_PYPI_NAME}#g"
"${CMD[@]}" | xargs -0 perl -pi -e "s#VAR_DESCRIPTION#${VAR_DESCRIPTION}#g"
"${CMD[@]}" | xargs -0 perl -pi -e "s#VAR_GITHUB_REPO#${VAR_GITHUB_REPO}#g"
"${CMD[@]}" | xargs -0 perl -pi -e "s#VAR_KEYWORDS#${VAR_KEYWORDS}#g"
"${CMD[@]}" | xargs -0 perl -pi -e "s#VAR_URL_HOOK#${VAR_URL_HOOK}#g"
mv template/VAR_PACKAGE_NAME template/$VAR_PACKAGE_NAME
mv template/$VAR_PACKAGE_NAME/static/VAR_PACKAGE_NAME template/$VAR_PACKAGE_NAME/static/$VAR_PACKAGE_NAME
mv template/$VAR_PACKAGE_NAME/templates/VAR_PACKAGE_NAME template/$VAR_PACKAGE_NAME/templates/$VAR_PACKAGE_NAME
mv template/$VAR_PACKAGE_NAME/templatetags/VAR_PACKAGE_NAME_tags.py template/$VAR_PACKAGE_NAME/templatetags/${VAR_PACKAGE_NAME}_tags.py
rm init.sh
mv template/* .
mv template/.gitignore .
mv template/.travis.yml .
rmdir template
git init
git add .
git commit -am "Initial commit"
echo "All done! Don't forget to fix the first headline in README.rst!"