MAKEFILE!
This commit is contained in:
parent
c5ebf28dc0
commit
eef87be7a8
8 changed files with 69 additions and 94 deletions
53
Makefile
Normal file
53
Makefile
Normal file
|
@ -0,0 +1,53 @@
|
|||
ENV=env/bin
|
||||
NODE_BIN=node_modules/.bin
|
||||
PELICAN=$(ENV)/pelican
|
||||
|
||||
BASEDIR=$(PWD)
|
||||
OUTPUTDIR=$(BASEDIR)/output
|
||||
|
||||
FLAKE8_IGNORE=--ignore=E128,E501,E401,E402
|
||||
|
||||
build: install
|
||||
@echo ">> Building static data..."
|
||||
mkdir -p theme/static/build/js/lib theme/static/build/fonts theme/static/build/css
|
||||
cp -R node_modules/font-awesome/fonts theme/static/build/
|
||||
npm run build-js
|
||||
npm run build-scss
|
||||
@echo ">> Building pelican..."
|
||||
$(PELICAN) -o $(OUTPUTDIR) -v
|
||||
|
||||
clean:
|
||||
rm -rf $(OUTPUTDIR)/*
|
||||
rm -rf $(BASEDIR)/env/
|
||||
rm -rf $(BASEDIR)/node_modules/
|
||||
rm -rf $(BASEDIR)/pelican_plugins/
|
||||
|
||||
|
||||
install: env node_modules pelican_plugins
|
||||
|
||||
pelican_plugins:
|
||||
git clone --recursive https://github.com/getpelican/pelican-plugins --depth=1 pelican_plugins/
|
||||
@echo ">> Hotfixing..."
|
||||
rm -rf pelican_plugins/pelican-jinja2content
|
||||
git clone https://github.com/RealOrangeOne/pelican-jinja2content -b patch-1 --depth=1 pelican_plugins/pelican-jinja2content
|
||||
|
||||
env:
|
||||
pyvenv env
|
||||
$(ENV)/pip install -r requirements.txt
|
||||
|
||||
node_modules:
|
||||
@source ~/.nvm/nvm.sh && nvm install
|
||||
npm install
|
||||
|
||||
|
||||
test: lint
|
||||
|
||||
lint:
|
||||
$(NODE_BIN)/eslint 'theme/static/src/js/'
|
||||
$(NODE_BIN)/sass-lint -vqc .sass-lint.yml
|
||||
$(ENV)/flake8 $(BASEDIR)/plugins/ $(FLAKE8_IGNORE)
|
||||
$(ENV)/flake8 $(BASEDIR)/scripts/ $(FLAKE8_IGNORE)
|
||||
$(ENV)/flake8 $(BASEDIR)/pelicanconf.py $(FLAKE8_IGNORE)
|
||||
|
||||
|
||||
.PHONY: build clean test lint install
|
11
README.md
11
README.md
|
@ -1,3 +1,14 @@
|
|||
# My Website
|
||||
|
||||
[![Circle CI](https://circleci.com/gh/RealOrangeOne/theorangeone.net.svg?style=svg)](https://circleci.com/gh/RealOrangeOne/theorangeone.net)
|
||||
|
||||
|
||||
## Installation
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
## Run Tests
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
|
|
27
build
27
build
|
@ -1,27 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z "$NVM_DIR" ]
|
||||
then
|
||||
NVM_DIR="$HOME/.nvm"
|
||||
fi
|
||||
|
||||
. $NVM_DIR/nvm.sh
|
||||
nvm install
|
||||
nvm use
|
||||
|
||||
set -e
|
||||
|
||||
pyvenv env
|
||||
env/bin/pip install -r requirements.txt
|
||||
|
||||
echo ">> Cleaning plugins..."
|
||||
rm -rf pelican_plugins
|
||||
|
||||
echo ">> Installing Plugins"
|
||||
git clone --recursive https://github.com/getpelican/pelican-plugins --depth=1 pelican_plugins/
|
||||
|
||||
echo ">> Hot fixing..."
|
||||
rm -rf pelican_plugins/pelican-jinja2content
|
||||
git clone https://github.com/RealOrangeOne/pelican-jinja2content -b patch-1 --depth=1 pelican_plugins/pelican-jinja2content
|
||||
|
||||
npm install
|
|
@ -8,12 +8,12 @@ machine:
|
|||
|
||||
dependencies:
|
||||
pre:
|
||||
- ./build
|
||||
- make
|
||||
cache_directories:
|
||||
- env
|
||||
- node_modules
|
||||
- plugins
|
||||
- pelican_plugins
|
||||
|
||||
test:
|
||||
override:
|
||||
- ./runtests
|
||||
- make test
|
||||
|
|
|
@ -3,15 +3,8 @@
|
|||
"version": "4.0.0",
|
||||
"description": " Source code for TheOrangeOne.net",
|
||||
"scripts": {
|
||||
"lint-js": "eslint 'theme/static/src/js/'",
|
||||
"lint-scss": "sass-lint -vqc .sass-lint.yml",
|
||||
"build": "npm run create-build-dirs && npm run build-fonts && npm run build-js && npm run build-scss",
|
||||
"build-js": "./scripts/build-js.sh",
|
||||
"build-scss": "./scripts/build-scss.sh",
|
||||
"build-fonts": "cp -R node_modules/font-awesome/fonts theme/static/build/",
|
||||
"create-build-dirs": "mkdir -p theme/static/build/js/lib theme/static/build/fonts theme/static/build/css",
|
||||
"test": "npm run lint-js && npm run lint-scss",
|
||||
"spellcheck": "mdspell --en-gb -ranx \"templates/**/*.*\""
|
||||
"build-scss": "./scripts/build-scss.sh"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
beautifulsoup4==4.4.1
|
||||
colorama==0.3.6
|
||||
flake8==2.5.0
|
||||
fontawesome_markdown==0.2.5
|
||||
gitpython==2.0.3
|
||||
|
|
40
runtests
40
runtests
|
@ -1,40 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import os, sys
|
||||
import subprocess
|
||||
from colorama import Fore, init
|
||||
|
||||
|
||||
init(autoreset=True)
|
||||
|
||||
|
||||
bin_dir = os.path.abspath(os.path.join(sys.executable, os.path.pardir))
|
||||
EXIT_CODE = 0
|
||||
|
||||
|
||||
def check_if_exit_code():
|
||||
if EXIT_CODE != 0:
|
||||
print("\n{}Tests Failed. {}Please check messages above and then re-run the command.".format(Fore.RED, Fore.YELLOW))
|
||||
print("{}Exit Code: {}".format(Fore.RED, EXIT_CODE))
|
||||
exit(1)
|
||||
|
||||
print("{}Linting...".format(Fore.YELLOW))
|
||||
|
||||
|
||||
FLAKE8_IGNORE = '--ignore=E128,E501,E401,E402'
|
||||
try:
|
||||
subprocess.check_output([os.path.join(bin_dir, 'flake8'), 'theme', FLAKE8_IGNORE])
|
||||
subprocess.check_output([os.path.join(bin_dir, 'flake8'), 'scripts', FLAKE8_IGNORE])
|
||||
subprocess.check_output([os.path.join(bin_dir, 'flake8'), 'pelicanconf.py', FLAKE8_IGNORE])
|
||||
subprocess.check_output([os.path.join(bin_dir, 'flake8'), sys.argv[0], FLAKE8_IGNORE]) # Test this file
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(Fore.RED, e.output.decode())
|
||||
EXIT_CODE = 1
|
||||
|
||||
check_if_exit_code()
|
||||
print("{}All Python tests passed! {}Testing Static Files...".format(Fore.GREEN, Fore.YELLOW))
|
||||
|
||||
|
||||
EXIT_CODE = os.system('npm test')
|
||||
check_if_exit_code()
|
||||
|
||||
print("{}All Tests Passed!".format(Fore.GREEN))
|
|
@ -1,14 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "> Creating Site..."
|
||||
|
||||
# Build the static data
|
||||
echo ">> Building static data..."
|
||||
npm run build
|
||||
|
||||
echo ">> Compiling site pages..."
|
||||
pelican -v
|
||||
|
||||
echo "> Build complete."
|
Reference in a new issue