Skip to content

Commit

Permalink
chore(release): version 5.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kamontat committed May 10, 2021
1 parent e39f1f1 commit b1844cd
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 42 deletions.
1 change: 1 addition & 0 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export MYZS_LOADING_PLUGINS=(
# "myzs-plugins/macos#master"

# "myzs-plugins/thefuck#master"
"myzs-plugins/python#main"
# "myzs-plugins/nodejs#master"
# "myzs-plugins/docker#master"
# "kamontat/mplugin-kamontat#master"
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release notes

## Version 5.3.4 (10 May 2021)

- add logging when checking os and shell
- upgrade app/gcloud.sh to support latest version
- add new plugin `myzs-plugins/python` for conda support
- now plugin default branch will be **main** instead of **master**

## Version 5.3.3 (21 Apr 2021)

- add error progress when zplug load failed
Expand Down
4 changes: 2 additions & 2 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ export __MYZS__COM="${_MYZS_ROOT}/resources/completion"
export ZPLUG_HOME="${MYZS_ZPLUG:-${_MYZS_ROOT}/zplug}"

export __MYZS__OWNER="Kamontat Chantrachirathumrong"
export __MYZS__VERSION="5.3.3"
export __MYZS__VERSION="5.3.4"
export __MYZS__SINCE="21 Apr 2018"
export __MYZS__LAST_UPDATED="21 Apr 2021"
export __MYZS__LAST_UPDATED="10 May 2021"
export __MYZS__LICENSE="MIT"

export __MYZS__MODULES=()
Expand Down
65 changes: 25 additions & 40 deletions src/app/gcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,33 @@

_myzs:internal:module:initial "$0"

initial() {
local _gcloud_default_name="${1:-google-cloud-sdk}"

local _gcloud_default1="/opt" # application location
local _gcloud_default2="/usr/local/Cellar" # homebrew location
local _gcloud_default3="/usr/local/bin" # legacy location

_myzs:internal:checker:folder-exist "$_gcloud_default1/${_gcloud_default_name}" &&
export __MYZS__DEFAULT_GCLOUD_LOCATION="$_gcloud_default1/${_gcloud_default_name}"

_myzs:internal:checker:folder-exist "$_gcloud_default2/${_gcloud_default_name}" &&
export __MYZS__DEFAULT_GCLOUD_LOCATION="$_gcloud_default2/${_gcloud_default_name}"

_myzs:internal:checker:folder-exist "$_gcloud_default3/${_gcloud_default_name}" &&
export __MYZS__DEFAULT_GCLOUD_LOCATION="$_gcloud_default3/${_gcloud_default_name}"

_myzs:internal:checker:folder-exist "${_gcloud_default_name}" &&
export __MYZS__DEFAULT_GCLOUD_LOCATION="${_gcloud_default_name}"

local current_path="${__MYZS__DEFAULT_GCLOUD_LOCATION}"
_myzs:internal:checker:command-exist "gcloud" &&
current_path="$(dirname "$(dirname "$(which gcloud)")")"

local gcloud_path="${current_path:-$default_path}"

_myzs:internal:path-push "${gcloud_path}/bin"
# The next line enables shell command completion for gcloud.
_myzs:internal:load "Google Cloud SDK path" "${gcloud_path}/completion.$(_myzs:internal:shell).inc"
_myzs:private:gcloud:initial() {
local _local_shell _gcloud_fullpath
_local_shell="$(_myzs:internal:shell)"
local _path_filename="path.$_local_shell.inc"
local _completion_filename="completion.$_local_shell.inc"
local _gcloud_default_name="google-cloud-sdk"
local _gcloud_paths=(
"/opt"
"/usr/local/Cellar"
"/usr/local/bin"
"/usr/local/etc"
)

export __MYZS__DEFAULT_GCLOUD_DIRPATH=""
for _gcloud_path in "${_gcloud_paths[@]}"; do
_gcloud_fullpath="$_gcloud_path/$_gcloud_default_name"
if _myzs:internal:checker:folder-exist "$_gcloud_fullpath"; then
__MYZS__DEFAULT_GCLOUD_DIRPATH="$_gcloud_fullpath"
fi
done

if ! _myzs:internal:checker:command-exist "gcloud"; then
if _myzs:internal:checker:string-exist "$__MYZS__DEFAULT_GCLOUD_LOCATION"; then
_myzs:internal:log:info "loading gcloud from ${__MYZS__DEFAULT_GCLOUD_LOCATION}"
if _myzs:internal:checker:string-exist "$__MYZS__DEFAULT_GCLOUD_DIRPATH"; then
_myzs:internal:log:debug "loading gcloud from ${__MYZS__DEFAULT_GCLOUD_DIRPATH}"

local install_path="${__MYZS__DEFAULT_GCLOUD_LOCATION}/install.sh"
$install_path
else
_myzs:internal:log:info "cannot found gcloud-sdk location, create \$MYZS_GCLOUD_LOCATION and point to gcloud-sdk location path"
_myzs:internal:failed 2
fi
else
_myzs:internal:log:info "command gcloud already existed, skip initial"
_myzs:internal:load "Google Cloud SDK path" "$__MYZS__DEFAULT_GCLOUD_DIRPATH/$_path_filename"
_myzs:internal:load "Google Cloud SDK completion" "$__MYZS__DEFAULT_GCLOUD_DIRPATH/$_completion_filename"
fi
}

initial "$MYZS_GCLOUD_LOCATION"
_myzs:private:gcloud:initial
2 changes: 2 additions & 0 deletions src/utils/helper/checker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ fi

_myzs:private:checker:shell() {
if grep -q "$1" <<<"$SHELL"; then
_myzs:internal:log:debug "You loading on $SHELL"
return 0
else
return 1
Expand Down Expand Up @@ -87,6 +88,7 @@ _myzs:internal:checker:mac() {
local name
name="$(uname -s)"
if [[ "$name" = "Darwin" ]]; then
_myzs:internal:log:debug "You loading on MacOS"
return 0
else
return 1
Expand Down

0 comments on commit b1844cd

Please sign in to comment.