<commit_before>venv_bin=venv/bin/
python=$(venv_bin)python
pip=$(venv_bin)pip3
pycodestyle=$(venv_bin)pycodestyle
pyresttest=$(venv_bin)pyresttest
coverage=$(venv_bin)coverage
bandit=$(venv_bin)bandit
mypy=$(venv_bin)mypy
manage-script=$(CURDIR)/manage.py
manage=$(python) $(manage-script)
db=sqlite
pyvenv=python3 -m venv
yarn=yarn
prod_version=12.0.0

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

.PHONY: test
test: lint
	$(yarn) test
	$(coverage) run --source=nextcloudappstore $(manage-script) test --settings nextcloudappstore.settings.development
	$(coverage) report --fail-under 90

.PHONY: resetup
resetup:
	rm -f db.sqlite3
	$(MAKE) initdb

.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:
	$(yarn) install
	$(yarn) run build
	$(pyvenv) venv
	$(pip) install --upgrade pip
	$(pip) install -r $(CURDIR)/requirements/development.txt
	$(pip) install -r $(CURDIR)/requirements/base.txt
ifeq ($(db), postgres)
	$(pip) install -r $(CURDIR)/requirements/production.txt
endif
	cp $(CURDIR)/scripts/development/settings/base.py $(CURDIR)/nextcloudappstore/settings/development.py
	cat $(CURDIR)/scripts/development/settings/$(db).py >> $(CURDIR)/nextcloudappstore/settings/development.py
	$(MAKE) initdb


.PHONY: initdb
initdb:
	$(manage) migrate --settings nextcloudappstore.settings.development
	$(manage) loaddata $(CURDIR)/nextcloudappstore/**/fixtures/*.json --settings nextcloudappstore.settings.development
	$(manage) createsuperuser --username admin --email <EMAIL> --noinput --settings nextcloudappstore.settings.development
	$(manage) verifyemail --username admin --email <EMAIL> --settings nextcloudappstore.settings.development
	$(manage) setdefaultadminpassword --settings nextcloudappstore.settings.development

.PHONY: docs
docs:
	$(MAKE) -C $(CURDIR)/docs/ clean html

.PHONY: update-dev-deps
update-dev-deps:
	$(pip) install --upgrade -r $(CURDIR)/requirements/development.txt
	$(pip) install --upgrade -r $(CURDIR)/requirements/base.txt
	$(yarn) install --upgrade

.PHONY: authors
authors:
	$(python) $(CURDIR)/scripts/generate_authors.py

.PHONY: clean<commit_msg>also init translations<commit_after>venv_bin=venv/bin/
python=$(venv_bin)python
pip=$(venv_bin)pip3
pycodestyle=$(venv_bin)pycodestyle
pyresttest=$(venv_bin)pyresttest
coverage=$(venv_bin)coverage
bandit=$(venv_bin)bandit
mypy=$(venv_bin)mypy
manage-script=$(CURDIR)/manage.py
manage=$(python) $(manage-script)
db=sqlite
pyvenv=python3 -m venv
yarn=yarn
prod_version=12.0.0

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

.PHONY: test
test: lint
	$(yarn) test
	$(coverage) run --source=nextcloudappstore $(manage-script) test --settings nextcloudappstore.settings.development
	$(coverage) report --fail-under 90

.PHONY: resetup
resetup:
	rm -f db.sqlite3
	$(MAKE) initdb

.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:
	$(yarn) install
	$(yarn) run build
	$(pyvenv) venv
	$(pip) install --upgrade pip
	$(pip) install -r $(CURDIR)/requirements/development.txt
	$(pip) install -r $(CURDIR)/requirements/base.txt
ifeq ($(db), postgres)
	$(pip) install -r $(CURDIR)/requirements/production.txt
endif
	cp $(CURDIR)/scripts/development/settings/base.py $(CURDIR)/nextcloudappstore/settings/development.py
	cat $(CURDIR)/scripts/development/settings/$(db).py >> $(CURDIR)/nextcloudappstore/settings/development.py
	$(MAKE) initdb
	$(MAKE) l10n


.PHONY: initdb
initdb:
	$(manage) migrate --settings nextcloudappstore.settings.development
	$(manage) loaddata $(CURDIR)/nextcloudappstore/**/fixtures/*.json --settings nextcloudappstore.settings.development
	$(manage) createsuperuser --username admin --email <EMAIL> --noinput --settings nextcloudappstore.settings.development
	$(manage) verifyemail --username admin --email <EMAIL> --settings nextcloudappstore.settings.development
	$(manage) setdefaultadminpassword --settings nextcloudappstore.settings.development

.PHONY: docs
docs:
	$(MAKE) -C $(CURDIR)/docs/ clean html

.PHONY: update-dev-deps
update-dev-deps:
	$(pip) install --upgrade -r $(CURDIR)/requirements/development.txt
	$(pip) install --upgrade -r $(CURDIR)/requirements/base.txt
	$(yarn) install --upgrade

.PHONY: authors
authors:
	$(python) $(CURDIR)/scripts/generate_authors.py

.PHONY: clean
{'fraction_non_alphanumeric': 0.1522538208550977, 'fraction_numerical': 0.0046430644225188625, 'mean_word_length': 5.611253196930947, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '3444786', 'n_tokens_mistral': 1898, 'n_tokens_neox': 1790, 'n_words': 367}