summaryrefslogtreecommitdiff
path: root/bin/thomas
blob: 4d23529c317101dbdd301ae17bf85dd4a91b7df1 (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
#!/bin/bash

FILE=$1
OUTPUT_FOLDER=output

install_mo() {
    local confirm
    if ! command -v "bin/mo" 2>&1 > /dev/null; then
        read -p "You don't have mo installed. Install? (Y/n) " -n 1 -r confirm
        case $confirm in
            [yY])
                curl -s https://raw.githubusercontent.com/tests-always-included/mo/master/mo > bin/mo
                chmod +x bin/mo
                ;;
            *)
                exit 1
                ;;
        esac
    fi
}

build(){
    mkdir -p $OUTPUT_FOLDER
    source thomas.env && cat templates/$FILE | bin/mo > $OUTPUT_FOLDER/$FILE
}

install_mo
build

echo $OUTPUT_FOLDER/$FILE