nixos-config/pkgs/lektor-with-plugins/lektor-shell/lektor_shell.py
2019-10-24 02:24:33 +02:00

37 lines
999 B
Python

# -*- coding: utf-8 -*-
from lektor.pluginsystem import Plugin
from lektor.publisher import Publisher, _patch_git_env
import subprocess
class ShellPlugin(Plugin):
name = 'shell'
description = u'Add your description here.'
def on_setup_env(self, **extra):
try:
self.env.add_publisher('shell', ShellPublisher)
except AttributeError:
from lektor.publisher import publishers
publishers['shell'] = ShellPublisher
class ShellPublisher(Publisher):
def publish(self, target, credentials=None, **extra):
yield "Commiting content directory... "
print("target")
print(target)
#subprocess.run(["git", "add", "content"])
#subprocess.run(["git", "commit", "-m", "Added from preflight"])
yield "Pulling and merging from GitHub ..."
#subprocess.run(["git", "pull"])
yield "Pushing to GitHub ..."
#subprocess.run(["git", "push"])
yield "Done"
return