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
Exemple #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
Exemple #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")
Exemple #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)
Exemple #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)
Exemple #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)
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)
Exemple #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'))
Exemple #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')
    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)
    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)
Exemple #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
Exemple #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)
Exemple #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)
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")
Exemple #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)
Exemple #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)
Exemple #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))
Exemple #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")
 def test_use_of_path_appends_by_default(self):
     """
     'with path' appends by default
     """
     with path('foo'):
         eq_(self.via_local(), self.real + ":foo")
Exemple #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
 def wrapped():
     node_path = os.path.join(os.getcwd(), 'node_modules', '.bin')
     with path(node_path):
         orig()
Exemple #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
Exemple #24
0
 def run(self, cmd):
     wrapped = "junest -f {}".format(cmd)
     with path(self.junest_bin):
         run(wrapped)
Exemple #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'))
 def wrapped():
     node_path = os.path.join(os.getcwd(), 'node_modules', '.bin')
     with path(node_path):
         orig()
Exemple #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
Exemple #28
0
def local_compilemessages():
    """编译语言文件"""
    with path('/usr/local/opt/gettext/bin'):
        local_workon('python manage.py compilemessages')
Exemple #29
0
def local_compilemessages():
    """编译语言文件"""
    with path('/usr/local/opt/gettext/bin'):
        local_workon('python manage.py compilemessages')
Exemple #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="******")
Exemple #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="******")