browserify_js = 'vendor/browserify.js',
work_browserify_js = '%(work_dir)s/%(browserify_js)s',
- vendor_search_dirs = ['static', 'var', '%(work_dir)s']
+ vendor_search_dirs = ['static', 'var', '%(work_dir)s'],
vendor_bundle = '%(work_dir)s/vendor/vendor-bundle.min.js',
app_bundle = '%(work_dir)s/js/kraken/app-bundle.js',
))
# TODO: Locally saved data files will cause yelling?
with cd(env.target_dir):
run('git fetch --all')
- run('git checkout --track origin/%(git_branch)s' % env)
+ opts = {'track' : '--track' if env.git_branch not in branches() else ''}
+ opts.update(env)
+ run('git checkout %(track)s origin/%(git_branch)s' % opts)
@task
@expand_env
local("rsync -Crz -v %(work_dir)s %(user)s@%(host)s:%(target_dir)s/" % env)
# TODO: make sure the following works.
# rsync_project(local_dir=env.work_dir, remote_dir="%(user)s@%(host)s:%(target_dir)s/" % env)
+
+ # Remove derived files to ensure they get regenerated
+ run('rm -rf %(target_dir)s/var' % env)
@task
@expand_env
return wrapper
-def working_branch():
- "Determines the working branch."
- return [ branch.split()[1] for branch in local('git branch', capture=True).split('\n') if '*' in branch ][0]
-
def check_branch(fn):
"Decorator that ensures deploy branch matches current branch."
env.git_branch = 'develop'
env.owner = 'wmf'
env.group = 'www'
- del env['gateway']
+ if 'gateway' in env: del env['gateway']
from fabric.colors import white, blue, cyan, green, yellow, red, magenta
__all__ = (
- 'quietly', 'msg', 'coke', 'update_version',
+ 'quietly', 'msg', 'branches', 'working_branch', 'coke', 'update_version',
'defaults', 'expand', 'expand_env', 'format', 'expand_env',
)
return outer
+
+### Git Integration
+
+def branches(remotes=False, all=False):
+ "List of git branchs."
+ opts = {
+ 'remotes' : '--remotes' if remotes else '',
+ 'all' : '--all' if all else ''
+ }
+ return [ branch.strip().split()[-1] for branch in local('git branch %(remotes)s %(all)s' % opts, capture=True).split('\n') ]
+
+def working_branch():
+ "Determines the working branch."
+ return [ branch.split()[1] for branch in local('git branch', capture=True).split('\n') if '*' in branch ][0]
+
+
+
### Coke Integration
def coke(args, capture=False):