Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme update #91

Merged
merged 3 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.pyc
*.log
output
tests/.cache/
tests/.cache/
.venv
.direnv
5 changes: 2 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,13 @@ attila and start a new theme.

Did you liked this theme? Pay my bills and support new features.

https://gratipay.com/~arulrajnet/[image:https://img.shields.io/gratipay/user/arulrajnet.svg?maxAge=2592000[Gratipay]]

https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XYLX6LG2THL2J[image:https://img.shields.io/badge/paypal-donate-yellow.svg?maxAge=2592000[PayPal]]
https://github.com/sponsors/arulrajnet/[image:https://img.shields.io/github/sponsors/arulrajnet?style=for-the-badge[GitHub Sponsors]]

[[copyright-license]]
== Copyright & License

Copyright (c) 2015-2016 Peter Amende - Released under The MIT License.

Copyright (c) 2016 Arulraj V - Released under The MIT License.

Some background images used from
Expand Down
76 changes: 0 additions & 76 deletions fabfile.py

This file was deleted.

Binary file modified screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 83 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# -*- coding: utf-8 -*-

import os
import shutil
import sys
import datetime

from invoke import task
from invoke.main import program
from invoke.util import cd
from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer

'''
To use this

virtualenv .venv
source .venv/bin/activate
pip3 install invoke pelican ghp-import
invoke build
invoke serve
invoke gh-pages
'''

OPEN_BROWSER_ON_SERVE = False

CONFIG = {
# Output path. Can be absolute or relative to tasks.py. Default: 'output'
'deploy_path': 'output',
# Github Pages configuration
'github_pages_branch': 'gh-pages',
'commit_message': "'Publish site on {}'".format(datetime.date.today().isoformat()),
# Host and port for `serve`
'host': 'localhost',
'port': 8000,
}

@task
def clean(c):
"""Remove generated files"""
if os.path.isdir(CONFIG['deploy_path']):
shutil.rmtree(CONFIG['deploy_path'])
os.makedirs(CONFIG['deploy_path'])

@task
def build(c):
"""Build local version of site"""
c.run('asciidoctor -D {deploy_path} *.adoc'.format(**CONFIG))
c.run('cp *.png {deploy_path}'.format(**CONFIG))
c.run('mv {deploy_path}/README.html {deploy_path}/index.html'.format(**CONFIG))

@task
def serve(c):
"""Serve site at http://$HOST:$PORT/ (default is localhost:8000)"""

class AddressReuseTCPServer(RootedHTTPServer):
allow_reuse_address = True

server = AddressReuseTCPServer(
CONFIG['deploy_path'],
(CONFIG['host'], CONFIG['port']),
ComplexHTTPRequestHandler)

if OPEN_BROWSER_ON_SERVE:
# Open site in default browser
import webbrowser
webbrowser.open("http://{host}:{port}".format(**CONFIG))

sys.stderr.write('Serving at {host}:{port} ...\n'.format(**CONFIG))
server.serve_forever()

@task
def reserve(c):
"""`build`, then `serve`"""
build(c)
serve(c)

@task
def gh_pages(c):
"""Publish to GitHub Pages"""
build(c)
c.run('ghp-import -b {github_pages_branch} '
'-m "{commit_message}" '
'{deploy_path} -p'.format(**CONFIG))