Skip to content

Commit

Permalink
Refactor install.sh to add global symlink for phpvm
Browse files Browse the repository at this point in the history
  • Loading branch information
Thavarshan committed Oct 6, 2024
1 parent 0755438 commit 504105e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
}

phpvm_create_launcher
phpvm_create_symlink
}

phpvm_create_launcher() {
Expand All @@ -106,6 +107,19 @@ EOL
chmod +x "$INSTALL_DIR/bin/phpvm"
}

phpvm_create_symlink() {
local INSTALL_DIR
INSTALL_DIR="$(phpvm_install_dir)"

# Create a global symlink for phpvm
if [ -d "/usr/local/bin" ]; then
sudo ln -sf "$INSTALL_DIR/bin/phpvm" /usr/local/bin/phpvm
phpvm_echo "=> Created a global symlink for phpvm at /usr/local/bin/phpvm"
else
phpvm_echo "=> /usr/local/bin not found, please ensure it's in your PATH"
fi
}

phpvm_detect_profile() {
if [ "${PROFILE-}" = '/dev/null' ]; then
return
Expand Down Expand Up @@ -141,7 +155,6 @@ EOL
PROFILE_INSTALL_DIR="$(phpvm_install_dir | command sed "s:^$HOME:\$HOME:")"

PHPVM_CONFIG_STR="
# Load PHPVM if it exists (similar to nvm)
[[ -s \"\$PHPVM_DIR/index.js\" ]] && export PATH=\"\$PHPVM_DIR/bin:\$PATH\" && node \"\$PHPVM_DIR/index.js\"
"

Expand Down

0 comments on commit 504105e

Please sign in to comment.