Skip to content

Commit

Permalink
Improved support for multiple repos kinds
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Haineault committed Apr 18, 2012
1 parent b7fba3f commit 8f95645
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
10 changes: 5 additions & 5 deletions dukeclient/fabric/tasks.py
Expand Up @@ -157,7 +157,6 @@ def update_code(reload=True):
Update code on the servers.
"""
project_path = get_project_path(env)
print env

with cd(project_path):
if is_svn(env):
Expand All @@ -171,10 +170,11 @@ def checkout_code(reload=True):
Update code on the servers.
"""
project_path = get_project_path(env)
if is_svn(env):
sudo('svn co %s %s' % (env.site['repos'], project_path))
elif is_git(env):
sudo('git clone %s %s' % (env.site['repos'], project_path))
kind, repos = get_repos(env)
if kind == 'svn':
sudo('svn co %s %s' % (repos, project_path))
elif kind == 'git':
sudo('git clone %s %s' % (repos, project_path))


@task
Expand Down
16 changes: 11 additions & 5 deletions dukeclient/fabric/utils.py
Expand Up @@ -76,11 +76,17 @@ def require_root_cwd():
puts("You must be in the root directory of your project to use this command.")
sys.exit(1)

def get_repos(env):
if '+' in env.site['repos']:
return env.site['repos'].split('+')
else:
if env.site['repos'].startswith('svn:'):
return ('svn', env.site['repos'])
elif env.site['repos'].startswith('svn:'):
return ('git', env.site['repos'])

def is_svn(env):
# TODO: find a more reliable way
return env.site['repos'].startswith('svn:')
return get_repos(env)[0] == 'svn'

def is_git(path):
# TODO: find a more reliable way
return env.site['repos'].startswith('git:')
def is_git(env):
return get_repos(env)[0] == 'git'

0 comments on commit 8f95645

Please sign in to comment.