use_pycharm variable, post_gen_project hook, {{ cookiecutter.repo_name }}/static marked as webResources

This commit is contained in:
Krzysztof Szumny 2016-03-23 18:51:25 +01:00
parent 572de69658
commit da6ba57f05
4 changed files with 31 additions and 2 deletions

View File

@ -15,6 +15,7 @@
"use_sentry": "n", "use_sentry": "n",
"use_newrelic": "n", "use_newrelic": "n",
"use_opbeat": "n", "use_opbeat": "n",
"use_pycharm": "n",
"windows": "n", "windows": "n",
"use_python2": "n", "use_python2": "n",
"open_source_license": ["MIT", "BSD", "Not open source"] "open_source_license": ["MIT", "BSD", "Not open source"]

View File

@ -3,7 +3,8 @@ Does the following:
1. Generates and saves random secret key 1. Generates and saves random secret key
2. Removes the taskapp if celery isn't going to be used 2. Removes the taskapp if celery isn't going to be used
3. Copy files from /docs/ to {{ cookiecutter.repo_name }}/docs/ 3. Removes the .idea directory if PyCharm isn't going to be used
4. Copy files from /docs/ to {{ cookiecutter.repo_name }}/docs/
TODO: this might have to be moved to a pre_gen_hook TODO: this might have to be moved to a pre_gen_hook
@ -100,6 +101,13 @@ def remove_task_app(project_directory):
) )
shutil.rmtree(task_app_location) shutil.rmtree(task_app_location)
def remove_pycharm_dir(project_directory):
"""Removes the .idea directory if PyCharm isn't going to be used"""
idea_dir_location = os.path.join(PROJECT_DIRECTORY, '.idea/')
shutil.rmtree(idea_dir_location)
# IN PROGRESS # IN PROGRESS
# def copy_doc_files(project_directory): # def copy_doc_files(project_directory):
# cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir'] # cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir']
@ -125,5 +133,9 @@ make_secret_key(PROJECT_DIRECTORY)
if '{{ cookiecutter.use_celery }}'.lower() == 'n': if '{{ cookiecutter.use_celery }}'.lower() == 'n':
remove_task_app(PROJECT_DIRECTORY) remove_task_app(PROJECT_DIRECTORY)
# 3. Copy files from /docs/ to {{ cookiecutter.repo_name }}/docs/ # 3. Removes the .idea directory if PyCharm isn't going to be used
if '{{ cookiecutter.use_pycharm }}'.lower() != 'y':
remove_pycharm_dir(PROJECT_DIRECTORY)
# 4. Copy files from /docs/ to {{ cookiecutter.repo_name }}/docs/
# copy_doc_files(PROJECT_DIRECTORY) # copy_doc_files(PROJECT_DIRECTORY)

View File

@ -37,8 +37,10 @@ htmlcov
*.mo *.mo
*.pot *.pot
{% if cookiecutter.use_pycharm == 'y' %}
# Pycharm # Pycharm
.idea .idea
{% endif %}
# Vim # Vim

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WebResourcesPaths">
<contentEntries>
<entry url="file://$PROJECT_DIR$">
<entryData>
<resourceRoots>
<path value="file://$PROJECT_DIR$/{{ cookiecutter.repo_name }}/static" />
</resourceRoots>
</entryData>
</entry>
</contentEntries>
</component>
</project>