Ejemplo n.º 1
0
def build_venv(name):
    old_build_name = env.get('build_name')
    env['build_name'] = name
    build_dir = "/code/deploy/builds/%s" % name
    with cd("%s" % build_dir):
        docker_exec("[ -f bin/pip ] || virtualenv . --never-download")
        with path(os.path.join(build_dir, 'bin'), behavior='prepend'):
            yield
    env['build_name'] = old_build_name
Ejemplo n.º 2
0
def build_venv(name):
    old_build_name = env.get('build_name')
    env['build_name'] = name
    build_dir = "/code/deploy/builds/%s" % name
    with cd("%s" % build_dir):
        docker_exec("[ -f bin/pip ] || virtualenv . --never-download")
        with path(os.path.join(build_dir, 'bin'), behavior='prepend'):
            yield
    env['build_name'] = old_build_name
Ejemplo n.º 3
0
def perl():
    if not dir_exists("~/.plenv"):
        run("git clone https://github.com/tokuhirom/plenv.git ~/.plenv/")
        run("git clone https://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/")
    with path("~/.plenv/bin:~/.plenv/shims"):
        run("eval '$(plenv init -)'")
        run("plenv install 5.18.1")
        run("plenv global 5.18.1")
        run("PLENV_INSTALL_CPANM='-v' plenv install-cpanm")
        run("cpanm --self-upgrade")
Ejemplo n.º 4
0
def install_data(config_source):
    """Main entry point for installing useful biological data.
    """
    _check_version()
    # Append a potentially custom system install path to PATH so tools are found
    with path(os.path.join(env.system_install, 'bin')):
        genomes, genome_indexes, config = _get_genomes(config_source)
        genome_indexes += [x for x in DEFAULT_GENOME_INDEXES if x not in genome_indexes]
        _data_ngs_genomes(genomes, genome_indexes)
        _install_additional_data(genomes, genome_indexes, config)
Ejemplo n.º 5
0
def install_data(config_source):
    """Main entry point for installing useful biological data.
    """
    _check_version()
    # Append a potentially custom system install path to PATH so tools are found
    with path(os.path.join(env.system_install, 'bin')):
        genomes, genome_indexes, config = _get_genomes(config_source)
        genome_indexes += DEFAULT_GENOME_INDEXES
        _data_ngs_genomes(genomes, genome_indexes)
        _install_additional_data(genomes, genome_indexes, config)
Ejemplo n.º 6
0
def deploy_web():
    version = build_web()
    tarball = "stiny-%s.tar.gz" % version
    fab.put("dist/" + tarball)
    fab.sudo("if [ ! -e {0} ]; then virtualenv {0}; fi"
             .format(CONSTANTS['venv']))
    with path(CONSTANTS['venv'] + '/bin', behavior='prepend'):
        fab.sudo("yes | pip uninstall stiny || true")
        fab.sudo("pip install pastescript")
        fab.sudo("pip install %s" % tarball)
    _render_put('prod.ini.tmpl', '/etc/emperor/stiny.ini', use_sudo=True)
Ejemplo n.º 7
0
def install_data(config_source=CONFIG_FILE, do_setup_environment=True):
    """Main entry point for installing useful biological data.
    """
    _check_version()
    if do_setup_environment:
        setup_environment()
    # Append a potentially custom system install path to PATH so tools are found
    with path(os.path.join(env.system_install, 'bin')):
        genomes, genome_indexes, config = _get_genomes(config_source)
        _data_ngs_genomes(genomes, genome_indexes + DEFAULT_GENOME_INDEXES)
        _install_additional_data(genomes, config)
Ejemplo n.º 8
0
def local_makemessages():
    """第一次自己在locale下手动建立需要翻译的目录"""
    with path(
            '/usr/local/opt/gettext/bin'):  # OS X下brew install gettext 需手动path
        local_workon(
            'python manage.py makemessages -l en --ignore={}/templates/registration/* --no-wrap'
            .format(env.project_name))


#         local_workon('python manage.py makemessages -d djangojs --no-wrap')
    puts(green('完成, 请用rosetta翻译英文然后执行tx_sync'))
Ejemplo n.º 9
0
def build_rpi_gpio_wheel():
    gpio_wheel = 'RPi.GPIO-0.6.2-cp27-cp27mu-linux_armv6l.whl'
    fab.local('mkdir -p pex_wheels')
    # Generate the RPI.GPIO wheel on the raspberry pi
    fab.run('rm -rf /tmp/gpiobuild')
    fab.run('mkdir -p /tmp/gpiobuild')
    with fab.cd('/tmp/gpiobuild'):
        fab.run('virtualenv venv')
        with path('/tmp/gpiobuild/venv/bin', behavior='prepend'):
            fab.run('pip install wheel')
            fab.run('pip wheel RPi.GPIO==0.6.2 --wheel-dir=/tmp/gpiobuild')
            fab.get(gpio_wheel, os.path.join('pex_wheels', gpio_wheel))
    fab.run('rm -rf /tmp/gpiobuild')
