forked from Call-for-Code-for-Racial-Justice/Legit-Info
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfpush
executable file
·36 lines (36 loc) · 1.63 KB
/
cfpush
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
#!/bin/bash
mode="$1"
help1="Usage: \t cfpush <mod> \t\t\t Build using manifest.<mod>"
help2=" \t cfpush clear \t\t Clear cache on IBM Cloud Foundry"
help3=" \t cfpush -h, --help \t Display these messages"
if [[ "$#" == 0 || "$mode" == "-h" || "$mode" == "--help" || "$mode" == "yml" ]] ; then
echo " "
echo -e $help1
echo -e $help2
echo -e $help3
echo " "
echo "Here are all of the manifest files available:"
ls manifest.*
exit 4;
elif [[ "$mode" == "null" ]] ; then
outfile="cfpush-null.out"
echo -e "Wiping out cache by installing: null-buildback" | tee $outfile
echo -e "Copying manifest.null to manifest.yml" | tee $outfile
cp manifest.null manifest.yml
echo -e "Copying Procfile.null to Procfile" | tee $outfile
cp Procfile.null Procfile
ibmcloud cf v3-push -b https://github.com/tonypearson/null-buildpack.git legit_info 2>&1 | tee -a $outfile
ibmcloud cf delete-route us-east.mybluemix.net --hostname legit_info -f 2>&1 | tee -a $outfile
ibmcloud cf logs legit_info --recent 2>&1 | tee -a $outfile
echo "All messages written to: " $outfile
elif [[ "$mode" != "yml" ]]; then
outfile="cfpush-$mode.out"
echo -e "Copying manifest.$mode to manifest.yml" | tee $outfile
cp "manifest.$mode" manifest.yml
echo -e "Copying Procfile.$mode to Procfile" | tee $outfile
cp "Procfile.$mode" Procfile
echo -e "Using Python level:\t" `cat runtime.txt` | tee -a $outfile
ibmcloud cf v3-push "legit_info_$mode" 2>&1 | tee -a $outfile
ibmcloud cf logs "legit_info_$mode" --recent 2>&1 | tee -a $outfile
echo "All messages written to: " $outfile
fi