Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

Fabric-taskset

Fabric has class-based tasks but they are limited: Task class represents a single task.

This module make it possible to have class-based Fabric task sets.

Installation

pip install fabric-taskset

Usage

TaskSet is a class that can expose its methods as Fabric tasks.

Example:

# my_lib/say.py
from taskset import TaskSet, task

class SayBase(TaskSet):
    def say(self, what):
        raise NotImplemented()

    @task(default=True, alias='hi')
    def hello(self):
        self.say('hello')

class EchoSay(SayBase):
    def say(self, what):
        local('echo ' + what)

instance = EchoSay()
instance.expose_to_current_module()

# fabfile.py
from mylib import say

and then e.g.:

$ fab say.hi
hello

taskset.task is a decorator declaring the wrapped method to be task. It acceps the same arguments as fabric.decorators.task so use it on methods just like fabric's decorator is used on functions.

Acknowledgements

https://github.com/ramusus/fabriclassed is a very similar app. At the time of writing it is focused on old-style Fabric tasks and has a small deployment framework included.

In order to feed my NIH syndrome I create Fabric-taskset which exposes new-style Fabric tasks, provides slightly different API and doesn't have extra goodies.

Recent activity

theoden

Commits by theoden were pushed to theoden/fabric-taskset

3e4951f - * expose_as_module has got a second (optional) parameter - module_type, which allow to customise type of the returned module
theoden

Commits by theoden were pushed to theoden/fabric-taskset

22eee92 - * no more need for expose method. it's replaced with expose_to_module due to new apps-management approach.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.