Permalink
Browse files

Update fabfile to work with new Digial Ocean setup

  • Loading branch information...
1 parent 6799e4f commit a21bad305d5103c8b09ab5b5a1efd03c5df26472 @mccutchen committed Apr 2, 2014
Showing with 9 additions and 23 deletions.
  1. +9 −23 fabfile.py
View
@@ -7,45 +7,31 @@
* The github repo for the site has the same name as well
"""
-import os
-from fabric.api import abort, env, local, run, task
+from fabric.api import env, local, run, task
-env.hosts = ['overloaded.org']
+env.hosts = ['mccutch.org']
env.use_ssh_config = True
-def domain():
- return os.path.basename(os.path.dirname(__file__))
-
-
-def web_dir():
- if domain() == 'overloaded.org':
- return '~/web/public'
- return '~/domains/{}/web/public'.format(domain())
-
-
-def dir_exists(dirname):
- cmd = '[ -d {} ]'.format(dirname)
- return run(cmd, warn_only=True, quiet=True).return_code == 0
+TARGET_DIR = '/var/www/strftime.org'
@task
-def check_domain():
- """Check to see whether this domain has been set up on the server side."""
- if not dir_exists(web_dir()):
- abort('Domain {} not configured'.format(domain()))
+def ensure_target():
+ run('mkdir -p {}'.format(TARGET_DIR))
@task
def deploy():
"""Build and deploy a new version of the site."""
- check_domain()
build()
src = 'dist/'
- dst = '{}:{}'.format(env.hosts[0], web_dir())
+ dst = '{}:{}'.format(env.hosts[0], TARGET_DIR)
if not dst.endswith('/'):
dst = dst + '/'
- local('rsync --verbose --progress --recursive --delete {} {}'.format(src, dst))
+ cmd = 'rsync --verbose --progress --recursive --delete {} {}'.format(
+ src, dst)
+ local(cmd)
clean()

0 comments on commit a21bad3

Please sign in to comment.