-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathmake.py
executable file
·52 lines (45 loc) · 1.28 KB
/
make.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
#! /usr/bin/env python
import os
s = os.system
def create_table_of_contents():
s('egrep "<h1|<h2" writing-games.html > /tmp/table.html')
s('''sed -i 's/name=./href="writing-games.html#/g' /tmp/table.html''')
fp = file('table.html', 'w')
fp.write('''\
<html>
<head>
<style>
h1 {
font-size: small;
}
h2 {
font-size: smaller;
text-indent: 4em;
}
h3 {
font-size: normal;
text-indent: 8em;
}
</style>
</head>
<body>
''')
fp.close()
s('cat /tmp/table.html >> ./table.html')
def create_targz_from_example(name):
targen = ('git checkout %(name)s; '
'cp -a code_examples %(name)s; '
'tar -cv --exclude-vcs %(name)s > %(name)s.tar; '
'rm -rf /tmp/%(name)s; '
'mv %(name)s /tmp/%(name)s; '
'gzip %(name)s.tar; '
)
s(targen % {'name': name})
create_table_of_contents()
create_targz_from_example('example2')
create_targz_from_example('example3')
create_targz_from_example('example4')
print 'Setting git branch to *master*'
s('git checkout master')
# always append a '/' on the src directory when rsyncing
s('rsync -r ./ [email protected]:/home/$DREAMHOST_USERNAME/ezide.com/games')