diff --git a/cookiecutter.json b/cookiecutter.json index 28d31fe3..9e75f14b 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -15,6 +15,7 @@ "use_sentry": "n", "use_newrelic": "n", "use_opbeat": "n", + "use_pycharm": "n", "windows": "n", "use_python2": "n", "open_source_license": ["MIT", "BSD", "Not open source"] diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 107d6f98..28f57876 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -3,7 +3,8 @@ Does the following: 1. Generates and saves random secret key 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 @@ -100,6 +101,13 @@ def remove_task_app(project_directory): ) 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 # def copy_doc_files(project_directory): # cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir'] @@ -125,5 +133,9 @@ make_secret_key(PROJECT_DIRECTORY) if '{{ cookiecutter.use_celery }}'.lower() == 'n': 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) diff --git a/{{cookiecutter.repo_name}}/.gitignore b/{{cookiecutter.repo_name}}/.gitignore index 4b288b5b..e1c4d42e 100644 --- a/{{cookiecutter.repo_name}}/.gitignore +++ b/{{cookiecutter.repo_name}}/.gitignore @@ -37,8 +37,10 @@ htmlcov *.mo *.pot +{% if cookiecutter.use_pycharm == 'y' %} # Pycharm .idea +{% endif %} # Vim diff --git a/{{cookiecutter.repo_name}}/.idea/webResources.xml b/{{cookiecutter.repo_name}}/.idea/webResources.xml new file mode 100644 index 00000000..e0fc860f --- /dev/null +++ b/{{cookiecutter.repo_name}}/.idea/webResources.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + +