Update following original kymsu
This commit is contained in:
2019-08-10 09:03:04 +02:00
parent 754076dd3d
commit e29dbb808d
15 changed files with 210 additions and 64 deletions

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 Mathieu Santo Stefano--Féron
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,32 +1,39 @@
# Plugins KYMSU
Plugins KYMSU (Keep Your macOs Stuff Updated)
https://github.com/welcoMattic/kymsu
# KYMSU
Keep Your macOs Stuff Updated (KYMSU)
> Get your Homebrew, Mac App Store, Atom Package Manager (apm), npm, yarn, composer, rustup ... stuff updated.
## Requirements
- **npm** (javascript package) plugin for KYMSU (install local package)
- **mas** (Mac Appstore) plugin for KYMSU
- **Homebrew** plugin for KYMSU
brew and cask
- **pip** (Python Package index) plugin for KYMSU
pip or pip3
- [Homebrew](https://brew.sh)
## Installation
`$ git clone git@github.com:welcoMattic/kymsu.git && cd kymsu && ./install.sh`
### Requirements
## Usage
- [KYMSU](https://github.com/welcoMattic/kymsu)
- [pipdeptree](https://pypi.python.org/pypi/pipdeptree) for checking dependancies (pip plugin)
Only update all the things
`$ kymsu`
With cleanup after updates
`$ kymsu cleanup`
## Plugins system
### Installation
All default plugins are placed in `~/.kymsu/plugins.d`, feel free to delete those you don't use, and/or add new ones.
Don't forget to share them here with a shiny pull request! ✨
Copy the plugins in `~/.kymsu/plugins.d`
## Auto-update
KYMSU will auto-update itself each time you run `kymsu` command.
## Credits
### License
* [All contributors](https://github.com/welcomattic/kymsu/graphs/contributors)
* Thanks to [@waxzce](https://github.com/waxzce) for his [article](https://medium.com/@waxzce/keeping-macos-clean-this-is-my-osx-brew-update-cli-command-6c8f12dc1731) about keeping macOs clean!
Same as KYMSU
## License
KYMSU is licensed under the MIT License - see the [LICENSE](LICENSE) file
for details.

32
README2.md Normal file
View File

@@ -0,0 +1,32 @@
# Plugins KYMSU
Plugins KYMSU (Keep Your macOs Stuff Updated)
https://github.com/welcoMattic/kymsu
- **npm** (javascript package) plugin for KYMSU (install local package)
- **mas** (Mac Appstore) plugin for KYMSU
- **Homebrew** plugin for KYMSU
brew and cask
- **pip** (Python Package index) plugin for KYMSU
pip or pip3
### Requirements
- [KYMSU](https://github.com/welcoMattic/kymsu)
- [pipdeptree](https://pypi.python.org/pypi/pipdeptree) for checking dependancies (pip plugin)
### Installation
Copy the plugins in `~/.kymsu/plugins.d`
### License
Same as KYMSU

44
_mas.sh
View File

@@ -1,44 +0,0 @@
#!/usr/bin/env bash
# Mac Appstore plugin for KYMSU
# https://github.com/welcoMattic/kymsu
echo -e "\033[1m🍏 Mac App Store updates come fast as lightning \033[0m"
# No distract mode (Casks with 'latest' version number won't be updated)
no_distract=false
if [[ $1 == "--nodistract" ]]; then
no_distract=true
fi
#mas outdated
massy=`mas outdated`
echo ""
if [ -n "$massy" ]; then
#if [ "$massy" != 0 ]; then
echo -e "\033[4mAvailables updates:\033[0m"
echo "$massy" | cut -d " " -f2-5
echo ""
if [ "$no_distract" = false ]; then
a=$(echo -e "Do you wanna run \033[1mmas upgrade\033[0m ? (y/n)")
read -p "$a" choice
case "$choice" in
y|Y|o ) mas upgrade;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
else
mas upgrade
fi
else
echo -e "\033[4mNo availables mas updates.\033[0m"
fi
echo ""
echo ""

14
install.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
KYMSU_PATH=`pwd`
# Make Kymsu accessible in PATH
ln -fs "${KYMSU_PATH}"/kymsu2.sh /usr/local/bin/kymsu2
# Store Kymsu stuff in home directory
mkdir -p ~/.kymsu && echo "${KYMSU_PATH}" > ~/.kymsu/path
cp -R "${KYMSU_PATH}/plugins.d" ~/.kymsu
echo "KYMSU2 has been installed. Run kymsu2 command!"
echo "It's a fork from https://github.com/welcoMattic/kymsu"
echo "All credits to welcoMattic"

40
kymsu2.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env bash
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
echo -e "\033[93m\033[1mkymsu2\033[0m"
echo ""
echo "Keep Your macOs Stuff Updated 2"
echo "a fork from kymsu https://github.com/welcoMattic/kymsu"
echo
echo "USAGE: kymsu2"
echo
echo "Commandes: "
echo " -h, --help display this help"
echo " --nodistract no distract mode (no user interaction)"
echo " --cleanup removing any older versions of installed formulae and clearing old downloads from the Homebrew download-cache"
echo " --npm_cleanup cleaning npm cache"
echo
echo "Tips:"
echo " -prefix the plugin with _ to ignore it"
echo
exit 0
fi
echo "Please, grab a ☕️, KYMSU keep your working environment up to date!"
SCRIPTS_DIR=$HOME/.kymsu/plugins.d
#SCRIPTS_DIR=$(cat ~/.kymsu/path)/plugins.d
cd "$SCRIPTS_DIR"
# On boucle sur tous les fichiers du répertoire
# (seuls les fichiers commençant par '_' ou '0' sont pris en compte)
#for script in $(find . -name '[_0]*' -maxdepth 1 | sort); do
for script in $(find . ! -name _\*.sh -maxdepth 1 | sort); do
# si le fichier est exécutable et n'est pas un dossier
if [ -x "$SCRIPTS_DIR/$script" ] && [ -f "$SCRIPTS_DIR/$script" ]; then
# on lexécute ; le $@ permet de passer à chaque
# script les arguments passés à *ce* script
$SCRIPTS_DIR/$script $@
fi
done

6
plugins.d/00-kymsu.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
echo "🦄 KYMSU self update"
pushd "$(cat ~/.kymsu/path)" > /dev/null
git pull
popd > /dev/null
echo ""

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
echo -e "\033[1m⚛ Atom editor will be shiny when you'll be back from your coffee/tea break! \033[0m"
if hash apm-beta 2>/dev/null; then

View File

@@ -13,9 +13,9 @@
display_info=true
#add module to do_not_update array
declare -a do_not_update=('')
declare -a do_not_update=('virtualbox,virtualbox-extension-pack')
# No distract mode (Casks with 'latest' version number won't be updated)
# No distract mode (no user interaction)(Casks with 'latest' version number won't be updated)
no_distract=false
if [[ $1 == "--nodistract" ]]; then

50
plugins.d/mas.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Mac Appstore plugin for KYMSU
# https://github.com/welcoMattic/kymsu
echo -e "\033[1m🍏 Mac App Store updates come fast as lightning \033[0m"
# No distract mode (no user interaction)
no_distract=false
if [[ $1 == "--nodistract" ]]; then
no_distract=true
fi
# On teste si mas est installé
if hash mas 2>/dev/null; then
massy=$(mas outdated)
echo ""
echo "$massy"
#if [ -n "$massy" ]; then
if [ ! -z "$(mas outdated)" ]; then
echo -e "\033[4mAvailables updates:\033[0m"
echo "$massy" | cut -d " " -f2-5
echo ""
if [ "$no_distract" = false ]; then
a=$(echo -e "Do you wanna run \033[1mmas upgrade\033[0m ? (y/n)")
read -p "$a" choice
case "$choice" in
y|Y|o ) mas upgrade;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
else
mas upgrade
fi
else
echo -e "\033[4mNo availables mas updates.\033[0m"
fi
else
echo "Please install mas: brew install mas"
fi
echo ""
echo ""

View File

@@ -22,7 +22,7 @@ no_distract=false
doctor=false
# Local install
local_path=/Users/bruno/Sites/node_modules/
local_path=$HOME/Sites/node_modules/
echo -e "\033[1m🌿 npm \033[0m"
echo ""
@@ -81,9 +81,12 @@ echo ""
# Global packages
echo -e "\033[4m🌿 Global installed scripts:\033[0m"
npm list -g --depth=0
g_outdated=$(npm outdated -g)
# => npm ERR! Cannot read property 'length' of undefined -> https://stackoverflow.com/questions/55172700/npm-outdated-g-error-cannot-read-property-length-of-undefined
# /Users/bruno/.nvm/versions/node/v10.16.2/lib/node_modules/npm/lib/outdated.js
# /usr/local/lib/node_modules/npm/lib/outdated.js
# update -> wanted ; install -> latest
if [ -n "$g_outdated" ]; then

View File

@@ -5,7 +5,7 @@
# https://pecl.php.net
# No distract mode
# No distract mode (no user interaction)
no_distract=false
echo -e "\033[1m🐘 pecl \033[0m"

View File

@@ -71,6 +71,16 @@ if [ -n "$upd" ]; then
z=$((z+1))
fi
done <<< "$dependencies"
else
c=$(echo -e "Do you want to install pipdeptree to check dependancies ? (y/n)")
read -p "$c" choice
case "$choice" in
y|Y|o ) $version install $user pipdeptree ;;
n|N ) echo "Ok, let's continue";;
* ) echo "invalid";;
esac
fi
# If the update is not in the do_not_update array, we install it.

6
uninstall.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
rm -rf $(which kymsu2)
rm -rf ~/.kymsu
echo "KYMSU2 has been uninstalled."