<commit_before># only random once obviously ;)
python=venv/bin/python
pip=venv/bin/pip
pycodestyle=venv/bin/pycodestyle
pyresttest=venv/bin/pyresttest
mypy=venv/bin/mypy
manage=$(python) $(CURDIR)/manage.py

.PHONY: lint
lint:
	$(pycodestyle) $(CURDIR)/nextcloudappstore --exclude=migrations
	$(mypy) --silent-imports --disallow-untyped-defs $(CURDIR)/nextcloudappstore/core/api/v1/release
	$(mypy) --silent-imports --disallow-untyped-defs $(CURDIR)/nextcloudappstore/core/certificate

.PHONY: test
test: lint
	$(manage) test --settings nextcloudappstore.settings.development

.PHONY: resetup
resetup:
	rm -f db.sqlite3
	$(manage) migrate --settings nextcloudappstore.settings.development
	@echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', '<EMAIL>', 'admin')" | $(manage) shell --settings nextcloudappstore.settings.development
	@echo "from django.contrib.auth.models import User; from allauth.account.models import EmailAddress; EmailAddress.objects.create(user=User.objects.get(username='admin'), email='<EMAIL>', verified=True, primary=True)" | $(manage) shell --settings nextcloudappstore.settings.development
	$(manage) loaddata $(CURDIR)/nextcloudappstore/**/fixtures/*.json --settings nextcloudappstore.settings.development

.PHONY: initmigrations
initmigrations:
	rm -f $(CURDIR)/nextcloudappstore/**/migrations/0*.py
	$(manage) makemigrations --settings nextcloudappstore.settings.development

# Only for local setup, do not use in production
.PHONY: dev-setup
dev-setup:
	pyvenv venv
	$(pip) install -r $(CURDIR)/requirements/development.txt
	$(pip) install -r $(CURDIR)/requirements/base.txt
	@echo "from nextcloudappstore.settings.base import *" > $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "DEBUG = True" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "SECRET_KEY = 'secret'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "RECAPTCHA_PUBLIC_KEY = '<RECAPTCHA_PUBLIC_KEY>'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "RECAPTCHA_PRIVATE_KEY = '<RECAPTCHA_PRIVATE_KEY>'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "EMAIL_HOST = 'localhost'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "DEFAULT_FROM_EMAIL = 'Appstore <<EMAIL>>'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "INSTALLED_APPS.append('debug_toolbar')" >> $(CURDIR)/nextcloudappstore/settings/development.py
	$(manage) migrate --settings nextcloudappstore.settings.development
	$(manage) loaddata $(CURDIR)/nextcloudappstore/**/fixtures/*.json --settings nextcloudappstore.settings.development
	@echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', '<EMAIL>', 'admin')" | $(manage) shell --settings nextcloudappstore.settings.development
	@echo "from django.contrib.auth.models import User; from allauth.account.models import EmailAddress; EmailAddress.objects.create(user=User.objects.get(username='admin'), email='<EMAIL>', verified=True, primary=True)" | $(manage) shell --settings nextcloudappstore.settings.development

.PHONY: docs
docs:
	@echo "hi"
	$(MAKE) -C $(CURDIR)/docs/ html<commit_msg>append middleware for debug toolbar<commit_after># only random once obviously ;)
python=venv/bin/python
pip=venv/bin/pip
pycodestyle=venv/bin/pycodestyle
pyresttest=venv/bin/pyresttest
mypy=venv/bin/mypy
manage=$(python) $(CURDIR)/manage.py

.PHONY: lint
lint:
	$(pycodestyle) $(CURDIR)/nextcloudappstore --exclude=migrations
	$(mypy) --silent-imports --disallow-untyped-defs $(CURDIR)/nextcloudappstore/core/api/v1/release
	$(mypy) --silent-imports --disallow-untyped-defs $(CURDIR)/nextcloudappstore/core/certificate

.PHONY: test
test: lint
	$(manage) test --settings nextcloudappstore.settings.development

.PHONY: resetup
resetup:
	rm -f db.sqlite3
	$(manage) migrate --settings nextcloudappstore.settings.development
	@echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', '<EMAIL>', 'admin')" | $(manage) shell --settings nextcloudappstore.settings.development
	@echo "from django.contrib.auth.models import User; from allauth.account.models import EmailAddress; EmailAddress.objects.create(user=User.objects.get(username='admin'), email='<EMAIL>', verified=True, primary=True)" | $(manage) shell --settings nextcloudappstore.settings.development
	$(manage) loaddata $(CURDIR)/nextcloudappstore/**/fixtures/*.json --settings nextcloudappstore.settings.development

.PHONY: initmigrations
initmigrations:
	rm -f $(CURDIR)/nextcloudappstore/**/migrations/0*.py
	$(manage) makemigrations --settings nextcloudappstore.settings.development

# Only for local setup, do not use in production
.PHONY: dev-setup
dev-setup:
	pyvenv venv
	$(pip) install -r $(CURDIR)/requirements/development.txt
	$(pip) install -r $(CURDIR)/requirements/base.txt
	@echo "from nextcloudappstore.settings.base import *" > $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "DEBUG = True" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "SECRET_KEY = 'secret'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "RECAPTCHA_PUBLIC_KEY = '<RECAPTCHA_PUBLIC_KEY>'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "RECAPTCHA_PRIVATE_KEY = '<RECAPTCHA_PRIVATE_KEY>'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "EMAIL_HOST = 'localhost'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "DEFAULT_FROM_EMAIL = 'Appstore <<EMAIL>>'" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "INSTALLED_APPS.append('debug_toolbar')" >> $(CURDIR)/nextcloudappstore/settings/development.py
	@echo "MIDDLEWARE_CLASSES.append('debug_toolbar.middleware.DebugToolbarMiddleware')" >> $(CURDIR)/nextcloudappstore/settings/development.py
	$(manage) migrate --settings nextcloudappstore.settings.development
	$(manage) loaddata $(CURDIR)/nextcloudappstore/**/fixtures/*.json --settings nextcloudappstore.settings.development
	@echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', '<EMAIL>', 'admin')" | $(manage) shell --settings nextcloudappstore.settings.development
	@echo "from django.contrib.auth.models import User; from allauth.account.models import EmailAddress; EmailAddress.objects.create(user=User.objects.get(username='admin'), email='<EMAIL>', verified=True, primary=True)" | $(manage) shell --settings nextcloudappstore.settings.development

.PHONY: docs
docs:
	@echo "hi"
	$(MAKE) -C $(CURDIR)/docs/ html
{'fraction_non_alphanumeric': 0.14874473951530984, 'fraction_numerical': 0.0008707009142359599, 'mean_word_length': 6.581958195819582, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5113939', 'n_tokens_mistral': 2301, 'n_tokens_neox': 2202, 'n_words': 398}