-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathpavement.py
84 lines (65 loc) · 1.6 KB
/
pavement.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from paver.easy import *
from pygithub3 import Github
import pprint
def _gh():
gh = Github(user="ossec", repo="ossec-hids")
return gh
@task
@consume_args
def status(args):
print args
cmd = "vagrant status"
sh(cmd)
@task
@consume_args
def destroy(args):
cmd = "vagrant destroy"
if "force" in args:
cmd += " -f"
else:
cmd += " ".join(args)
sh(cmd)
@task
@consume_args
def halt(args):
cmd = "vagrant halt "
if "force" in args:
cmd += " -f "
else:
cmd += " ".join(args)
sh(cmd)
@task
@consume_args
def up(args):
cmd = "vagrant up "
cmd += " ".join(args)
sh(cmd)
@task
def pulls():
gh = _gh()
pull_requests = gh.pull_requests.list().all()
for i in pull_requests:
print "{0.number}\t{0.title}".format(i)
@task
def getmaster():
sh("wget -O files/ossec-hids-master.tar.gz https://github.com/ossec/ossec-hids/archive/master.tar.gz")
sh("ln -s files/ossec-hids-master.tar.gz ossec-hids.tar.gz")
@task
@consume_nargs(1)
def getpull(args):
gh = _gh()
pull_number = args[0]
pull = gh.pull_requests.get(pull_number)
#print dir(pull)
branch = pull.head['ref']
full_name = pull.head['repo']['full_name']
print "{}/tree/{}".format(branch, full_name)
url = "https://github.com/{}/archive/{}.tar.gz".format(full_name, branch)
sh("wget -O files/ossec-hids-pull-{}.tar.gz {}".format(pull_number, url))
sh("ln -s files/ossec-hids-pull-{}.tar.gz ossec-hids.tar.gz".format(pull_number))
@task
@consume_args
def rebuild(args):
halt(args)
destroy(args)
up(args)