lib.sh 1.16 KB
Newer Older
Jamesie Pic's avatar
Jamesie Pic committed
1 2 3 4
if [ -n "$OPENSHIFT_HOMEDIR" ]; then
    source ${OPENSHIFT_HOMEDIR}app-root/runtime/dependencies/python/virtenv/bin/activate
fi

Nicolas Joyard's avatar
Nicolas Joyard committed
5
function parltrack_download_pipe() {
Jamesie Pic's avatar
Jamesie Pic committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
    if [ -n "$OPENSHIFT_DATA_DIR" ]; then
        cd $OPENSHIFT_DATA_DIR
    fi

    [ -n "$CLEAN" ] && rm -rf $1
    [ -f "$1" ] || wget http://parltrack.euwiki.org/dumps/$1 || exit 1

    if [ -n "$OPENSHIFT_REPO_DIR" ]; then
        cd $OPENSHIFT_REPO_DIR
    fi

    export DJANGO_SETTINGS_MODULE=memopol.settings
    unxz -c ${OPENSHIFT_DATA_DIR}$1 | $2
    [ -n "$CLEAN" ] && rm -rf $1
}
Nicolas Joyard's avatar
Nicolas Joyard committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

function francedata_download_pipe() {
    if [ -n "$OPENSHIFT_DATA_DIR" ]; then
        cd $OPENSHIFT_DATA_DIR
    fi

    [ -n "$CLEAN" ] && rm -rf $1
    [ -f "$1" ] || wget https://francedata-njoyard.rhcloud.com/$1 || exit 1

    if [ -n "$OPENSHIFT_REPO_DIR" ]; then
        cd $OPENSHIFT_REPO_DIR
    fi

    export DJANGO_SETTINGS_MODULE=memopol.settings
    gunzip -c ${OPENSHIFT_DATA_DIR}$1 | $2
    [ -n "$CLEAN" ] && rm -rf $1
}
38 39 40 41 42 43 44

function refresh_scores() {
    if [ -n "$OPENSHIFT_REPO_DIR" ]; then
        cd $OPENSHIFT_REPO_DIR
    fi

    export DJANGO_SETTINGS_MODULE=memopol.settings
Nicolas Joyard's avatar
Nicolas Joyard committed
45
    memopol refresh_scores
46
}