From da6ba57f053e1bc837dbfe46beaf63a7f194c6e6 Mon Sep 17 00:00:00 2001 From: Krzysztof Szumny Date: Wed, 23 Mar 2016 18:51:25 +0100 Subject: [PATCH 01/13] use_pycharm variable, post_gen_project hook, {{ cookiecutter.repo_name }}/static marked as webResources --- cookiecutter.json | 1 + hooks/post_gen_project.py | 16 ++++++++++++++-- {{cookiecutter.repo_name}}/.gitignore | 2 ++ .../.idea/webResources.xml | 14 ++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 {{cookiecutter.repo_name}}/.idea/webResources.xml 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 @@ + + + + + + + + + + + + + + From 58373e44f9623c605252983c3e5a95b14411d64f Mon Sep 17 00:00:00 2001 From: Krzysztof Szumny Date: Wed, 23 Mar 2016 19:21:43 +0100 Subject: [PATCH 02/13] Django Support Enabled by default (Settings > Language & Frameworks > Django --- .../.idea/{{cookiecutter.repo_name}}.iml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 {{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml diff --git a/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml b/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml new file mode 100644 index 00000000..9b704c56 --- /dev/null +++ b/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml @@ -0,0 +1,13 @@ + + + + + + + + + From 60593a2cbb1242a7bc1e40c73d06bb726a858220 Mon Sep 17 00:00:00 2001 From: Krzysztof Szumny Date: Wed, 23 Mar 2016 19:30:39 +0100 Subject: [PATCH 03/13] Default Python Template Language set to Django instead of Jinja2 Settings > Languages & Frameworks > Python Template Language --- .../.idea/{{cookiecutter.repo_name}}.iml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml b/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml index 9b704c56..c715debb 100644 --- a/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml +++ b/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml @@ -10,4 +10,12 @@ + + + From 66e8dc1de77547f8bb0537c6a4c14cc6fabb68a4 Mon Sep 17 00:00:00 2001 From: Krzysztof Szumny Date: Wed, 23 Mar 2016 20:14:56 +0100 Subject: [PATCH 04/13] node_modules marked as excluded directory --- .idea/vcs.xml | 6 ++++++ .../.idea/{{cookiecutter.repo_name}}.iml | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml b/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml index c715debb..216ce561 100644 --- a/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml +++ b/{{cookiecutter.repo_name}}/.idea/{{cookiecutter.repo_name}}.iml @@ -10,6 +10,11 @@ + + + + + + +