-
Notifications
You must be signed in to change notification settings - Fork 1
/
fabfile.py
61 lines (43 loc) · 1.32 KB
/
fabfile.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
import socket
import urllib2
from fabric.api import local
from distutils import spawn
__author__ = 'GHIBOUB Khalid'
INTERNET_TEST_URL = 'https://www.google.com'
"""
REQUIREMENTS:
- install pip with distribute (http://packages.python.org/distribute/)
- sudo pip install Fabric
"""
def is_internet_on():
try:
urllib2.urlopen(INTERNET_TEST_URL, timeout=2)
return True
except (urllib2.URLError, socket.timeout):
return False
def check_virtualenv():
return bool(spawn.find_executable('virtualenv')), 'virtualenv', '#virtualenv'
def check_bower():
return bool(spawn.find_executable('bower')), 'bower', '#bower'
def check_gulp():
return bool(spawn.find_executable('gulp')), 'gulp', '#gulp'
def install():
if is_internet_on():
if not check_virtualenv():
local("pip install virtualenv")
if not check_gulp():
local("npm install -g gulp")
if not check_bower():
local("npm install -g bower")
local("python run.py -d")
local("npm install")
local("bower install")
local("gulp serve-gae")
else:
print 'ERROR ==> You have no internet connection.'
def update():
local("python run.py -d")
local("npm install")
local("bower install")
def run():
local("gulp serve-gae")