This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

capn is a package that provides hooks when the current-working-directory changes.

### Installation

$ sudo pip install capn
$ touch ~/.capnhooks

### Configuration

capn uses a simple YAML file for specifying paths and their hooks. As a quick example, consider the following:

default_type: path
- ~/.otherhooks
- path: /home
type: tree
- echo entering /home
- echo exiting /home
- echo /home waves goodbye

- path: ~/
- echo entering ~/
- echo exiting ~/

The above establish enter and exit hooks for the two listed directories. As you change directories you should see output indicating each hook's execution. You'll notice that the */home* path has a **type** key with the value **tree**. There are two types of hooks; **path**, which is the default, only triggers for that absolute path. **tree** hooks will trigger when you enter or leave the tree below the specified path. Moving between child-paths below the tree does _not_ trigger the hooks. For example, moving from */ -> /home* would trigger the *enter* hook. Moving from */home -> ~/* would not trigger the exit hook.

Generally the commands specified in the hooks will be the names of shell scripts not single shell commands.

The first section of the configuration currently has two available settings:

* **default_type**: either **path** or **tree**. If setting is not specified, **path** will be used.
* **external_hooks**: a list of paths to other YAML files containing additional hooks. Such files should resemble the **'hooks'** section of the above example configuration.

### Usage

After installing capn you will need to source:

$ source capn

If you no longer wish to have the hooks activated:

$ unhook

### API

add_external_hook(filename, path, hooktype=DEFAULT_TYPE,
enter=[], exit=[]):

Currently capn has a minimal API with a single function that is used to manage programmatically generated external hook files. See the example below:

>>>from capn.config import add_external_hook
>>>filename = "~/.otherhooks"
>>>path = ~/projects/foo/bar
>>>hooktype = 'tree'
>>>enter = ['source ~/projects/foo/bar/bin/activate']
>>>exit = ['deactivate']
>>>add_external_hook(filename, path, hooktype=hooktype,
... enter=enter, exit=exit)

The above will add a hook to auto de/activate the python-virtualenv whenever the shell is inside the project directory to the file *"~/.otherhooks"*. You will then need to add the filename to the **external_hooks** list in the *"~/.capnhooks"* configuration file.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
capn-1.0rc1.tar.gz (4.3 kB) Copy SHA256 Checksum SHA256 Source Apr 13, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting