mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-12-23 23:23:06 +11:00
More cleanup and more helper
This commit is contained in:
parent
5b01abbf82
commit
d8e3d62f29
4 changed files with 23 additions and 24 deletions
|
@ -2,7 +2,6 @@ include README.rst
|
|||
include LICENSE
|
||||
include CHANGELOG.rst
|
||||
include runtests.py
|
||||
include tox.ini
|
||||
exclude dpaste/settings/local.py
|
||||
recursive-include dpaste/templates *
|
||||
recursive-include dpaste/static *
|
||||
|
|
40
Makefile
40
Makefile
|
@ -10,23 +10,24 @@ define N # newline
|
|||
|
||||
endef
|
||||
|
||||
# The Djangos ------------------------------------------------------------------
|
||||
|
||||
.PHONY: start
|
||||
start: ## Start the webserver and migrate db if necessary
|
||||
docker-compose run --rm app ./manage.py migrate
|
||||
docker-compose up
|
||||
|
||||
.PHONY: test
|
||||
test: ## Run Django tests
|
||||
docker-compose run --rm app pytest dpaste/
|
||||
|
||||
.PHONY: code-cleanup
|
||||
code-cleanup: ## Black and isort the Python codebase
|
||||
autoflake --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables \
|
||||
--exclude "**/migrations/*,dpaste/settings/local.py" -r dpaste
|
||||
isort -rc dpaste
|
||||
black --line-length=80 --exclude='/(migrations)/' dpaste
|
||||
|
||||
# The Frontendos (run inside of a docker container) ----------------------------
|
||||
.PHONY: docs
|
||||
docs: ## Compile the documentation
|
||||
docker-compose run --rm app sphinx-build docs docs/_build/html
|
||||
|
||||
.PHONY: watch-docs
|
||||
docs-watch: ## Compile the documentation and watch for changes
|
||||
docker-compose run --rm app sphinx-autobuild docs docs/_build/html
|
||||
|
||||
.PHONY: css
|
||||
css: ## Compile SCSS files
|
||||
|
@ -34,22 +35,12 @@ css: ## Compile SCSS files
|
|||
|
||||
.PHONY: css-watch
|
||||
css-watch: ## Compile JS files
|
||||
npx sassz --watch client/scss/dpaste.scss:build/dpaste.css
|
||||
npx sass --watch client/scss/dpaste.scss:build/dpaste.css
|
||||
|
||||
.PHONY: js
|
||||
js: ## Compile JS files
|
||||
npx uglifyjs --compress="drop_console=true,ecma=6" --mangle="toplevel" --output=dpaste/static/dpaste.js client/js/dpaste.js
|
||||
|
||||
# Helper -----------------------------------------------------------------------
|
||||
|
||||
.PHONY: docs
|
||||
docs: ## Compile the documentation
|
||||
sphinx-build docs docs/_build/html
|
||||
|
||||
.PHONY: watch-docs
|
||||
docs-watch: ## Compile the documentation and watch for changes
|
||||
sphinx-autobuild docs docs/_build/html
|
||||
|
||||
.PHONY: release-docker
|
||||
release-docker:
|
||||
set -ex
|
||||
|
@ -57,6 +48,17 @@ release-docker:
|
|||
docker build --build-arg BUILD_EXTRAS=production -t barttc/dpaste:latest .
|
||||
@echo -e "\n\n💫 All fine. Now do: docker push barttc/dpaste:latest"
|
||||
|
||||
.PHONY: release-pypi
|
||||
release-pypi:
|
||||
set -ex
|
||||
docker-compose run --rm app pytest dpaste/
|
||||
rm -rf ./node_modules
|
||||
npm ci
|
||||
make css
|
||||
make js
|
||||
python setup.py sdist && python setup.py bdist_wheel --universal
|
||||
@echo -e "\n\n💫 All fine. Now do: twine upload dist/* --sign"
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo -e "Available make commands:"
|
||||
|
|
|
@ -101,7 +101,7 @@ DATABASES = {
|
|||
# If this project installation was built with production settings,
|
||||
# add that webserver right away.
|
||||
try:
|
||||
import django_webserver
|
||||
import django_webserver # noqa
|
||||
|
||||
INSTALLED_APPS.append("django_webserver")
|
||||
sys.stdout.write(
|
||||
|
|
|
@ -204,9 +204,7 @@ class SnippetRawView(SnippetDetailView):
|
|||
def render_to_response(self, context, **response_kwargs):
|
||||
if config.RAW_MODE_PLAIN_TEXT:
|
||||
return self.render_plain_text(config, **response_kwargs)
|
||||
return super().render_to_response(
|
||||
context, **response_kwargs
|
||||
)
|
||||
return super().render_to_response(context, **response_kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super().get_context_data(**kwargs)
|
||||
|
|
Loading…
Reference in a new issue