Last active
August 29, 2015 14:17
-
-
Save vijaysharmay/57710a5f7ef9e411912f to your computer and use it in GitHub Desktop.
Assumes the host details are stored in userdetails.json
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 characters
| from fabric.api import * | |
| import os,json | |
| from os.path import expanduser | |
| env.forward_agent = True | |
| USER_DETAILS = os.path.join(expanduser('~'),'userdetails.json') | |
| def commit(message): | |
| local('git add .') | |
| local('git commit -m "' + message + '"') | |
| def localpush(message): | |
| with settings(warn_only=True): | |
| commit(message) | |
| local('git push -u origin master') | |
| def deploy(proj_path): | |
| with open(USER_DETAILS) as USERDETAILS: | |
| userdetails = json.load(USERDETAILS)[0] | |
| env.host_string = userdetails['host'] | |
| env.password = userdetails['password'] | |
| complete_path = os.path.join('/home',userdetails['host'].split('@')[0],proj_path) | |
| with cd(complete_path): | |
| run("git pull") | |
| def remotepush(message,proj_path): | |
| localpush(message) | |
| deploy(proj_path) | |
| print "Code Sync Complete." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment