开发者

Is there anything thing like pastescript without the paste part?

开发者 https://www.devze.com 2023-04-08 09:19 出处:网络
I am looking for a simple lib/tool like paster that I can easily create custom commands without having anything to do with paste itself. I am looking to create a helper tool like paster o开发者_运维问

I am looking for a simple lib/tool like paster that I can easily create custom commands without having anything to do with paste itself. I am looking to create a helper tool like paster o开发者_运维问答r manage.py to do various tasks like build (maybe using buildout), build documentation and run scripts/tests for a non-web/non-wsgi based project. (that's why I don't want anything that needs paste)

Any suggestions on a tool? Does my approach sound reasonable?


Often I use Fabric as my general purpose project janitor. Usually I automate the following tasks with Fabric:

  • generate documentation
  • run tests
  • make releases

Initially Fabric has been developed to ease the automation/scripting of commands to run on remote hosts using SSH. However, Fabric is also an excellent tool to automate local project management related tasks.

Fabric commands are plain Python functions within a so called fabfile. You don't need to know much about Fabric to get started. Here's a simple fabfile.py:

from fabric.api import local

def tests():
    """Run the test suite."""
    ...

def release(version):
    """Make a relase."""
    tests()
    local("hg tag %s" % version)
    ...

which may be used like that:

$ fab -l
Available commands:

    release  Make a relase.
    tests    Run the test suite.

$ fab release:version=0.1
...
[localhost] local: hg tag 0.1
...

Concerning buildout, just add this part to your buildout.cfg and Fabric is ready to use at bin/fab:

[fabric]
recipe = zc.recipe.egg
eggs =
    <things-you-need-in-your-fabfile>
    fabric
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号