diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2014-03-29 23:24:54 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2014-03-30 12:28:01 +0100 |
commit | 891e2fc87f0a6691538cd90865c2f92788c9b978 (patch) | |
tree | fff2d979cfa222a794e4af8eddffc1c8e9cb267d /.travis/install | |
parent | 87f54caa2618bbf873ac87b5b7bca04f7969d603 (diff) |
Fetch/send archive of modules before/after tests.
Before running carton install, see if we have a stored copy of the local
directory on ge.tt - if so, download and use that instead. After running
the tests, if we didn't download a copy, bundle it up and upload it to
ge.tt for use next time.
Diffstat (limited to '.travis/install')
-rwxr-xr-x | .travis/install | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/.travis/install b/.travis/install new file mode 100755 index 000000000..126d641a1 --- /dev/null +++ b/.travis/install @@ -0,0 +1,29 @@ +#!/usr/bin/env python + +import hashlib +import json +import os +import sys +import tarfile +import urllib + +sharename = '48rLGpU1' + +root = os.path.join(os.path.dirname(__file__), '..') +with open(os.path.join(root, 'cpanfile.snapshot')) as cpanfile: + hash = hashlib.md5(cpanfile.read()).hexdigest() +wanted_filename = 'fixmystreet-local-%s.tgz' % hash + +share = json.loads( urllib.urlopen( 'https://open.ge.tt/1/shares/%s' % sharename ).read() ) +for file in share['files']: + if file['filename'] == wanted_filename and file['readystate'] == 'uploaded': + print "Found cached copy of local, using..." + urllib.urlretrieve('https://open.ge.tt/1/files/%s/%s/blob' % (sharename, file['fileid']), wanted_filename) + if tarfile.is_tarfile(wanted_filename): + tfile = tarfile.open(wanted_filename) + tfile.extractall() + sys.exit(0) + +print "No cached copy found, running carton install..." +os.system('cpanm -q Carton') +os.system('carton install --deployment') |