1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
theorangeone.net-legacy/plugins/post_build.py

26 lines
744 B
Python
Raw Normal View History

2017-01-10 09:09:30 +00:00
from pelican import signals
import os
2017-01-12 09:00:01 +00:00
from plugins.utils import run_command
2017-01-10 09:09:30 +00:00
OUTPUT_PATH = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'output')
def post_build(*args, **kwargs):
2017-01-12 09:00:01 +00:00
run_command('Copying Robots.txt', [
'mv', os.path.join(OUTPUT_PATH, 'assets', 'robots.txt'), OUTPUT_PATH
])
run_command('Copying Assets', [
'cp', '-R', os.path.join(OUTPUT_PATH, 'assets', '*'), os.path.join(OUTPUT_PATH, 'static')
], True)
run_command('Remove Old Assets', [
'rm', '-rf', os.path.join(OUTPUT_PATH, 'assets')
])
2017-01-14 23:56:23 +00:00
run_command('Remove Drafts', [
'rm', '-rf', os.path.join(OUTPUT_PATH, 'drafts')
])
2017-01-10 09:09:30 +00:00
def register():
signals.finalized.connect(post_build)