Ejemplo n.º 1
0
def app(pytestconfig):
    src = DEFAULT_DATA_DIR
    if pytestconfig.getoption('all_data'):
        yield create_app(db_uri='sqlite://', datadir=src, echo=False)
    else:
        with tempfile.TemporaryDirectory() as tempdir:
            for name in """
                    ostrava/2014-08-07.yaml
                    ostrava/2014-10-02-balis-balim-balime.yaml
                    ostrava/2014-11-06-testovaci.yaml
                    ostrava/2013-11-07-prvni.yaml
                    ostrava/2013-12-04-druhe.yaml
                    brno/2014-07-31-bitva-tri-cisaru.yaml
                    brno/2013-05-30-gui.yaml
                    brno/2015-02-26-dokumentacni.yaml
                    brno/2014-02-27-vyjezdove.yaml
                    praha/2015-05-20-anniversary.yaml
                    praha/2015-03-18-zase-docker.yaml
                    praha/2011-01-17.yaml
                    praha/2015-04-15.yaml
                    """.splitlines():
                name = name.strip()
                if name:
                    try:
                        os.mkdir(os.path.dirname(os.path.join(tempdir, name)))
                    except FileExistsError:
                        pass
                    shutil.copyfile(
                        os.path.join(src, name),
                        os.path.join(tempdir, name),
                    )
            yield create_app(db_uri='sqlite://', datadir=tempdir, echo=False)
Ejemplo n.º 2
0
def app(pytestconfig):
    src = DEFAULT_DATA_DIR
    if pytestconfig.getoption('all_data'):
        yield create_app(db_uri='sqlite://', datadir=src, echo=False)
    else:
        with tempfile.TemporaryDirectory() as tempdir:
            for name in """
                    meta.yaml
                    series/ostrava-pyvo/series.yaml
                    series/ostrava-pyvo/events/2014-08-07.yaml
                    series/ostrava-pyvo/events/2014-10-02-balis-balim-balime.yaml
                    series/ostrava-pyvo/events/2014-11-06-testovaci.yaml
                    series/ostrava-pyvo/events/2013-11-07-prvni.yaml
                    series/ostrava-pyvo/events/2013-12-04-druhe.yaml
                    series/brno-pyvo/series.yaml
                    series/brno-pyvo/events/2014-07-31-bitva-tri-cisaru.yaml
                    series/brno-pyvo/events/2013-05-30-gui.yaml
                    series/brno-pyvo/events/2015-02-26-dokumentacni.yaml
                    series/brno-pyvo/events/2014-02-27-vyjezdove.yaml
                    series/brno-pyvo/events/2012-11-29-cli.yaml
                    series/praha-pyvo/series.yaml
                    series/praha-pyvo/events/2015-05-20-anniversary.yaml
                    series/praha-pyvo/events/2015-03-18-zase-docker.yaml
                    series/praha-pyvo/events/2011-01-17.yaml
                    series/praha-pyvo/events/2015-04-15.yaml
                    cities/brno/city.yaml
                    cities/brno/venues/u-dreveneho-orla.yaml
                    cities/brno/venues/u-drevaka.yaml
                    cities/brno/venues/hlavni-nadrazi.yaml
                    cities/praha/city.yaml
                    cities/praha/venues/konvikt.yaml
                    cities/praha/venues/na-venecku.yaml
                    cities/ostrava/city.yaml
                    cities/ostrava/venues/ires-sc.yaml
                    cities/ostrava/venues/sport-club.yaml
                    cities/ostrava/venues/vr-levsky.yaml
                    """.splitlines():
                name = name.strip()
                if name:
                    try:
                        os.makedirs(
                            os.path.dirname(os.path.join(tempdir, name)))
                    except FileExistsError:
                        pass
                    shutil.copyfile(
                        os.path.join(src, name),
                        os.path.join(tempdir, name),
                    )
            yield create_app(db_uri='sqlite://', datadir=tempdir, echo=False)
Ejemplo n.º 3
0
def app(pytestconfig):
    src = DEFAULT_DATA_DIR
    if pytestconfig.getoption('all_data'):
        yield create_app(db_uri='sqlite://', datadir=src, echo=False)
    else:
        with tempfile.TemporaryDirectory() as tempdir:
            for name in """
                    meta.yaml
                    series/ostrava-pyvo/series.yaml
                    series/ostrava-pyvo/events/2014-08-07.yaml
                    series/ostrava-pyvo/events/2014-10-02-balis-balim-balime.yaml
                    series/ostrava-pyvo/events/2014-11-06-testovaci.yaml
                    series/ostrava-pyvo/events/2013-11-07-prvni.yaml
                    series/ostrava-pyvo/events/2013-12-04-druhe.yaml
                    series/brno-pyvo/series.yaml
                    series/brno-pyvo/events/2014-07-31-bitva-tri-cisaru.yaml
                    series/brno-pyvo/events/2013-05-30-gui.yaml
                    series/brno-pyvo/events/2015-02-26-dokumentacni.yaml
                    series/brno-pyvo/events/2014-02-27-vyjezdove.yaml
                    series/brno-pyvo/events/2012-11-29-cli.yaml
                    series/praha-pyvo/series.yaml
                    series/praha-pyvo/events/2015-05-20-anniversary.yaml
                    series/praha-pyvo/events/2015-03-18-zase-docker.yaml
                    series/praha-pyvo/events/2011-01-17.yaml
                    series/praha-pyvo/events/2015-04-15.yaml
                    cities/brno/city.yaml
                    cities/brno/venues/u-dreveneho-orla.yaml
                    cities/brno/venues/u-drevaka.yaml
                    cities/brno/venues/hlavni-nadrazi.yaml
                    cities/praha/city.yaml
                    cities/praha/venues/konvikt.yaml
                    cities/praha/venues/na-venecku.yaml
                    cities/ostrava/city.yaml
                    cities/ostrava/venues/ires-sc.yaml
                    cities/ostrava/venues/sport-club.yaml
                    cities/ostrava/venues/vr-levsky.yaml
                    """.splitlines():
                name = name.strip()
                if name:
                    try:
                        os.makedirs(os.path.dirname(os.path.join(tempdir, name)))
                    except FileExistsError:
                        pass
                    shutil.copyfile(
                        os.path.join(src, name),
                        os.path.join(tempdir, name),
                    )
            yield create_app(db_uri='sqlite://', datadir=tempdir, echo=False)