Ejemplo n.º 10
0
    def run(self, dest=None, verbose='n', **options):
        self.options.update(options)
        if dest is not None:
            self.dest = dest
        verbose = verbose.lower().strip().startswith('y')

        files = self.get_files()
        if verbose is True:
            print(green('Minifying files:'))
            for filename in files:
                print('  %s' % filename)

        node_path = os.path.join(os.getcwd(), 'node_modules', '.bin')
        with path(node_path):
            self.minify(files, self.dest)
Ejemplo n.º 11
0
    def run(self, dest=None, verbose='n', **options):
        self.options.update(options)
        if dest is not None:
            self.dest = dest
        verbose = verbose.lower().strip().startswith('y')

        files = self.get_files()
        if verbose is True:
            print(green('Minifying files:'))
            for filename in files:
                print('  %s' % filename)

        node_path = os.path.join(os.getcwd(), 'node_modules', '.bin')
        with path(node_path):
            self.minify(files, self.dest)
Ejemplo n.º 12
0
    def run(self):
        with settings(warn_only=True):
            if self.extra_path() != "":
                with path(self.extra_path()):
                    with shell_env(**self.shell_env()):
                        self.pre_action()
                        result = self.run_command()
                        self.post_action(result)
            else:
                with shell_env(**self.env):
                    self.pre_action()
                    result = self.run_command()
                    self.post_action(result)

        return result
Ejemplo n.º 13
0
def deploy():
    """ Deploy the website """
    version = bundle()
    tarball = "stevetags-%s.tar.gz" % version
    fab.put("dist/" + tarball)

    with path(CONSTANTS['venv'] + '/bin', behavior='prepend'):
        fab.sudo("yes | pip uninstall stevetags || true")
        fab.sudo("pip install %s" % tarball)
        fab.sudo('st-deploy /var/nginx/stevetags/%s' %
                 CONSTANTS['asset_prefix'])
    _render_put('etc/stevetags.ini', '/etc/emperor/stevetags.ini',
                use_sudo=True)
    fab.run("rm " + tarball)
    print green("Deployed stevetags %s" % version)
Ejemplo n.º 14
0
def install_data(config_source, approaches=None):
    """Main entry point for installing useful biological data.
    """
    PREP_FNS = {"s3": _download_s3_index,
                "raw": _prep_raw_index}
    if approaches is None: approaches = ["raw"]
    ready_approaches = []
    for approach in approaches:
        ready_approaches.append((approach, PREP_FNS[approach]))
    _check_version()
    # Append a potentially custom system install path to PATH so tools are found
    with path(os.path.join(env.system_install, 'bin')):
        genomes, genome_indexes, config = _get_genomes(config_source)
        genome_indexes += [x for x in DEFAULT_GENOME_INDEXES if x not in genome_indexes]
        _prep_genomes(env, genomes, genome_indexes, ready_approaches)
        _install_additional_data(genomes, genome_indexes, config)
Ejemplo n.º 15
0
def deploy():
    global commitMsg
    commitMsg = raw_input("请输入此次commit: ")
    gitCommit()

    with cd(workDir):
        with path(PATH):
            with prefix("export GOPATH=/root/dev/gopath"):
                run("git reset --hard")
                run("go get github.com/smartwalle/alipay")
                run("go get github.com/satori/go.uuid")
                run("git pull")
                run("go build")
                run("cp /root/dev/gopath/src/memplus.conf %s/conf/app.conf" %
                    workDir)
                run("supervisorctl restart memoryplus")
Ejemplo n.º 16
0
def install_data(config_source, approaches=None):
    """Main entry point for installing useful biological data.
    """
    PREP_FNS = {"s3": _download_s3_index,
                "raw": _prep_raw_index}
    if approaches is None: approaches = ["raw"]
    ready_approaches = []
    for approach in approaches:
        ready_approaches.append((approach, PREP_FNS[approach]))
    _check_version()
    # Append a potentially custom system install path to PATH so tools are found
    with path(os.path.join(env.system_install, 'bin')):
        genomes, genome_indexes, config = _get_genomes(config_source)
        genome_indexes += [x for x in DEFAULT_GENOME_INDEXES if x not in genome_indexes]
        _prep_genomes(env, genomes, genome_indexes, ready_approaches)
        _install_additional_data(genomes, genome_indexes, config)
