cleaned up names, and modified to generate 'all' scripts

modified:   modules/django.py
This commit is contained in:
Ronny Abraham 2016-09-06 16:57:36 +03:00
parent 5900124cd9
commit e80760ba37

View file

@ -12,9 +12,6 @@ from utils import generate_template_files_path
import os import os
SCRIPT_LIST = ['settings', 'local', 'wsgi', 'gunicorn']
def generate_secret_key(): def generate_secret_key():
""" """
helper to generate django secret key helper to generate django secret key
@ -357,19 +354,22 @@ def generate_scripts(template_name, make_copy=False):
@task @task
def generate(script, make_copy=False): def generate(param=None, make_copy=False):
SCRIPT_LIST = ['settings', 'local', 'wsgi']
PARAM_LIST = SCRIPT_LIST + list('gunicorn')
make_copy = booleanize(make_copy) make_copy = booleanize(make_copy)
if script not in SCRIPT_LIST: if param and param not in PARAM_LIST:
err_msg = "You asked to generate a script that isn't available" \ err_msg = "You asked to generate a script that isn't available" \
"possible script values available: %s" % SCRIPT_LIST "possible script values available: %s" % SCRIPT_LIST
import sys import sys
sys.exit(err_msg) sys.exit(err_msg)
print "django:generate make_copy : %s\n" % make_copy print "django:generate make_copy : %s\n" % make_copy
if env.debug: if env.debug:
print "django:generate script : %s" % script print "django:generate script : %s" % param
print "django:generate make_copy : %s\n" % make_copy print "django:generate make_copy : %s\n" % make_copy
else: else:
pass pass
@ -378,10 +378,16 @@ def generate(script, make_copy=False):
# those fucntion env.debug will be used to decide if anything should # those fucntion env.debug will be used to decide if anything should
# happen or not # happen or not
if script == 'gunicorn': if not param:
# this is where script=None, generate all scripts
for scriptkey in SCRIPT_LIST:
generate_scripts(scriptkey, make_copy)
elif param == 'gunicorn':
generate_gunicorn(make_link=make_copy) generate_gunicorn(make_link=make_copy)
else: else:
generate_scripts(script, make_copy) generate_scripts(param, make_copy)
def generate_gunicorn(make_link=True): def generate_gunicorn(make_link=True):