Last active
September 29, 2015 03:49
-
-
Save umi-uyura/b144de7219fdf712cd8c to your computer and use it in GitHub Desktop.
ndenv環境でAppcelerator Studioをインストール/起動できるようにシンボリックリンクを張る
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Provisioning to install the Appcelerator Studio under ndenv environment | |
# | |
APPCENV_SLINKS=(/usr/local/bin/node /usr/local/bin/npm /usr/local/bin/appc /usr/local/bin/appcelerator /usr/local/bin/titanium-code-processor) | |
APPCENV_NODEMODULES=(npm appcelerator titanium-code-processor) | |
if [ "$1" == "reset" ]; then | |
APPCENV_RESET=1 | |
fi | |
if [[ $APPCENV_RESET ]]; then | |
echo "Reset symlinks" | |
for link in "${APPCENV_SLINKS[@]}" | |
do | |
echo "unlink $link" | |
unlink "$link" | |
done | |
for link in "${APPCENV_NODEMODULES[@]}" | |
do | |
echo "unlink /usr/local/lib/node_modules/$link" | |
sudo unlink "/usr/local/lib/node_modules/$link" | |
done | |
exit | |
fi | |
# Symlink /usr/local/bin/* | |
NDENV_CURRENT_VERSION=$(ndenv global) | |
NDENV_CURRENT_PREFIX=$(ndenv prefix $NDENV_CURRENT_VERSION) | |
for link in "${APPCENV_SLINKS[@]}" | |
do | |
BIN_NAME=$(echo $link | cut -d / -f5) | |
echo "symlink create $link -> $NDENV_CURRENT_PREFIX/bin/$BIN_NAME" | |
ln -Fis "$NDENV_CURRENT_PREFIX/bin/$BIN_NAME" "$link" | |
done | |
# Symlink /usr/local/lib/node_modules/* | |
mkdir -p /usr/local/lib/node_modules | |
NDENV_CURRENT_PREFIX_MODULES=$NDENV_CURRENT_PREFIX/lib/node_modules | |
for module in "${APPCENV_NODEMODULES[@]}" | |
do | |
echo "symlink create /usr/local/lib/node_modules/$module -> $NDENV_CURRENT_PREFIX_MODULES/$module" | |
sudo ln -Fis "$NDENV_CURRENT_PREFIX_MODULES/$module" "/usr/local/lib/node_modules/$module" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment