diff --git a/plugins.d/atom.sh b/plugins.d/atom.sh index e1de6ce..f22c99a 100755 --- a/plugins.d/atom.sh +++ b/plugins.d/atom.sh @@ -2,6 +2,8 @@ echo -e "\033[1m⚛️ Atom editor will be shiny when you'll be back from your coffee/tea break! \033[0m" +command -v apm >/dev/null 2>&1 || { echo -e "\n${bold}Atom editor${reset} is not installed.\n\nRun ${italic}'brew install atom'${reset} for install." && exit 1; } + if hash apm-beta 2>/dev/null; then apm-beta upgrade -c false fi diff --git a/plugins.d/homebrew.sh b/plugins.d/homebrew.sh index 97346ba..f2bc07b 100755 --- a/plugins.d/homebrew.sh +++ b/plugins.d/homebrew.sh @@ -461,14 +461,14 @@ echo "$test" # Fichier php.ini courant # php -i | grep 'Loaded Configuration File' | awk '{print $NF}' -php_versions=$(ls /usr/local/etc/php/ 2>/dev/null) +php_versions=$(ls $(brew --prefix)/etc/php/ 2>/dev/null) for php in $php_versions do if [ -n "$upd_pkg" ]; then # file modified since it was last read - php_modified=$(find /usr/local/etc/php/$php/ -name php.ini -newer /tmp/checkpoint) - php_ini=/usr/local/etc/php/$php/php.ini + php_modified=$(find $(brew --prefix)/etc/php/$php/ -name php.ini -newer /tmp/checkpoint) + php_ini=$(brew --prefix)/etc/php/$php/php.ini notif2="$php_ini has been modified" echo "$php_modified" diff --git a/plugins.d/installed.sh b/plugins.d/installed.sh index 00b5784..0be1a49 100755 --- a/plugins.d/installed.sh +++ b/plugins.d/installed.sh @@ -7,7 +7,7 @@ # Settings: # npm local install -local_path=/Users/bruno/Sites/node_modules/ +local_path=$HOME/Sites/node_modules/ # folder contains Brewfile and Installer.md #chemin=$(pwd) chemin=$HOME/Documents/kymsu diff --git a/plugins.d/nodejs.sh b/plugins.d/nodejs.sh index 89b1ec9..5e70493 100755 --- a/plugins.d/nodejs.sh +++ b/plugins.d/nodejs.sh @@ -146,8 +146,10 @@ echo "" # Local packages # ################## -if [ -d "$local_path" ]; then - cd "$local_path" || return +# Local folder exist and not empty (modules installed) +#if [ -d "$local_path/node_modules" ] && [ -n "$(ls -A "$local_path/node_modules")" ]; then +if find "$local_path/node_modules" -mindepth 1 -maxdepth 1 | read; then + echo -e "${underline}🌿 Local installed scripts:${reset}" if [ "$display_info" = true ]; then @@ -349,6 +351,10 @@ if [ "$doctor" = true ]; then echo "" + echo "Troubleshooting:" + echo "https://github.com/nvm-sh/nvm#macos-troubleshooting" + echo "" + echo -e "🔍 Verifying npm cache\n" npm cache verify echo "" diff --git a/plugins.d/pecl.sh b/plugins.d/pecl.sh index bb0f2c1..7674afd 100755 --- a/plugins.d/pecl.sh +++ b/plugins.d/pecl.sh @@ -49,6 +49,31 @@ echo -e "${bold}❗️ plugin en test (beta) ${reset}" echo "" +# Airbook +#❯ echo $(brew --prefix) +#/opt/homebrew + +#❯ which -a php +#/opt/homebrew/bin/php +#/usr/bin/php + +#/opt/homebrew/opt/php + +#❯ php --info | grep 'PHP Version' +#PHP Version => 7.3.24-(to be removed in future macOS) +#PHP Version => 7.3.24-(to be removed in future macOS) + +# Silberbook +#❯ echo $(brew --prefix) +#/usr/local + +#❯ which -a php +#/usr/local/bin/php +#/usr/bin/php + +#/usr/local/opt/php + + version=$(php --info | grep 'PHP Version' | sed -n '1p' | awk -F" " '{print $NF}') v=${version:0:3} echo -e "Current PHP version: ${bold}$version${reset}\n" @@ -146,7 +171,9 @@ echo "php_info: $php_info" # si modif des extensions, les .ini dans conf.d/ ne sont pas modifiés, juste le php.ini # php.ini a été modifié il y a moins de 5mn -v_php=$(php --info | grep -E 'usr.*ini') +#v_php=$(php --info | grep -E 'usr.*ini') +v_php=$(php --ini) + conf_php=$(echo "$v_php" | grep 'Loaded Configuration File' | awk '{print $NF}') dir=$(dirname "$conf_php") name=$(basename "$conf_php") diff --git a/plugins.d/perl.sh b/plugins.d/perl.sh index b7268c2..7846426 100755 --- a/plugins.d/perl.sh +++ b/plugins.d/perl.sh @@ -1,8 +1,18 @@ #!/usr/bin/env bash +# Perl plugin for KYMSU +# https://github.com/welcoMattic/kymsu + +############################################################################################### +# +# Settings: + # Display info on updated pakages display_info=true +# No distract mode (no user interaction) +[[ $@ =~ "--nodistract" ]] && no_distract=true || no_distract=false + # Also add module for prevent to update it. declare -a do_not_update=('') @@ -14,14 +24,14 @@ echo -e "\033[4mPerl:\033[0m $perl_app" echo -e "\033[4mVersion:\033[0m $perl_v" echo "" -module="App::cpanoutdate" +module="App::cpanoutdated" if ! perl -M$module -e 1 2>/dev/null; then echo -e "\033[4mRequierement:\033[0m module $module is not installed" a=$(echo -e "Do you wanna run \033[1mcpan -i "$module"\033[0m ? (y/n)") read -p "$a" choice if [ "$choice" == "y" ]; then - #cpan -i $module + cpan -i $module install_ok=true else echo "Bye" @@ -29,7 +39,6 @@ if ! perl -M$module -e 1 2>/dev/null; then fi else - echo "$module installed" install_ok=true fi @@ -46,10 +55,10 @@ if [ "$install_ok" == "true" ]; then outdated=$(cpan-outdated -p) nb=$(echo $outdated | wc -w) - a=$(echo -e "Do you wanna update\033[1m "$nb" outdated\033[0m modules ? (y/n)") + a=$(echo -e "Do you wanna update\033[1m "$nb" outdated\033[0m modules ? (y/n/a)") read -p "$a" choice - if [ "$choice" == "y" ]; then + if [ "$choice" == "y" ] || [ "$choice" == "Y" ] || [ "$choice" == "a" ] || [ "$choice" == "A" ]; then for i in $outdated do @@ -60,7 +69,11 @@ if [ "$install_ok" == "true" ]; then cpan -D "$i" fi echo -e "\033[1m" - echo "$i" | awk '{print $1}' | xargs -p -n 1 cpan -i + if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then + echo "$i" | awk '{print $1}' | xargs -p -n 1 cpan -i + elif [ "$choice" == "a" ] || [ "$choice" == "A" ]; then + echo "$i" | awk '{print $1}' | xargs -n 1 cpan -i + fi echo -e "\033[0m" #echo "" fi diff --git a/plugins.d/pip.sh b/plugins.d/pip.sh index c70b35b..3dc1fe6 100755 --- a/plugins.d/pip.sh +++ b/plugins.d/pip.sh @@ -33,7 +33,7 @@ user="" # Add module to the do_not_update array for prevent to update. #declare -a do_not_update=() #declare -a do_not_update=("parso" "asgiref") -declare -a do_not_update=() +declare -a do_not_update=("starlette") # ######################################### diff --git a/plugins.d/venv.sh b/plugins.d/venv.sh new file mode 100755 index 0000000..e9be3f0 --- /dev/null +++ b/plugins.d/venv.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash + +# Perl plugin for KYMSU +# https://github.com/welcoMattic/kymsu + +############################################################################################### +# +# Settings: + +# Liste des apps: +# - le venv doit avoir le même nom que l'app +declare -a apps=("soco-cli" "mkdocs") + +# Liste des extensions pour Mkdocs +mkdocs_ext=("mkdocs-material" "mkdocs-material-extensions" "mkdocs-git-revision-date-localized-plugin" "mkdocs-minify-plugin" "fontawesome_markdown" "mkdocs-pdf-export-plugin") + +echo -e "${bold}🐍 Update apps in Python virtuals environments ${reset}\n" + +# Où sont stockés les environnements virtuels: +# macos: silverbook / airbook +if [[ "$OSTYPE" == "darwin"* ]]; then + v=$HOME/Documents/venv + +# rpi4: linux_gnueabihf +# rpi3: +# solus: linux-gnu + +elif [[ "$OSTYPE" == "linux_gnu" ]]; then + v=$HOME/Applications + +elif [[ "$OSTYPE" == "linux_gnueabihf" ]]; then + v=$HOME/venv +fi +# +############################################################################################### + +italic="\033[3m" +underline="\033[4m" +ita_under="\033[3;4m" +bgd="\033[1;4;31m" +red="\033[1;31m" +bold="\033[1m" +box="\033[1;41m" +reset="\033[0m" + +for app in ${apps[*]} +do + echo -e "${bold}Update $app${reset}"; + cd "$v/$app" + + source bin/activate + python3 -V + pip3 install -U pip setuptools + + pip3 install -U "$app" + ret=$? + + # pas d'update: ret=0 + #[ $ret -eq 0 ] && echo -e "${underline}\nNo update available !\n${reset}" + + if [ $ret -eq 0 ]; then + echo -e "${underline}\nNo update available !\n${reset}" + fi + + info=$(pip3 show "$app") + l1=$(echo "$info" | sed -n '1p') + l1="\\\033[4m$l1\\\033[0m" + info=$(echo "$info" | sed "1s/.*/$l1/") + echo -e "$info" + +<