aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: 91a1874c817af4748abe78d41e3caf75133efe31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh

set -e

mkdir_if_missing() {
    test -d "$1" || mkdir -p "$1"
}

setup_directories() {
    mkdir_if_missing images/previews
    mkdir_if_missing ratatoeskr/plugin_extradata/public
    mkdir_if_missing ratatoeskr/templates/src/plugintemplates
    mkdir_if_missing ratatoeskr/templates/transc
}

install_dependencies() {
    composer install
}

setup_dev_environment() {
    setup_directories
    install_dependencies
}

create_release_package() {
    git archive --format=tar -o r7r.tar master
    mkdir -p package/Ratatoeskr
    mv r7r.tar package/Ratatoeskr

    cd package/Ratatoeskr
    tar xf r7r.tar
    rm r7r.tar

    setup_directories
    install_dependencies

    cd ..

    zip -r Ratatoeskr.zip Ratatoeskr
}

case "$1" in
setup_directories)
    setup_directories
    ;;
install_dependencies)
    install_dependencies
    ;;
setup_dev_environment)
    setup_dev_environment
    ;;
create_release_package)
    create_release_package
    ;;
*)
    {
        echo "usage: $0 mode"
        echo ""
        echo "where mode is one of:"
        echo "- setup_directories"
        echo "- install_dependencies"
        echo "- setup_dev_environment"
        echo "- create_release_package"
    } >&2
    exit 1
    ;;
esac