Ejemplo n.º 17
0
def source_to_binary(source_file):
    """Upload source code, build it, and return the path to the binary."""
    sandbox_dir = '/home/{}'.format(CABAL_USER)
    [remote_path] = list(put(source_file, '/tmp/'))
    with cd(sandbox_dir):
        with settings(sudo_user=CABAL_USER,
                      sudo_prefix="sudo -S -i -p '{}'".format(
                          env.sudo_prompt)):
            with path(CABAL_PATH, behavior='prepend'):
                deps = upload_source_deps(SOURCE_DEPENDENCIES, sandbox_dir)
                sudo('tar -xf {}'.format(remote_path))
                sudo('cabal sandbox init --sandbox .')
                for src_dir in deps:
                    sudo('cabal sandbox add-source {}'.format(src_dir))
                src_dir = tarball_directory(source_file)
                with cd(src_dir):
                    sudo('cabal sandbox init --sandbox {}'.format(sandbox_dir))
                    sudo('cabal install --dependencies-only')
                    sudo('cabal build')
    return '/home/{}/{}'.format(CABAL_USER, src_dir)
Ejemplo n.º 18
0
def manage(cmd, options=""):
    with path(env.bin_dir, "prepend"):
        run("%s/bin/python ~/webapps/%s/src/manage.py %s --settings=%s %s" % (env.virtualenv, env.app_name,cmd,env.settings_module, options))
Ejemplo n.º 19
0
 def test_use_of_path_appends_by_default(self):
     """
     'with path' appends by default
     """
     with path('foo'):
         eq_(self.via_local(), self.real + ":foo")
Ejemplo n.º 20
0
 def test_use_of_path_appends_by_default(self):
     """
     'with path' appends by default
     """
     with path('foo'):
         eq_(self.via_local(), self.real + ":foo")
Ejemplo n.º 21
0
def workon(settings_module='noripyt.settings.production'):
    with cd(str(PROJECT_PATH)):
        with path(str(VIRTUALENV_PATH / 'bin'), behavior='prepend'):
            with shell_env(DJANGO_SETTINGS_MODULE=settings_module):
                yield
Ejemplo n.º 22
0
 def wrapped():
     node_path = os.path.join(os.getcwd(), 'node_modules', '.bin')
     with path(node_path):
         orig()
Ejemplo n.º 23
0
def workon_dezede(settings_module='dezede.settings.prod'):
    set_env()
    with cd(f'{env.project_path}'):
        with path(f"{env.virtual_env / 'bin'}", behavior='prepend'):
            with shell_env(DJANGO_SETTINGS_MODULE=settings_module):
                yield
Ejemplo n.º 24
0
 def run(self, cmd):
     wrapped = "junest -f {}".format(cmd)
     with path(self.junest_bin):
         run(wrapped)
Ejemplo n.º 25
0
def local_makemessages():
    """第一次自己在locale下手动建立需要翻译的目录"""
    with path('/usr/local/opt/gettext/bin'):  # OS X下brew install gettext 需手动path
        local_workon('python manage.py makemessages -l en --ignore={}/templates/registration/* --no-wrap'.format(env.project_name))
#         local_workon('python manage.py makemessages -d djangojs --no-wrap')
    puts(green('完成, 请用rosetta翻译英文然后执行tx_sync'))
Ejemplo n.º 26
0
 def wrapped():
     node_path = os.path.join(os.getcwd(), 'node_modules', '.bin')
     with path(node_path):
         orig()
Ejemplo n.º 27
0
def workon_dezede(settings_module='dezede.settings.prod'):
    set_env()
    with cd(f'{env.project_path}'):
        with path(f"{env.virtual_env / 'bin'}", behavior='prepend'):
            with shell_env(DJANGO_SETTINGS_MODULE=settings_module):
                yield
Ejemplo n.º 28
0
def local_compilemessages():
    """编译语言文件"""
    with path('/usr/local/opt/gettext/bin'):
        local_workon('python manage.py compilemessages')
Ejemplo n.º 29
0
def local_compilemessages():
    """编译语言文件"""
    with path('/usr/local/opt/gettext/bin'):
        local_workon('python manage.py compilemessages')
Ejemplo n.º 30
0
def _update_nodeenv(venv, nodeenv, source_path):
	if not exists(nodeenv + "/bin/npm"):
		sudo("%s/bin/nodeenv %s" % (venv, nodeenv), user="******")

	with path(nodeenv + "/bin", "prepend"):
		sudo("npm -C %s install --no-progress --production" % (source_path), user="******")
Ejemplo n.º 31
0
def _update_bundles(venv, nodeenv, source_path):
	with path("%s/bin:%s/bin" % (nodeenv, venv), "prepend"):
		sudo("npm -C %s run build" % (source_path), user="******")