-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added optional (very basic) fabric deploy file
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import fabric | ||
from fabric.api import * | ||
import sys | ||
|
||
env.hosts = ['USER@HOSTNAME'] | ||
|
||
def deploy(): | ||
_check_code() | ||
code_dir = 'WHERE YOU STORE YOUR CODE, e.g. /srv/www/' | ||
with cd(code_dir): | ||
run("git pull origin master") | ||
run('/etc/init.d/apache2 reload') | ||
|
||
def _check_code(): | ||
file_list = local("git status --porcelain", capture=True) | ||
files = file_list.split('\n') | ||
if files[0] != "": | ||
print("Unchecked in files...") | ||
for f in files: | ||
print(f) | ||
if fabric.contrib.console.confirm("There are files not checked in. Are you sure you want to continue?"): | ||
print("Continuing with deployment...") | ||
else: | ||
print("Quitting deployment") | ||
sys.exit() | ||
|
||
|
||
|