forked from wellnesstelecom/wtdeploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
machine_gun
executable file
·48 lines (39 loc) · 1.26 KB
/
machine_gun
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# author: javi santana
import sys
from os.path import join, dirname, exists
import wtdeploy
from fabric.api import local, settings
def init():
""" initialize deploy folder and create localhost deploy """
with settings(warn_only=True):
local("mkdir deploy");
wt_dir = dirname(wtdeploy.__file__)
# get base template location and copy to deploy
base_path = join(wt_dir, 'base_template')
if not exists('deploy/localhost'):
local("cp -r %s deploy/localhost" % base_path);
else:
print "deploy/localhost already exists"
# copy fabfile
if not exists('fabfile.py'):
fabfile_path = join(wt_dir, 'fabfile.py.template')
local("cp %s fabfile.py" % fabfile_path);
else:
print "fabfile.py already exists"
print "OK"
print "please, check deploy/localhost and fabfile.py files"
def show_help():
print "** machine_gun, wtdeploy helper tool **"
print "available commands:"
print "\t-init: create deploy folder and a very basic fabfile.py"
if __name__ == '__main__':
#with hide('running', 'stdout', 'stderr'):
if len(sys.argv) > 1:
cmd = sys.argv[1]
if cmd == "init":
init();
else:
show_help()