forked from jamierumbelow/codeigniter-schema
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfabfile.py
More file actions
73 lines (60 loc) · 1.88 KB
/
Copy pathfabfile.py
File metadata and controls
73 lines (60 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import os
from fabric.api import *
from fabric.contrib import console
# We don't need to run any server commands in this fab file
# it's just a shortcut to various Git commands:
########################################################################
# local commands
########################################################################
def commit():
"""
Commits changes to the local repository, prompting for a commit message if necessary
Usage:
fab commit
Note that in most situations, calling fab push will suffice
"""
msg = prompt("Commit message:", default="No message")
_commit(msg)
def _commit(msg=None):
local("git add .", capture=False)
with settings(hide('warnings'),warn_only=True):
if(msg):
local("git commit -am \"%s\"" % msg, capture=False)
else:
local("git commit -am \"No message\"", capture=False)
def push():
"""
Commits changes and then pushes them to the remote repository
Usage:
fab push
"""
with hide('running'):
print("Pushing files to remote repository")
commit()
local("git push origin master", capture=False)
def pull():
"""
Pulls changes from the remote repository, and updates the local copy
Usage:
fab pull
"""
with hide('running'):
print("Pulling files from remote repository")
local("git pull origin master")
def retag():
"""
"Retags" the repository, meaning that the current codebase becomes 1.0.0
Based on code from http://nathanhoad.net/how-to-delete-a-remote-git-tag
"""
version = prompt("Enter tag:")
_retag(version)
def _retag(version=0):
with hide('running'):
if version > '':
print("Retagging repository as %s" % version)
local("git tag -d %s" % version, capture=False)
local("git push origin :refs/tags/%s" % version, capture=False)
local("git tag %s" % version, capture=False)
local("git push origin %s" % version, capture=False)
else:
print("Pleas specify the version to retag as.");