def execute(branch, command, release=None): """ Execute a shell command in the virtualenv $ fab execute:staging,"tail logs/*.log" If no release is specified it defaults to the latest release. """ release = release or base.current_release() directory = _join(env.releases_path, release, env.github_repo_name) return _virtualenv(directory, command)
def copy_settings_file(branch, release=None): """ Copy the settings file for this branch to the server $ fab copy_settings_file:staging If no release is specified it defaults to the latest release. """ release = release or base.current_release() directory = _join(env.releases_path, release, env.github_repo_name) put( "environments/%(branch)s.py" % env, _join(directory, "environments/%(branch)s.py" % env) )
def create_virtualenv(branch, release=None): """ Create the virtualenv and install the PIP requirements $ fab create_virtualenv:staging If no release is specified it defaults to the latest release """ release = release or base.current_release() directory = _join(env.releases_path, release, env.github_repo_name) with cd(directory): return run(" && ".join([ "virtualenv --no-site-packages ve", "source ve/bin/activate", "pip -E ve install --download-cache=%(pip_cache_path)s -r config/requirements.pip" % env, "python setup.py develop", ]))