对于我使用git和Fabric部署的几个web项目,有时我有特定的任务要做。
示例:
有些任务我故意不自动执行,因为很不寻常。
我正在考虑管理在存储库中签入的TODO文件,我将从我的fabfile中读取这个文件,以提醒我在部署之前或之后要做的与新版本相关的特定事情。
是否有一种通用的方法来管理这些特定于部署的提醒?
发布于 2015-10-14 10:08:19
以下是我使用的解决方案(直到我找到更好的解决方案)
用织物:
from fabric.colors import red
from os.path import isfile
def dontforget(force=False):
if not force and isfile('TODO'):
print(red("/* TODO ************************/"))
local('cat TODO')
print(red("/*******************************/"))
exit(0)
print(green("Ok I'm good"))从我的主deploy函数调用
def deploy(force=False):
dontforget(force)
print(green("Let's deploy that awesome version !"))
pushpull()
cacheclear()
# ...如果存在TODO文件,则显示该文件并停止该程序。
$ fab deploy
/* TODO ************************/
- Do this
- Do that
/*******************************/
$ fab deploy:force
Ok I'm good
Let's deploy that awesome version !https://stackoverflow.com/questions/33121693
复制相似问题