2016-08-13 20:08:43 +01:00
|
|
|
BASEDIR=$(PWD)
|
|
|
|
ENV=$(BASEDIR)/env/bin
|
2016-06-05 19:47:14 +01:00
|
|
|
NODE_BIN=node_modules/.bin
|
2016-08-13 20:08:43 +01:00
|
|
|
PELICAN=$(ENV)/pelican
|
2016-06-05 19:47:14 +01:00
|
|
|
|
|
|
|
OUTPUTDIR=$(BASEDIR)/output
|
2016-06-25 18:10:58 +01:00
|
|
|
PLUGINS_DIR=$(BASEDIR)/pelican_plugins
|
2016-08-13 20:08:43 +01:00
|
|
|
DEPLOY_DIR=$(BASEDIR)/deploy
|
2016-09-08 21:24:39 +01:00
|
|
|
CONFIG_FILE=$(BASEDIR)/config/pelicanconf.py
|
2016-06-12 22:04:30 +01:00
|
|
|
|
2016-06-05 19:47:14 +01:00
|
|
|
FLAKE8_IGNORE=--ignore=E128,E501,E401,E402
|
|
|
|
|
|
|
|
build: install
|
2016-06-07 18:39:17 +01:00
|
|
|
rm -rf $(OUTPUTDIR)/*
|
2016-06-05 19:47:14 +01:00
|
|
|
@echo ">> Building static data..."
|
2016-08-26 11:49:13 +01:00
|
|
|
mkdir -p theme/static/build/js/lib theme/static/build/fonts theme/static/build/css theme/static/build/img
|
2016-06-05 19:47:14 +01:00
|
|
|
cp -R node_modules/font-awesome/fonts theme/static/build/
|
|
|
|
npm run build-js
|
|
|
|
npm run build-scss
|
|
|
|
@echo ">> Building pelican..."
|
2016-09-08 21:24:39 +01:00
|
|
|
$(PELICAN) -o $(OUTPUTDIR) -vs $(CONFIG_FILE)
|
2016-06-13 09:04:21 +01:00
|
|
|
mv $(OUTPUTDIR)/assets/robots.txt $(OUTPUTDIR)
|
2016-06-11 12:53:23 +01:00
|
|
|
cp -R $(OUTPUTDIR)/assets/* $(OUTPUTDIR)/static
|
|
|
|
rm -rf $(OUTPUTDIR)/assets
|
2016-06-05 19:47:14 +01:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(OUTPUTDIR)/*
|
|
|
|
rm -rf $(BASEDIR)/env/
|
|
|
|
rm -rf $(BASEDIR)/node_modules/
|
2016-06-25 18:10:58 +01:00
|
|
|
rm -rf $(PLUGINS_DIR)/*
|
2016-06-05 19:47:14 +01:00
|
|
|
|
|
|
|
|
2016-08-16 21:45:40 +01:00
|
|
|
install: env node_modules pelican_plugins
|
2016-06-05 19:47:14 +01:00
|
|
|
|
2016-08-16 21:45:40 +01:00
|
|
|
pelican_plugins: env
|
2016-06-25 18:10:58 +01:00
|
|
|
rm -rf $(PLUGINS_DIR) || "No existing extensions"
|
2016-06-29 22:36:40 +01:00
|
|
|
git clone --recursive https://github.com/getpelican/pelican-plugins $(PLUGINS_DIR) || "Git Fail"
|
2016-08-28 15:49:00 +01:00
|
|
|
@echo ">> Hotfixing..."
|
|
|
|
rm -rf $(PLUGINS_DIR)/pelican-jinja2content
|
|
|
|
git clone https://github.com/RealOrangeOne/pelican-jinja2content -b patch-1 --depth=1 $(PLUGINS_DIR)/pelican-jinja2content
|
2016-06-05 19:47:14 +01:00
|
|
|
|
|
|
|
env:
|
|
|
|
pyvenv env
|
2016-08-13 20:08:43 +01:00
|
|
|
$(ENV)/pip install -r requirements.txt
|
2016-06-05 19:47:14 +01:00
|
|
|
|
2016-08-06 20:31:04 +01:00
|
|
|
node_modules:
|
2016-06-05 19:47:14 +01:00
|
|
|
npm install
|
|
|
|
|
|
|
|
|
2016-10-02 12:42:39 +01:00
|
|
|
test: unittest lint spellcheck securitycheck
|
2016-06-05 19:47:14 +01:00
|
|
|
|
2016-09-11 21:45:32 +01:00
|
|
|
unittest:
|
2016-09-11 21:26:30 +01:00
|
|
|
$(ENV)/nose2 --verbose
|
2016-09-11 21:45:32 +01:00
|
|
|
|
|
|
|
lint:
|
2016-06-05 19:47:14 +01:00
|
|
|
$(NODE_BIN)/eslint 'theme/static/src/js/'
|
|
|
|
$(NODE_BIN)/sass-lint -vqc .sass-lint.yml
|
2016-08-13 20:08:43 +01:00
|
|
|
$(ENV)/flake8 $(BASEDIR)/plugins/ $(FLAKE8_IGNORE)
|
|
|
|
$(ENV)/flake8 $(BASEDIR)/scripts/ $(FLAKE8_IGNORE)
|
2016-09-08 22:22:50 +01:00
|
|
|
$(ENV)/flake8 $(BASEDIR)/config/ $(FLAKE8_IGNORE)
|
2016-09-11 21:26:30 +01:00
|
|
|
$(ENV)/flake8 $(BASEDIR)/tests/ $(FLAKE8_IGNORE)
|
2016-10-02 12:45:38 +01:00
|
|
|
$(ENV)/yamllint config/config.yml
|
2016-06-05 19:47:14 +01:00
|
|
|
|
2016-07-29 12:00:28 +01:00
|
|
|
spellcheck:
|
2016-07-29 13:57:02 +01:00
|
|
|
$(NODE_BIN)/mdspell --en-gb -ranx theme/templates/**/*.* theme/templates/*.*
|
2016-08-28 10:38:14 +01:00
|
|
|
$(NODE_BIN)/mdspell --en-gb -ranx content/**/*.md content/*.md content/**/*.html content/*.html
|
2016-07-29 12:00:28 +01:00
|
|
|
|
2016-10-02 12:42:39 +01:00
|
|
|
securitycheck:
|
|
|
|
$(NODE_BIN)/nsp check
|
|
|
|
$(ENV)/bandit -r plugins/ config/ tests/
|
|
|
|
|
2016-06-05 19:47:14 +01:00
|
|
|
|
2016-09-11 21:45:32 +01:00
|
|
|
upload:
|
2016-08-13 20:08:43 +01:00
|
|
|
git clone https://github.com/RealOrangeOne/host-container.git $(DEPLOY_DIR)
|
2016-08-24 10:31:04 +01:00
|
|
|
cp -rf $(OUTPUTDIR)/. $(DEPLOY_DIR)/site/
|
2016-08-16 22:00:44 +01:00
|
|
|
@cd $(DEPLOY_DIR) && git remote add dokku $(DEPLOY_URL) && git add . && git commit -m "add files" && git push -f dokku master --quiet
|
2016-08-13 20:08:43 +01:00
|
|
|
rm -rf $(DEPLOY_DIR)
|
2016-06-12 22:04:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
.PHONY: build clean test lint install upload
|