Skip to main content

Trigger custom commands from filesystem events.

Project description

PatrolTrigger

Trigger custom commands from filesystem events.

Patrol uses libuv, which creates event driven hooks to filesystem events using epoll, kqueue or IOCP.

You can use it to selectively build your project when files change and run tests as soon as you hit the save button.

Use

To install:

sudo pip install patroltrigger

Create a patrol.py file in your project’s root directory:

#!/usr/bin/python
from patroltrigger import runnable, run, trigger

@trigger(["*.py", ], exclude=['venv/*',])
def trigger1(filenames):
    run("echo first command triggered")
    run("false")    # non-zero return code):
    run("echo you won't ever see this command")

@trigger(["*.py", ], exclude=['venv/*',])
def trigger2(filenameS):
    print "second command triggered with filename: {}".format(filenameS)

runnable(__name__)

Run like so:

$ python patrol.py

Features

  • Each method is timed.

  • If a command fails (e.g. a unit test), the entire method is aborted by default at that point to shorten feedback time.

  • Run a custom command after each method is finished (e.g. guake, notify-send).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

patroltrigger-0.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page