Add branch/tag management in fabfile collect_remote_statics

cf https://github.com/yohanboniface/django-leaflet-storage/issues/41
This commit is contained in:
Yohan Boniface 2013-01-03 17:41:18 +01:00
parent e6bf339c54
commit 5d47ae1d8b

11
fabfile.py vendored
View file

@ -252,12 +252,13 @@ def collect_remote_statics():
run('mkdir -p {0}'.format(remote_static_dir)) run('mkdir -p {0}'.format(remote_static_dir))
remote_repositories = { remote_repositories = {
'leaflet': "git://github.com/CloudMade/Leaflet.git@stable", 'leaflet': "git://github.com/CloudMade/Leaflet.git@stable",
'draw': "git://github.com/jacobtoye/Leaflet.draw.git", 'draw': "git://github.com/jacobtoye/Leaflet.draw.git@master",
'hash': "git://github.com/mlevans/leaflet-hash.git", 'hash': "git://github.com/mlevans/leaflet-hash.git@master",
'storage': 'git://github.com/yohanboniface/Leaflet.Storage.git', 'storage': 'git://github.com/yohanboniface/Leaflet.Storage.git@master',
} }
with cd(remote_static_dir): with cd(remote_static_dir):
for subdir, repository in remote_repositories.iteritems(): for subdir, path in remote_repositories.iteritems():
repository, branch = path.split('@')
with hide("running", "stdout"): with hide("running", "stdout"):
exists = run('if [ -d "{0}" ]; then echo 1; fi'.format(subdir)) exists = run('if [ -d "{0}" ]; then echo 1; fi'.format(subdir))
if exists: if exists:
@ -265,3 +266,5 @@ def collect_remote_statics():
run('git pull') run('git pull')
else: else:
run('git clone {0} {1}'.format(repository, subdir)) run('git clone {0} {1}'.format(repository, subdir))
with cd(subdir):
run('git checkout {0}'.format(branch))