Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 53 lines (38 sloc) 1.384 kB
b10a9fc @igorsobreira fabfile
authored
1 import os.path
305099a @igorsobreira now using twisted
authored
2 from fabric.api import *
9ab27f2 @igorsobreira simpe ping plugin
authored
3 from eizzek import config
305099a @igorsobreira now using twisted
authored
4
5 env.hosts = [config.SSH_HOST] # format: username@host:port
6
7 VIRTUALENV_DIR = '/home/igor/eizzek_env'
b10a9fc @igorsobreira fabfile
authored
8 EIZZEK_DIR = os.path.join(VIRTUALENV_DIR, 'eizzek')
305099a @igorsobreira now using twisted
authored
9
b10a9fc @igorsobreira fabfile
authored
10 python = os.path.join(VIRTUALENV_DIR, 'bin', 'python')
11 twistd = os.path.join(VIRTUALENV_DIR, 'bin', 'twistd')
305099a @igorsobreira now using twisted
authored
12
13
b10a9fc @igorsobreira fabfile
authored
14 def update_deps(*deps):
15 for dep in deps:
16 print ' - Updating %s' % dep
17 with cd( os.path.join(VIRTUALENV_DIR, dep) ):
18 run('git pull')
19 run('%s setup.py install' % python)
20
305099a @igorsobreira now using twisted
authored
21
b10a9fc @igorsobreira fabfile
authored
22 def update(all=False):
23 ''' Update the project. Use :all to update all git depedencies '''
24 if all:
25 update_deps('wokkel')
305099a @igorsobreira now using twisted
authored
26 with cd(EIZZEK_DIR):
b10a9fc @igorsobreira fabfile
authored
27 print ' - Updating eizzek'
305099a @igorsobreira now using twisted
authored
28 run('git pull')
b10a9fc @igorsobreira fabfile
authored
29 send_config()
305099a @igorsobreira now using twisted
authored
30
31
b10a9fc @igorsobreira fabfile
authored
32 def start():
33 ''' Start bot service '''
34 with cd(EIZZEK_DIR):
9ab27f2 @igorsobreira simpe ping plugin
authored
35 run('%s -y eizzek/twistd.tac' % twistd)
305099a @igorsobreira now using twisted
authored
36
37
b10a9fc @igorsobreira fabfile
authored
38 def stop(force=False):
b2fea7a @igorsobreira fixing fabfile
authored
39 ''' Stop the bot. Use :force to kill -9. Default is -15 '''
305099a @igorsobreira now using twisted
authored
40 with cd(EIZZEK_DIR):
b10a9fc @igorsobreira fabfile
authored
41 if 'twistd.pid' not in run('ls'):
42 print ' - Not running'
43 return
44 pid = run('cat twistd.pid')
45 force = '-9' if force else '-15'
46 run( 'kill %s %s' % (force, pid) )
47
48
49 def send_config():
50 ''' Send the local config.py to the server '''
b2fea7a @igorsobreira fixing fabfile
authored
51 put('eizzek/config.py', os.path.join(EIZZEK_DIR, 'eizzek', 'config.py'))
305099a @igorsobreira now using twisted
authored
52
Something went wrong with that request. Please try again.