Ejemplo n.º 4
0
import os
import subprocess

import docopt

from pyvocz.app import create_app, DEFAULT_DATA_DIR

arguments = docopt.docopt(__doc__)

db_uri = arguments['--db'] or 'sqlite://'
datadir = arguments['--data'] or DEFAULT_DATA_DIR
pull_password = arguments['--pull-password']
port = int(arguments['--port'] or 5000)
host = arguments['--host']

app = create_app(db_uri=db_uri,
                 datadir=datadir,
                 pull_password=pull_password,
                 host=host,
                 port=port)

if not os.path.exists(datadir):
    subprocess.check_call(
        ['git', 'clone', 'https://github.com/pyvec/pyvo-data', datadir])

if arguments['--debug']:
    app.run(debug=True, host=host, port=port)
else:
    app.run(debug=False, host=host or '0.0.0.0', port=port)
Ejemplo n.º 5
0
"""

import os
import subprocess

import docopt

from pyvocz.app import create_app, DEFAULT_DATA_DIR


arguments = docopt.docopt(__doc__)


db_uri = arguments['--db'] or 'sqlite://'
datadir = arguments['--data'] or DEFAULT_DATA_DIR
pull_password = arguments['--pull-password']
port = int(arguments['--port'] or 5000)
host = arguments['--host']

app = create_app(db_uri=db_uri, datadir=datadir, pull_password=pull_password,
                 host=host, port=port)

if not os.path.exists(datadir):
    subprocess.check_call(['git', 'clone',
                           'https://github.com/pyvec/pyvo-data', datadir])

if arguments['--debug']:
    app.run(debug=True, host=host, port=port)
else:
    app.run(debug=False, host=host or '0.0.0.0', port=port)
Ejemplo n.º 6
0
  --pull-password=PWD
                Password for Git pull webhook

If the data directory does not exists, clones a default repo into it.
"""

import os
import subprocess

import docopt

from pyvocz.app import create_app, DEFAULT_DATA_DIR


arguments = docopt.docopt(__doc__)


db_uri = arguments['--db'] or 'sqlite://'
datadir = arguments['--data'] or DEFAULT_DATA_DIR
pull_password = arguments['--pull-password']
app = create_app(db_uri=db_uri, datadir=datadir, pull_password=pull_password)

if not os.path.exists(datadir):
    subprocess.check_call(['git', 'clone',
                           'https://github.com/pyvec/pyvo-data', datadir])

if arguments['--debug']:
    app.run(debug=True)
else:
    app.run(debug=False, host='0.0.0.0')
Ejemplo n.º 7
0
- If automated tweets of events are desired, set up pyvo-twitter according to
  https://github.com/pyvec/pyvo-twitter.

"""

import logging

from pyvocz.app import create_app

logging.basicConfig(level=logging.INFO)

db = 'sqlite:////srv/app/db.sqlite'
datadir = 'pyvo-data'
host = 'pyvo.cz'
port = 80

try:
    password_file = open('pull_password')
except FileNotFoundError:
    pull_password = None
else:
    with password_file:
        pull_password = password_file.read().strip()

application = create_app(db,
                         datadir=datadir,
                         echo=False,
                         pull_password=pull_password,
                         host=host,
                         port=port)
Ejemplo n.º 8
0
- Configure the Github hook for pyvec/pyvo-data to
  POST to pyvo.cz/api/reload_hook?password=YOUR_RANDOM_PASSWORD

"""

import logging

from pyvocz.app import create_app


logging.basicConfig(level=logging.INFO)

db = 'sqlite:////srv/app/db.sqlite'
datadir = 'pyvo-data'
host = 'pyvo.cz'
port = 80

try:
    password_file = open('pull_password')
except FileNotFoundError:
    pull_password = None
else:
    with password_file:
        pull_password = password_file.read().strip()


application = create_app(db, datadir=datadir, echo=False,
                         pull_password=pull_password,
                         host=host, port=port)
Ejemplo n.º 9
0
- Deploy:

        supervisorctl restart app

- Configure the Github hook for pyvec/pyvo-data to
  POST to pyvo.cz/api/reload_hook?password=YOUR_RANDOM_PASSWORD

"""

import logging

from pyvocz.app import create_app


logging.basicConfig(level=logging.INFO)

db = 'sqlite:////srv/app/db.sqlite'
datadir = 'pyvo-data'

try:
    password_file = open('pull_password')
except FileNotFoundError:
    pull_password = None
else:
    with password_file:
        pull_password = password_file.read().strip()


application = create_app(db, datadir=datadir, echo=False, pull_password=pull_password)