Last active
December 15, 2015 08:08
-
-
Save mikedory/5228140 to your computer and use it in GitHub Desktop.
Revisions
-
mikedory revised this gist
Mar 23, 2013 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,10 @@ def test(): # add and commit all local files def commit(): with settings(warn_only=True): commit = local("git add -p && git commit") if commit.failed: print("Nothing to commit. Moving on.") # push up to github -
mikedory revised this gist
Mar 23, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def commit(): # push up to github def push(): local("git push origin master") # run all the pre-flight tests -
mikedory created this gist
Mar 23, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ # import the fabric requirements from __future__ import with_statement from fabric.api import * from fabric.contrib.console import confirm # import local_settings.py from local_settings import * # run Django's test framework def test(): with settings(warn_only=True): result = local('./manage.py test appname', capture=True) if result.failed and not confirm("Tests failed! D: Continue anyway?"): abort("Aborting!") # add and commit all local files def commit(): local("git add -p && git commit") # push up to github def push(): local("git push") # run all the pre-flight tests # this would also be a handy place to pack/minify, if so desired def prepare_deploy(): test() commit() push() # --------------------- # deploy to the remote server def deploy(): with settings(warn_only=True): if run("test -d %s" % code_dir).failed: run("git clone %s %s" % (code_repo, code_dir)) with cd(code_dir): run("git fetch") run("git merge origin/master") run("supervisorctl restart appname") This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ # deploy/fabric needs from fabric.api import * # remote server configs env.user = 'username' env.hosts = ['domain.com'] env.key_filename = '/path/to/.ssh/id_rsa' # deploy directory and repo info code_dir_root = '/path/to/code/directory' code_dir_target = '/path/to/code/directory/target' code_repo = '[email protected]:user/REPO.git'