Skip to content

Instantly share code, notes, and snippets.

@singajeet
Created March 16, 2018 18:08
Show Gist options
  • Save singajeet/804dfaba27f40ecd8590168aba0ba443 to your computer and use it in GitHub Desktop.
Save singajeet/804dfaba27f40ecd8590168aba0ba443 to your computer and use it in GitHub Desktop.
Manager to manage different kind plugins
#!env zsh
#############################################
# Reinstall plugins for Armin-Studio
# Name: armin_plugin_mgr.zsh
# Author: Ajeet Singh
#############################################
base_dir=~/projects/python/armin/plugins-all/
function reinstall_plugins(){
echo "Reinstall Plugins[dir=$base_dir]"
echo "[None=0, All=1, Name=2, ChangeDir=3]:"
read -k 1 opt
echo " "
if [ "$opt" = '1' ];
then
for file in $base_dir/**/*setup.py; do
output_dir=${file:h}
setup_file=${file:t}
echo "Checking path: ["$output_dir"]"
cd $output_dir
raw_n=`grep -i "name=" $setup_file`
raw_n=${raw_n// /}
raw_n=${raw_n#name=\'}
plugin_name=${raw_n//\',/}
echo "Plugin found: ["$plugin_name"]"
if [ "$plugin_name" = 'armin-studio' ];
then
echo "Skipping main app: ["$plugin_name"]"
else
echo "Uninstalling..."
pip uninstall $plugin_name
echo "Reinstalling..."
pip install .
echo $plugin_name" done!"
fi
cd -
done
elif [ "$opt" = '2' ];
then
echo "Enter name of the plugin"
read plugin_name
echo $plugin_name
echo "Not implemented yet!"
elif [ "$opt" = '3' ];
then
echo "Enter new path:"
read base_dir
reinstall_plugins
else
echo "No plugins selected for reinstall!"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment