diff --git a/README.rst b/README.rst index 670d154b6b5843037e80aa3a571d5df2f0e72489..b19a0283d877539f9c60f7175c2cad0a60d7a97a 100644 --- a/README.rst +++ b/README.rst @@ -6,6 +6,5 @@ My Debian repository, minus the state (packages, db, etc.). todo ---- -- Use Fabric's module instead of rsync manually. - License. - Add GPG key. diff --git a/fabfile.py b/fabfile.py index 3dfecced20df6ad6832676c8382b8ffbffef8088..e66991ec7407fb295ce01aedea68d140064e14e4 100644 --- a/fabfile.py +++ b/fabfile.py @@ -1,12 +1,19 @@ #!/usr/bin/env python -from fabric.api import task, local +from fabric.api import task, local, env, hosts +from fabric.contrib.project import rsync_project +from os import environ + +env.use_ssh_config = True @task +@hosts('www.shore.co.il') def publish(): - local('''rsync -az --del --exclude="conf/" --exclude="db/" \ - --exclude="fabfile.*" --exclude="lists/" $REPREPRO_BASE_DIR\ - www.shore.co.il:/var/www/htdocs/www.shore.co.il/repo/''') + rsync_project(remote_dir='''/var/www/htdocs/www.shore.co.il/repo''', + exclude=['''fabfile.*''', 'lists/', 'conf/', 'db/'], + local_dir=environ['REPREPRO_BASE_DIR'], + delete=True, + extra_ops='-z') @task