-
Notifications
You must be signed in to change notification settings - Fork 3
/
dashboard.sh
executable file
·81 lines (76 loc) · 2.72 KB
/
dashboard.sh
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
#
# Author Radoslaw Cieciwa <[email protected]>
#
# Entry point tool for dashboard.
#
export TICKETS_WORKSPACE_DIR="$BADOO_REPO_DIR"
export SOURCE_REPO_PATH="$BADOO_REPO_SRC"
function query_list_of_repos_by_coma() {
local LIST_OF_REPOS=`git -C $SOURCE_REPO_PATH worktree list | tail -n +2 | awk '{ print $1 }' | sed 's#.*/##' | awk 'ORS=","' | sed 's/\(.*\),/\1 /'`
echo $LIST_OF_REPOS
}
function query_list_of_repos() {
local LIST_OF_REPOS=`git -C $SOURCE_REPO_PATH worktree list | tail -n +2 | awk '{ print $1 }' | sed 's#.*/##'`
echo $LIST_OF_REPOS
}
function usage() {
echo "usage dashboard <command> [<args>]"
echo
echo "Most common usages"
echo "you can run this command from any directory"
echo
echo "controls the jira ticket (creates a new branch) lifecycle"
echo " boot runs aida process and enters the folder"
echo " delete cleans local branches and worktree copy"
echo " delete-batch cleans local branches and worktree copy for tickets by status"
echo " cleanup cleans done tickets by status ad removes derived data"
echo " copy"
echo
echo "view operations"
echo " view display list of tickets (require jira credentials and python)"
echo " open opens a directory with the script"
echo
echo "working helper (experimental)"
echo " boot-random creates a random branch where you can play around"
echo " patch-close creates a patch from all changes in top directory of branch and removes that branch"
echo
echo "review helper - IN PROGRESS"
echo " review"
echo ""
echo "check out imporant branches - IN PROGRESS"
echo " release pass a train release version"
}
function dashboard() {
COMMAND=$1
if [ "$COMMAND" = "boot" ]; then
$DASHBOARD_DIR/dashboard-ticket-boot.sh ${@:2}
if [ $? -eq 0 ]; then
# FIXME: Same logic here and in the dashboard-ticket-boot.sh - needs to be unfied
cd "$TICKETS_WORKSPACE_DIR/$2"
fi
elif [ "$COMMAND" = "boot-random" ]; then
$DASHBOARD_DIR/dashboard-ticket-boot-random.sh
elif [ "$COMMAND" = "cleanup" ]; then
$DASHBOARD_DIR/dashboard-cleanup.sh
elif [ "$COMMAND" = "patch-close" ]; then
$DASHBOARD_DIR/dashboard-branch-close.sh
cd ..
elif [ "$COMMAND" = "open" ]; then
if [ "$#" -ne 2 ]; then
usage
return 1
fi
cd "$TICKETS_WORKSPACE_DIR/$2"
elif [ "$COMMAND" = "delete" ]; then
$DASHBOARD_DIR/dashboard-ticket-delete.sh ${@:2}
elif [ "$COMMAND" = "delete-batch" ]; then
$DASHBOARD_DIR/dashboard-ticket-delete-batch.sh "${@:2}"
elif [ "$COMMAND" = "view" ]; then
python $DASHBOARD_DIR/jira_dashboard.py ${@:2} `query_list_of_repos_by_coma`
elif [ "$COMMAND" = "copy" ]; then
$DASHBOARD_DIR/dashboard-copy.sh ${@:2}
else
usage
fi
}