Browse Source

use straight.plugin for command plugins

master
Brett Langdon 12 years ago
parent
commit
ac77b40bee
5 changed files with 35 additions and 8 deletions
  1. +5
    -0
      employ/__init__.py
  2. +22
    -3
      employ/commands/__init__.py
  3. +0
    -5
      employ/commands/base.py
  4. +1
    -0
      requirements.txt
  5. +7
    -0
      setup.py

+ 5
- 0
employ/__init__.py View File

@ -1 +1,6 @@
__version__ = "0.1.0"
from straight.plugin import load
from employ.commands import Command
commands = load("employ.commands", subclasses=Command)

+ 22
- 3
employ/commands/__init__.py View File

@ -1,3 +1,22 @@
__all__ = ["ABCommand", "Command"]
from employ.commands.base import Command
from employ.commands.ab import ABCommand
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
class Command(object):
name = "command"
def run(self):
raise NotImplementedError()
def aggregate(self):
raise NotImplementedError()
def command(self):
raise NotImplementedError()
@classmethod
def from_config(cls, config):
settings = {}
if config.has_section(cls.name):
settings = dict(config.items(cls.name))
return cls(**settings)

+ 0
- 5
employ/commands/base.py View File

@ -1,5 +0,0 @@
class Command(object):
name = "command"
def run(self):
raise NotImplementedError()

+ 1
- 0
requirements.txt View File

@ -1,2 +1,3 @@
boto>=2.13.0
docopt>=0.6.0
straight.plugin>=1.4.0

+ 7
- 0
setup.py View File

@ -10,9 +10,16 @@ setup(
author="Brett Langdon",
author_email="brett@blangdon.com",
packages=find_packages(),
namespace_packages=[
"employ.commands",
],
install_requires=[
"docopt>=0.6.0",
"boto>=2.13.0",
"straight.plugin>=1.4.0",
],
scripts=[
"bin/employ",
],
setup_requires=[],
description="Distributed one time command execution and aggregation tool",


Loading…
Cancel
Save