Exemplo n.º 1
0
def copy_downloads(app, pattern='*'):
    dl_dir = app.src.joinpath(app.name, 'static', 'download')
    require.files.directory(dl_dir, use_sudo=True, mode="777")
    local_dl_dir = data_file(import_module(app.name), '..', app.name, 'static', 'download')
    for f in local_dl_dir.files(pattern):
        target = dl_dir.joinpath(f.basename())
        create_file_as_root(target, open(f).read())
        sudo('chown %s:%s %s' % (app.name, app.name, target))
    require.files.directory(dl_dir, use_sudo=True, mode="755")
Exemplo n.º 2
0
def copy_files(app):
    data_dir = data_file(import_module(app.name))
    tarball = '/tmp/%s-files.tgz' % app.name
    local('tar -C %s -czf %s files' % (data_dir, tarball))
    require.files.file(tarball, source=tarball)
    if os.path.exists(tarball):
        os.remove(tarball)  # pragma: no cover
    with cd('/tmp'):
        tarfile = tarball.split('/')[2]
        sudo('tar -xzf %s' % tarfile)
        target = app.www.joinpath('files')
        if exists(target):
            sudo('cp -ru files/* %s' % target)
            sudo('rm -rf files')
        else:
            sudo('mv files %s' % app.www)  # pragma: no cover
        sudo('chown -R root:root %s' % target)
        sudo('rm %s' % tarfile)
        sudo('tree %s' % app.www)
Exemplo n.º 3
0
def copy_files(app):
    data_dir = data_file(import_module(app.name))
    tarball = '/tmp/%s-files.tgz' % app.name
    local('tar -C %s -czf %s files' % (data_dir, tarball))
    require.files.file(tarball, source=tarball)
    if os.path.exists(tarball):
        os.remove(tarball)
    with cd('/tmp'):
        tarfile = tarball.split('/')[2]
        sudo('tar -xzf %s' % tarfile)
        target = app.www.joinpath('files')
        if exists(target):
            sudo('cp -ru files/* %s' % target)
            sudo('rm -rf files')
        else:
            sudo('mv files %s' % app.www)
        sudo('chown -R root:root %s' % target)
        sudo('rm %s' % tarfile)
        sudo('tree %s' % app.www)
Exemplo n.º 4
0
def test_data_file():
    from clld.scripts.util import data_file

    assert data_file(clld, 'util.py').stem == 'util'
Exemplo n.º 5
0
    def test_data_file(self):
        from clld.scripts.util import data_file

        self.assertEquals(data_file(clld, 'util.py').stem, 'util')
Exemplo n.º 6
0
def test_data_file():
    from clld.scripts.util import data_file

    assert data_file(clld, 'util.py').stem == 'util'
Exemplo n.º 7
0
    def test_data_file(self):
        from clld.scripts.util import data_file

        self.assertEquals(data_file(clld, 'util.py').stem, 'util')