def test_invalid_vcs_raises_env_error(): setattr(env, 'code_dir', 'dummy') v = Vcs.init(os.path.join('tests', 'ssh')) with pytest.raises(EnvironmentError): print(v.NAME)
from fabric.contrib import files from fabric.contrib.console import confirm from fabric.utils import indent from django.utils.crypto import get_random_string from hammer import __version__ as hammer_version # Ensure that we have expected version of the tg-hammer package installed assert hammer_version.startswith('0.3.'), "tg-hammer 0.3 is required" from hammer.service_helpers import {% if cookiecutter.project_type == 'spa' %}install_services, {% endif %}install_services_cp, manage_service from hammer.vcs import Vcs vcs = Vcs.init(project_root=os.path.dirname(os.path.dirname(__file__)), use_sudo=True) LOCAL_SETTINGS = """from settings.${target} import * SECRET_KEY = '${secret_key}' DATABASES = { 'default': { 'ENGINE':'django.db.backends.postgresql_psycopg2', 'NAME': '{{cookiecutter.repo_name}}', 'USER': '******', 'PASSWORD': '******', 'HOST': '127.0.0.1', 'PORT': '5432', }
:arg silent If true doesn't show confirms. version # Get the version deployed to target. update_requirements # Perform pip install -r requirements/production.txt stop_server # Stop the remote server service. start_server # Start the remote server service. restart_server # Restart the remote server service. migrate_diff # Get the status of migrations needed when upgrading target to the specified version. :arg id Identifier of revision to check against. """ # Ensure that we have expected version of the tg-hammer package installed assert hammer_version == '0.0.5', "tg-hammer==0.0.5 is required" vcs = Vcs.init(project_root=os.path.dirname(os.path.dirname(__file__)), use_sudo=True) LOCAL_SETTINGS = """from settings.${target} import * SECRET_KEY = '${secret_key}' DATABASES = { 'default': { 'ENGINE':'django.db.backends.postgresql_psycopg2', 'NAME': 'tamveeb', 'USER': '******', 'PASSWORD': '******', 'HOST': '127.0.0.1', 'PORT': '5432', } }
def get_vcs(self, code_dir=None): return Vcs.init(project_root=self.repo_dir, code_dir=code_dir if code_dir else '/srv/%s_project' % self.vcs_type, use_sudo=False)