]> git.immae.eu Git - github/fretlink/ansible-clever.git/blame - tests/fake.sh
Merge pull request #75 from paulrbr-fl/clever-restart-when-asked
[github/fretlink/ansible-clever.git] / tests / fake.sh
CommitLineData
c99eb178
PB
1#!/usr/bin/env bash
2
3binary="${0/*\/}"
783f91c2
CD
4localCommit="${PRETEND_LOCAL_COMMIT:-aaa000aaa000aaa000aaa000aaa000aaa000aaa0}"
5remoteCommit="${PRETEND_REMOTE_COMMIT:-bbb000bbb000bbb000bbb000bbb000bbb000bbb0}"
c3e2ff5e
PB
6uptodateDeployment="${DEPLOY_UP_TO_DATE_APP:-}"
7
8echo "${1}" >> "${binary}-commands"
c99eb178
PB
9
10if [ "${binary}" = "clever" ] && [ "${1}" = "--version" ]; then
b89d0540 11 echo "2.6.1"
c99eb178 12elif [ "${binary}" = "clever" ] && [ "${1}" = "activity" ]; then
783f91c2
CD
13 echo "2020-02-02T20:20:02+02:00 OK DEPLOY ${remoteCommit} Git"
14elif [ "${binary}" = "clever" ] && [ "${1}" = "status" ]; then
15 echo "test-app: running (1*pico, Commit: ${remoteCommit})"
c3e2ff5e
PB
16elif [ "${binary}" = "clever" ] && [ "${1}" = "deploy" ]; then
17 if [ -z "${uptodateDeployment}" ]; then
18 echo "Clever deploy done."
19 else
20 # Mimic the current behavior until https://github.com/CleverCloud/clever-tools/issues/422 is solved
21 >&2 echo "The clever-cloud application is up-to-date. Try this command to restart the application:"
22 >&2 echo " clever restart"
23 exit 1
24 fi
c99eb178 25elif [ "${binary}" = "git" ]; then
783f91c2 26 echo "${localCommit}"
c99eb178
PB
27else
28 echo "${binary} called with arguments: ${*}"
29fi