def notify(msg, col=green, wrap='0'): bar = '+-%s-+' % ('-' * len(msg)) print '' print col(bar) print _wrap_with(wrap)(col("| %s |" % msg)) print col(bar) print ''
def _git_clone(): with cd(env.projects_path): if not exists(join(env.code_root, '.git')): sudo('git clone %s' % env.repository, user=env.django_user) # pass else: _wrap_with(yellow)('Django source dir already exists. Not cloning repo!')
def notify(msg, col=green, wrap='0'): bar = '+-%s-+' % ('-'*len(msg)) print '' print col(bar) print _wrap_with(wrap)(col("| %s |" % msg)) print col(bar) print ''
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from os.path import abspath, dirname, isfile from datetime import datetime from fabric.api import env, puts, abort, task, put, hide, cd from fabric.operations import sudo, settings, run from fabric.contrib import console from fabric.contrib.files import upload_template from fabric.colors import _wrap_with, green, red green_bg = _wrap_with('42') red_bg = _wrap_with('41') pg_fabrep_path = dirname(abspath(__file__)) ######################### ## START pg_fabrep tasks ## ######################### @task def setup(): parameter_default_values() # test configuration start if not test_configuration(): if not console.confirm("Configuration test %s! Do you want to continue?" % red_bg('failed'), default=False): abort("Aborting at user request.") # test configuration end if env.ask_confirmation:
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys from copy import copy from os.path import dirname, expanduser, join from fabric.api import * from fabric.contrib.files import upload_template, append, exists from fabric.context_managers import cd, shell_env from fabric.colors import _wrap_with, green green_bg = _wrap_with('42') red_bg = _wrap_with('41') # env.key_filename = expanduser('~/.ssh/google_compute_engine') env.use_ssh_config = True @task def production(): env.hostname = 'friendfeed' env.user = '******' # name of your project - no spaces, no special chars env.project = 'ff' # hg repository of your project env.repository = '[email protected]:yinhm/friendfeed.git' # type of repository (git or hg) env.repository_type = 'git'
import os from coverage.misc import CoverageException from fabric.api import lcd, local, settings from fabric.colors import _wrap_with from settings import ( DATABASES, MEDIA_ROOT, PROJECT_ROOT, TEST_APPS, ) from fabfile import fab_settings GREEN_BG = _wrap_with('42') RED_BG = _wrap_with('41') def _get_test_apps(all='1'): """Returns a list of apps that should be tested. :param all: If '1', the slow ``integration_tests`` app will be included. """ apps = TEST_APPS if all == '1': apps.append('integration_tests') return apps
"""Fabric commands that are run locally.""" import os from coverage.misc import CoverageException from fabric.api import lcd, local, settings from fabric.colors import _wrap_with from settings import ( DATABASES, MEDIA_ROOT, PROJECT_ROOT, TEST_APPS, ) from fabfile import fab_settings GREEN_BG = _wrap_with('42') RED_BG = _wrap_with('41') def _get_test_apps(all='1'): """Returns a list of apps that should be tested. :param all: If '1', the slow ``integration_tests`` app will be included. """ apps = TEST_APPS if all == '1': apps.append('integration_tests') return apps
from fabric.api import * from fabric.colors import red, green, yellow, blue, _wrap_with from fabric.utils import puts from cuisine import * from random import randint from fabric.context_managers import hide import socket import paramiko env.hosts = ["xxx.xxx.xxx.xxx"] env.user = "******" env.password = "******" dbpasswd = "dbpasswd" port = randint(3307, 9999) green_bg = _wrap_with("42") red_bg = _wrap_with("41") def uptime(): run("uptime") def create(account): """create new falkia account""" with settings(hide("running", "user"), warn_only=True): if is_host_up(env.host): print(green("bootstrapping falkia")) run("git clone git://github.com/jahil/falkia.git /falkia/%s" % account) print(green("creating database and user")) run("mysqladmin -u %s -p%s create %s" % (env.user, dbpasswd, account)) run(
#!/usr/bin/env python import os import yaml import re import time import utils from fabric.api import * from fabric.contrib import * from fabric.colors import _wrap_with from fabric.colors import * green_bg = _wrap_with('42') env.user = '******' env.application = 'taskrabbit' env.repository = '[email protected]:runmyerrand/runmyerrand.git' env.pull_url = 'https://github.com/runmyerrand/runmyerrand/pull' env.scm = 'git' env.admin_runner = 'deploy' env.keep_releases = '5' env.deploy_via = 'remote_cache' env.applicationdir = '/home/%(user)s/www/%(application)s' % {'user': env.user, 'application': env.application} env.deploy_to = env.applicationdir env.local_dir = '~/taskrabbit/web' #env.macos = local('sw_vers -productVersion', capture=True) env.abort_on_prompts = True env.disable_known_hosts = True env.skip_bad_hosts = True env.keepalive = True env.connection_attempts = '2'