Skip to content
This repository was archived by the owner on Mar 5, 2019. It is now read-only.

Commit 4fe62ad

Browse files
datedfaustbrian
authored andcommitted
refactor: get state/versions only when necessary (#91)
1 parent 79e4ba2 commit 4fe62ad

File tree

8 files changed

+32
-2
lines changed

8 files changed

+32
-2
lines changed

actions/core/install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ core_install ()
2727
ascii
2828

2929
success "Installed Ark Core!"
30+
31+
core_version
3032
fi
3133
}

actions/core/uninstall.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ core_uninstall ()
2626
success "Deleted Configuration!"
2727

2828
success "Uninstalled Ark Core!"
29+
30+
core_version
2931
}

actions/core/update.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ core_update ()
5555

5656
success "Update OK!"
5757
STATUS_CORE_UPDATE="No"
58+
59+
core_version
5860
fi
5961
fi
6062
}

actions/miscellaneous/updates.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ miscellaneous_install_updates ()
3737
press_to_continue
3838
fi
3939
fi
40+
41+
get_versions
4042
}

commander.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ main ()
117117

118118
if [[ -d "$EXPLORER_DIR" ]]; then
119119
explorer_update
120+
else
121+
STATUS_EXPLORER_UPDATE="n/a"
120122
fi
121123

122124
while true; do

menus/core/menu.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ menu_manage_core ()
55
ascii
66

77
forger_status
8+
relay_status
89

910
text_white " U. Update Ark Core"
1011
text_white " P. Uninstall Ark Core"

modules/state.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
refresh_state ()
44
{
5-
get_versions
6-
75
ntp_status
86
pgsql_status
97
relay_status

modules/versions.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,53 @@
11
#!/usr/bin/env bash
22

33
get_versions ()
4+
{
5+
core_version
6+
node_version
7+
npm_version
8+
yarn_version
9+
psql_version
10+
}
11+
12+
core_version ()
413
{
514
if [[ -d "$CORE_DIR" ]]; then
615
cd "$CORE_DIR"
716
VERSION_CORE=$(git rev-parse --short HEAD)
817
else
918
VERSION_CORE="n/a"
1019
fi
20+
}
1121

22+
node_version ()
23+
{
1224
if [[ -x "$(command -v node)" ]]; then
1325
VERSION_NODE=$(node -v | sed 's/v//g')
1426
else
1527
VERSION_NODE="n/a"
1628
fi
29+
}
1730

31+
npm_version ()
32+
{
1833
if [[ -x "$(command -v npm)" ]]; then
1934
VERSION_NPM=$(npm -v)
2035
else
2136
VERSION_NPM="n/a"
2237
fi
38+
}
2339

40+
yarn_version ()
41+
{
2442
if [[ -x "$(command -v yarn)" ]]; then
2543
VERSION_YARN=$(yarn -v)
2644
else
2745
VERSION_YARN="n/a"
2846
fi
47+
}
2948

49+
psql_version ()
50+
{
3051
if [[ -x "$(command -v psql)" ]]; then
3152
VERSION_PSQL=$(psql -V | awk '{ print $3 }')
3253
else

0 commit comments

Comments
 (0)