Skip to content

Instantly share code, notes, and snippets.

@bitprophet
Created February 23, 2012 20:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitprophet/35a3f04306f2f1be7f4f to your computer and use it in GitHub Desktop.
Save bitprophet/35a3f04306f2f1be7f4f to your computer and use it in GitHub Desktop.
from fabric.api import env, run
def deploy():
run("whatevs")
# Old way
def live():
env.hosts = ['a', 'b', 'c']
def staging():
env.hosts = ['1', '2']
# invoked as: fab live deploy
# New way
environments = {
'live': {'hosts': ['a', 'b', 'c']},
'staging': {'hosts': ['1', '2']}
}
def environment(name):
env.update(environments[name])
# invoked as: fab environment:live deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment