forked from jakearchibald/sprite-cow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
30 lines (24 loc) · 1021 Bytes
/
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
# Fabric for deploying the spritecow app
import os
import datetime
import ConfigParser
from fabric.colors import yellow
from fabric.api import local, env
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
here = lambda *x: os.path.join(PROJECT_ROOT, *x)
config = ConfigParser.ConfigParser()
config.readfp(open('fabric.cfg'))
env.bucket = config.get('production', 'bucket')
env.git_url = config.get('production', 'git_url')
env.access_key = config.get('production', 'access_key')
env.secret_key = config.get('production', 'secret_key')
tmp_time = datetime.datetime.now()
env.time = tmp_time.strftime("%Y%m%d_%H%M%S")
env.clone_path = here('tmp', env.time )
env.htdocs = here('tmp', env.time, 'www')
def deploy():
"""Deployment actions into S3 using s3put"""
local('mkdir -p %(clone_path)s' % env)
local('git clone %(git_url)s %(clone_path)s' % env)
local('./s3put.py -a %(access_key)s -s %(secret_key)s -b %(bucket)s -p %(htdocs)s -g public-read %(htdocs)s' % env)
print yellow("Done?")