Python fabric.api.env 模块,project_name() 实例源码

我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用fabric.api.env.project_name()

项目:service-notifications    作者:rehive    | 项目源码 | 文件源码
def set_env(config, version_tag=None):
    """
    Fabric environmental variable setup
    """
    # Bug: when setting this inside a function. Using host_string as workaround
    config_dict = get_config(config)
    env.hosts = [config_dict['HOST_NAME'], ]
    env.host_string = config_dict['HOST_NAME']

    env.project_name = config_dict['PROJECT_NAME']
    env.project_dir = posixpath.join('/srv/images/', env.project_name)
    env.use_ssh_config = True

    env.image_name = config_dict['IMAGE'].split(':')[0]
    env.base_image_name = env.image_name + '_base'
    env.version_tag = version_tag

    env.build_dir = '/srv/build'
    env.local_path = os.path.dirname(__file__)
项目:service-notifications    作者:rehive    | 项目源码 | 文件源码
def set_env(config, version_tag=None):
    """
    Fabric environmental variable setup
    """
    # Bug: when setting this inside a function. Using host_string as workaround
    config_dict = get_config(config)
    env.hosts = [config_dict['HOST_NAME'], ]
    env.host_string = config_dict['HOST_NAME']

    env.project_name = config_dict['PROJECT_NAME']
    env.project_dir = posixpath.join('/srv/images/', env.project_name)
    env.use_ssh_config = True

    env.image_name = config_dict['IMAGE'].split(':')[0]
    env.base_image_name = env.image_name + '_base'
    env.version_tag = version_tag

    env.build_dir = '/srv/build'
    env.local_path = os.path.dirname(__file__)
项目:service-notifications    作者:rehive    | 项目源码 | 文件源码
def upload():
    """Upload entire project to server"""
    # Bug: when setting this inside a function. Using host_string as workaround
    run('mkdir -p /srv/images/'+env.project_name+'/')
    rsync_project(
        env.project_dir, './',
        exclude=(
            '.git', '.gitignore', '__pycache__', '*.pyc', '.DS_Store', 'environment.yml',
            'fabfile.py', 'Makefile', '.idea', 'bower_components', 'node_modules',
            '.env.example', 'README.md', 'var'
        ), delete=True)

# Wrapper Functions:
项目:service-notifications    作者:rehive    | 项目源码 | 文件源码
def wheels():
    """
    Remotely build python binaries on image-factory server
    """
    with lcd(env.local_path):
        put('./requirements.txt', '/srv/build/wheel_requirements.txt')
        put('./etc/base_image/image_requirements.txt',
            '/srv/build/requirements.txt')

    with cd('/srv/build/wheelhouse'):
        run('rm -rf *.whl')

    compose(cmd='-f service.yml -p %s run --rm wheel-factory' %
            env.project_name, path='/srv/build')
项目:service-notifications    作者:rehive    | 项目源码 | 文件源码
def upload():
    """Upload entire project to server"""
    # Bug: when setting this inside a function. Using host_string as workaround
    run('mkdir -p /srv/images/'+env.project_name+'/')
    rsync_project(
        env.project_dir, './',
        exclude=(
            '.git', '.gitignore', '__pycache__', '*.pyc', '.DS_Store', 'environment.yml',
            'fabfile.py', 'Makefile', '.idea', 'bower_components', 'node_modules',
            '.env.example', 'README.md', 'var'
        ), delete=True)


# Wrapper Functions:
项目:flask-gulp-starter-kit    作者:hypebeast    | 项目源码 | 文件源码
def heroku_bootstrap():
    """Create an app for every environment on Heroku."""
    require('project_name')
    require('environments')

    info('Initializing Heroku apps...')

    set_remotes()

    for environment in env.environments:
        env.environment = environment
        env.app_name = '{}-{}'.format(env.project_name, env.environment)
        heroku_initialize_app()
项目:flask-gulp-starter-kit    作者:hypebeast    | 项目源码 | 文件源码
def heroku_configure_app():
    """Configure an app with a basic configuration."""
    require('environment')
    require('project_name')

    info('Configure app: {}'.format(env.app_name))

    local('heroku addons:create heroku-postgresql --remote {}'.format(env.environment))
    local('heroku pg:backups schedule DATABASE --at "04:00 UTC" --remote {}'.format(env.environment))
    local('heroku pg:promote DATABASE_URL --remote {}'.format(env.environment))
    local('heroku config:set SECRET_KEY="{}" --remote {}'.format(create_secret_key(), env.environment))
项目:startupintro    作者:ShubhamBansal1997    | 项目源码 | 文件源码
def init(vagrant=False):
    """Prepare a local machine for development."""

    install_requirements()
    local('createdb %(project_name)s' % env)  # create postgres database
    manage('migrate')
项目:DexRoBot    作者:revolter    | 项目源码 | 文件源码
def setup():
    run('mkdir -p {0.project_path}/{0.project_name}'.format(env))
    run('ln -s {0.project_path}/{0.project_name} ~/{0.project_name}'.format(env))

    with cd('~/{.project_name}'.format(env)):
        run('virtualenv -p python3 env')
项目:DexRoBot    作者:revolter    | 项目源码 | 文件源码
def cleanup():
    run('rm -r ~/{.project_name}'.format(env))
    run('rm -r {0.project_path}/{0.project_name}'.format(env))
项目:DexRoBot    作者:revolter    | 项目源码 | 文件源码
def deploy(filename=None):
    with cd('~/{.project_name}'.format(env)):
        if not filename:
            for source_filename in env.source_filenames:
                put('src/{}'.format(source_filename), '~/{.project_name}/'.format(env))

            run('source env/bin/activate; pip install -r requirements.txt')
        else:
            put('src/{}'.format(filename), '~/{.project_name}/'.format(env))