summarylogtreecommitdiffstats
path: root/PUBLISH
blob: f5a320efff59291c890eb92217aea93f24c087d8 (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
#! /bin/bash
#  (GPL3+) Alberto Salvia Novella (es20490446e.wordpress.com)


mainFunction () {
	summary=$(summary "${1}")

	updateInfoFile
	publish "${summary}"
}


changeToThisProgramDir () {
	cd "$( dirname "${BASH_SOURCE[0]}" )"
}


echoOnError () {
	function="${1}"
	command="${2}"
    error=$(eval "${command}" 2>&1 >"/dev/null")

    if [ ${?} -ne 0 ]; then
        echo "${function}: ${error}" >&2
        exit 1
    fi
}


publish () {
	summary="${1}"

	echoOnError "publish: add" "git add ."
	echoOnError "publish: commit" "git commit --message=\"${summary}\""
	echoOnError "publish: push" "git push"
}


summary () {
	summary="${1}"

    if [ "${summary}" == "" ]; then
        echo $(date "+%Y-%m-%d %s")
    fi
}


updateInfoFile () {
	echoOnError "updateInfoFile" "makepkg --printsrcinfo > .SRCINFO"
}


changeToThisProgramDir
mainFunction ${@}