# Install go #
###################
+common_go_home="${HOME}/.local/opt/go-v${WEBI_VERSION}"
new_go_home="${HOME}/.local/opt/go-v${WEBI_VERSION}"
new_go="${HOME}/.local/opt/go-v${WEBI_VERSION}/bin/go"
+update_go_home() {
+ rm -rf "$common_go_home"
+ ln -s "$new_go_home" "$common_go_home"
+
+ # TODO get better output from pathman / output the path to add as return to webi bootstrap
+ webi_path_add "$common_go_home/bin"
+ webi_path_add "$HOME/go/bin"
+}
+
+if [ -x "$new_go_home/bin/go" ]; then
+ update_go_home
+ exit 0
+fi
+
# Test for existing version
set +e
cur_go="$(command -v go)"
# Update PATH #
###################
-# TODO get better output from pathman / output the path to add as return to webi bootstrap
-webi_path_add "$new_go_home/bin"
-webi_path_add "$HOME/go/bin"
+update_go_home
echo "Installed 'go' (and go tools)"
echo ""
# Install node #
##################
+common_node_home="${HOME}/.local/opt/node"
new_node_home="${HOME}/.local/opt/node-v${WEBI_VERSION}"
new_node="${HOME}/.local/opt/node-v${WEBI_VERSION}/bin/node"
+update_node_home() {
+ rm -rf "$common_node_home"
+ ln -s "$new_node_home" "$common_node_home"
+
+ # TODO get better output from pathman / output the path to add as return to webi bootstrap
+ webi_path_add "$common_node_home/bin"
+}
+
+if [ -x "$new_go_home/bin/go" ]; then
+ update_node_home
+ exit 0
+fi
+
# Test for existing version
set +e
cur_node="$(command -v node)"
# Update PATH #
###################
-# TODO get better output from pathman / output the path to add as return to webi bootstrap
-webi_path_add "$new_node_home/bin"
+update_node_home
echo "Installed 'node' and 'npm'"
echo ""