Ejemplo n.º 1
0
def _add_defaults():
    """Defaults from fabricrc.txt file; loaded if not specified at commandline.
    """
    if not env.has_key("distribution"):
        config_file = os.path.join(env.config_dir, "fabricrc.txt")
        if os.path.exists(config_file):
            env.update(load_settings(config_file))
Ejemplo n.º 2
0
def _parse_fabricrc(env):
    """Defaults from fabricrc.txt file; loaded if not specified at commandline.
    """
    env.config_dir = os.path.join(os.path.dirname(__file__), "..", "config")
    if not env.has_key("distribution") and not env.has_key("system_install"):
        env.logger.info("Reading default fabricrc.txt")
        env.update(load_settings(get_config_file(env, "fabricrc.txt").base))
Ejemplo n.º 3
0
def _parse_fabricrc(env):
    """Defaults from fabricrc.txt file; loaded if not specified at commandline.
    """
    env.config_dir = os.path.join(os.path.dirname(__file__), "..", "config")
    if not env.has_key("distribution") and not env.has_key("system_install"):
        env.logger.info("Reading default fabricrc.txt")
        env.update(load_settings(get_config_file(env, "fabricrc.txt").base))
Ejemplo n.º 4
0
def _add_defaults():
    """Defaults from fabricrc.txt file; loaded if not specified at commandline.
    """
    if not env.has_key("distribution"):
        config_file = os.path.join(env.config_dir, "fabricrc.txt")
        if os.path.exists(config_file):
            env.update(load_settings(config_file))
Ejemplo n.º 5
0
def main():
    # Let's print help be default
    options = docopt(__doc__, argv=sys.argv[1:] if len(sys.argv) > 1 else ['--help'],
                     version=fc_toolbelt.__VERSION__)

    available_commands = ['boilerplate', 'config', 'git', 'gitlab', 'jenkins', 'join',
                          'redmine', 'tickets', 'update']
    command = options['<command>']

    # Load fabric defaults from ~/.fabricrc
    state.env.update(load_settings(state._rc_path()))

    if True or options['--verbose']:
        level = logging.DEBUG if options['--verbose'] else logging.INFO
        logger.addHandler(logging.StreamHandler())
        logger.setLevel(level)
    else:
        state.output['commands'] = False
        state.env.output_prefix = False

    if options['<command>'] in available_commands:
        subcommand = globals()[command]
        options = docopt(subcommand.__doc__, argv=sys.argv[1:])
        exit(subcommand(options))
    elif options['<command>'] == 'help':
        if not options['<args>']:
            exit(__doc__)
        help_command = options['<args>'][0]
        if help_command in available_commands:
            exit(textwrap.dedent(globals()[help_command].__doc__))

    exit("%r is not a fct command. See 'fct --help'." % command)
Ejemplo n.º 6
0
def common(user='******'):
    """共通"""
    env.environment = ''
    env.user = user
    env.repo_url = 'https://github.com/shinichi62/sandbox.git'
    env.branch = 'master'
    env.deploy_from = '/Users/shinichi62/sandbox'
    env.deploy_to = '~/sandbox'
    env.update(load_settings('pwd.txt'))
Ejemplo n.º 7
0
def _add_defaults():
    """Defaults from fabricrc.txt file; loaded if not specified at commandline.
    """
    env.config_dir = os.path.join(os.path.dirname(__file__), "config")
    conf_file = "tool_data_table_conf.xml"
    env.tool_data_table_conf_file = os.path.join(os.path.dirname(__file__), "installed_files", conf_file)
    if not env.has_key("distribution"):
        config_file = os.path.join(env.config_dir, "fabricrc.txt")
        if os.path.exists(config_file):
            env.update(load_settings(config_file))
Ejemplo n.º 8
0
def _add_defaults():
    """Defaults from fabricrc.txt file; loaded if not specified at commandline.
    """
    env.config_dir = os.path.join(os.path.dirname(__file__), "config")
    conf_file = "tool_data_table_conf.xml"
    env.tool_data_table_conf_file = os.path.join(os.path.dirname(__file__),
                                                 "installed_files", conf_file)
    if not env.has_key("distribution"):
        config_file = os.path.join(env.config_dir, "fabricrc.txt")
        if os.path.exists(config_file):
            env.update(load_settings(config_file))
Ejemplo n.º 9
0
def _parse_fabricrc():
    """Defaults from fabricrc.txt file; loaded if not specified at commandline.
    """
    # ## General setup
    env.config_dir = os.path.join(os.path.dirname(__file__), "config")

    if not env.has_key("distribution") and not env.has_key("system_install"):
        env.logger.info("Reading default fabricrc.txt")
        config_file = os.path.join(env.config_dir, "fabricrc.txt")
        if os.path.exists(config_file):
            env.update(load_settings(config_file))
    else:
        env.logger.warn("Skipping fabricrc.txt as distribution is already defined")
Ejemplo n.º 10
0
def _parse_fabricrc():
    """Defaults from fabricrc.txt file; loaded if not specified at commandline.
    """
    # ## General setup
    env.config_dir = os.path.join(os.path.dirname(__file__), "config")

    if not env.has_key("distribution") and not env.has_key("system_install"):
        env.logger.info("Reading default fabricrc.txt")
        config_file = os.path.join(env.config_dir, "fabricrc.txt")
        if os.path.exists(config_file):
            env.update(load_settings(config_file))
    else:
        env.logger.warn(
            "Skipping fabricrc.txt as distribution is already defined")
Ejemplo n.º 11
0
def _parse_fabricrc(env):
    """Defaults from fabricrc.txt file; loaded if not specified at commandline.
    """
    env.config_dir = os.path.join(os.path.dirname(__file__), "..", "config")
    env.tool_data_table_conf_file = os.path.join(env.config_dir, "..",
                                                 "installed_files",
                                                 "tool_data_table_conf.xml")
    if not env.has_key("distribution") and not env.has_key("system_install"):
        env.logger.info("Reading default fabricrc.txt")
        env.update(load_settings(get_config_file(env, "fabricrc.txt").base))
    if "shell_config" not in env:
        env.shell_config = "~/.bashrc"
    if "shell" not in env:
        env.shell = "/bin/bash -i -c"
Ejemplo n.º 12
0
def _parse_fabricrc(env):
    """Defaults from fabricrc.txt file; loaded if not specified at commandline.
    """
    env.config_dir = os.path.join(os.path.dirname(__file__), "..", "config")
    env.tool_data_table_conf_file = os.path.join(env.config_dir, "..",
                                                 "installed_files",
                                                 "tool_data_table_conf.xml")
    if not env.has_key("distribution") and not env.has_key("system_install"):
        env.logger.info("Reading default fabricrc.txt")
        env.update(load_settings(get_config_file(env, "fabricrc.txt").base))
    if "shell_config" not in env:
        env.shell_config = "~/.bashrc"
    if "shell" not in env:
        env.shell = "/bin/bash -i -c"
Ejemplo n.º 13
0
def _setup_cloudbiolinux_fabric_properties(env, options):
    fabricrc_file = get_main_options_string(options, "fabricrc_file", None)
    if fabricrc_file:
        env.update(load_settings(fabricrc_file))
    else:
        # Let cloudbiolinux find out default file based on flavor, dist, etc...
        _parse_fabricrc(env)
    overrides = options.get("fabricrc_overrides", {})
    for key, value in overrides.iteritems():
        # yaml parses bools, wouldn't be expected coming out of a fabricrc
        # file so replace everything with a string.
        if isinstance(value, bool):
            overrides[key] = str(value)
    env.update(overrides)
    _setup_galaxy_env_defaults(env)
Ejemplo n.º 14
0
def _setup_cloudbiolinux_fabric_properties(env, options):
    fabricrc_file = get_main_options_string(options, "fabricrc_file", None)
    if fabricrc_file:
        env.update(load_settings(fabricrc_file))
    else:
        # Let cloudbiolinux find out default file based on flavor, dist, etc...
        _parse_fabricrc(env)
    overrides = options.get("fabricrc_overrides", {})
    for key, value in overrides.iteritems():
        # yaml parses bools, wouldn't be expected coming out of a fabricrc
        # file so replace everything with a string.
        if isinstance(value, bool):
            overrides[key] = str(value)
    env.update(overrides)
    _setup_galaxy_env_defaults(env)
Ejemplo n.º 15
0
Archivo: main.py Proyecto: Atheuz/PTRW
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('files', metavar='f', type=str, nargs='*',
                        help='Set file or directory of files to push to watch.')
    args = parser.parse_args()

    env.rcfile = "fabricrc"
    env.update(load_settings(env.rcfile))

    if not os.path.isdir("watch"):
        os.mkdir("watch")
    if not os.path.isdir("archive"):
        os.mkdir("archive")
    
    if args.files:
        run(files=args.files)
    else:
        run()
Ejemplo n.º 16
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        'files',
        metavar='f',
        type=str,
        nargs='*',
        help='Set file or directory of files to push to watch.')
    args = parser.parse_args()

    env.rcfile = "fabricrc"
    env.update(load_settings(env.rcfile))

    if not os.path.isdir("watch"):
        os.mkdir("watch")
    if not os.path.isdir("archive"):
        os.mkdir("archive")

    if args.files:
        run(files=args.files)
    else:
        run()
Ejemplo n.º 17
0
import time, re, tempfile
from os import path, unlink
import logging

from fabric.api import local, env, put, run
from fabric.main import load_settings
from android.build import AndroidProject, get_platform, ProgramFailedError


settings = load_settings(".fabricrc")
if not settings:
    raise RuntimeError(".fabricrc is needed")
env.update(settings)
env.hosts = [env.deploy_host]


logging.getLogger("py-androidbuild").addHandler(logging.StreamHandler())


def locales():
    local("tx pull -a")
    # Workaround for Android not supporting this language (no ISO-639-2 support?)
    local("rm locale/*-ast.po")


def _make_market_manifest(manifest):
    """Stupid Android Market fails with mysterious error message
    ('cannot process apk' or something of the like) if the manifest
    contains empty uses-configuration and uses-feature tags.
    Amazon market fails if they do NOT exist.
    """
Ejemplo n.º 18
0
from fabric.api import *
from fabric.contrib.files import sed
from fabric.operations import put, run
from fabric.main import load_settings
import os

env.conf = 'fabfile.conf'

settings = load_settings(env.conf)
if not settings:
    raise RuntimeError("Configuration file {0} is needed!".format(env.conf))
env.update(settings)

env.hosts = [env.host_name]

if env.http_port is '80':
    http = ''
else:
    http = ':'+env.http_port
if env.https_port is '443':
    https = ''
else:
    https = ':'+env.http_port
env.ports = [http, https]

env.db_inst_dir = os.path.join(env.indico_inst_dir, env.db_inst_dirname)
env.indico_conf_dir = os.path.join(env.indico_inst_dir, env.indico_conf_dirname)

def _update_params(host_name=env.host_name, http_port=env.http_port, https_port=env.https_port,
                   ssl_pem_path=env.ssl_pem_path, ssl_key_path=env.ssl_key_path,
                   redis_pswd=env.redis_pswd, redis_port=env.redis_port):
Ejemplo n.º 19
0
import time, re, tempfile
from os import path, unlink
import logging

from fabric.api import local, env, put, run
from fabric.main import load_settings
from android.build import AndroidProject, get_platform, ProgramFailedError


settings = load_settings('.fabricrc')
if not settings:
    raise RuntimeError('.fabricrc is needed')
env.update(settings)
env.hosts = [env.deploy_host]


logging.getLogger('py-androidbuild').addHandler(logging.StreamHandler())


def locales():
    local('tx pull -a')
    # Workaround for Android not supporting this language (no ISO-639-2 support?)
    local('rm locale/*-ast.po')


def _make_market_manifest(manifest):
    """Stupid Android Market fails with mysterious error message
    ('cannot process apk' or something of the like) if the manifest
    contains empty uses-configuration and uses-feature tags.
    Amazon market fails if they do NOT exist.
    """
Ejemplo n.º 20
0
from os import path
from fabric.api import run, put, env, local
from fabric.main import load_settings
from fabric.contrib.project import rsync_project

env.app_dir = path.join(path.dirname(__file__), 'app')

# load rc file: https://github.com/fabric/fabric/pull/586
settings = load_settings('.fabricrc')
if not settings:
    raise RuntimeError('.fabricrc is needed')
env.update(settings)
env.hosts = [env.deploy_host]


def assets():
    local('webassets -c assets.yml build --production')


def deploy():
    assets()

    rsync_project(local_dir=env.app_dir + path.sep,
                  remote_dir=env.target_path,
                  exclude=['.*', '/js', '/css'])
Ejemplo n.º 21
0
def initialize_env(path):
    '''use the given file to set user's defined env.'''

    settings = load_settings(path)
    env.update(settings)
Ejemplo n.º 22
0
from fabric.main import load_settings
from fabric.operations import local
from fabric.utils import puts
from contextlib import contextmanager as _contextmanager
import sys

env.localfolder = os.path.realpath(os.path.dirname(__file__))
env.port = 22
if not env.get('NAME'):
	default_project_name = os.path.split(os.path.dirname(__file__))[1]
	settings_file = 'fab_%s.ini' % default_project_name
	if not os.path.isfile(settings_file):
		print "Cannot find setting file on %s create one or ovveride it calling `fab -c host.ini`." % settings_file
		sys.exit(1)
	print "Loading settings from %s." % settings_file
	env.update(load_settings(settings_file))

if not env.get('PROCESS_NAME'):
	env.PROCESS_NAME = 'gunicorn-%s' % env.NAME

env.USE_SOUTH = env.get('USE_SOUTH') != 'False'

if os.path.exists(os.path.expanduser("~/.ssh/config")):
	env.use_ssh_config = True

DO_REQUIREMENTS = False


def perform_env_substitutions():
	""" Do recursive substitution until the value doesn't change
	Change the type of some env variable that should not be string
Ejemplo n.º 23
0
def initialize_env(path):

    '''use the given file to set user's defined env.'''

    settings = load_settings(path)
    env.update(settings)