Skip to content

Instantly share code, notes, and snippets.

@umi-uyura
Last active Sep 29, 2015
Embed
What would you like to do?
ndenv環境でAppcelerator Studioをインストール/起動できるようにシンボリックリンクを張る
#!/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