Check degit URL in pre action
as we also check the git URL in the pre action there. Don't use _zimfw_source_zimrc with a flag when no _znames is needed (flag 1) or _zfpaths, _zfunctions, _zcmds are needed (flag 2).
This commit is contained in:
parent
ded640ed80
commit
3fe3ba2b48
3 changed files with 27 additions and 29 deletions
|
@ -9,15 +9,9 @@ _zimfw_download_tarball() {
|
||||||
fi
|
fi
|
||||||
readonly HEADERS_TARGET=${DIR}/${TEMP}_headers
|
readonly HEADERS_TARGET=${DIR}/${TEMP}_headers
|
||||||
{
|
{
|
||||||
if [[ -r ${INFO_TARGET} ]]; then
|
readonly INFO=("${(@f)"$(<${INFO_TARGET})"}")
|
||||||
readonly INFO=("${(@f)"$(<${INFO_TARGET})"}")
|
# Previous REV is in line 2, reserved for future use.
|
||||||
if [[ ${URL} != ${INFO[1]} ]]; then
|
readonly INFO_HEADER=${INFO[3]}
|
||||||
_zimfw_print_error "The zimfw degit URL does not match. Expected ${URL}. Will not try to ${ACTION}."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
# Previous REV is in line 2, reserved for future use.
|
|
||||||
readonly INFO_HEADER=${INFO[3]}
|
|
||||||
fi
|
|
||||||
readonly TARBALL_URL=https://api.github.com/repos/${REPO}/tarball/${REV}
|
readonly TARBALL_URL=https://api.github.com/repos/${REPO}/tarball/${REV}
|
||||||
if [[ ${ACTION} == check ]]; then
|
if [[ ${ACTION} == check ]]; then
|
||||||
if [[ -z ${INFO_HEADER} ]] return 0
|
if [[ -z ${INFO_HEADER} ]] return 0
|
||||||
|
@ -96,6 +90,11 @@ _zimfw_tool_degit() {
|
||||||
_zimfw_print_error $'Module was not installed using zimfw\'s degit. Use zmodule option <%= bold %>-z<%= normalred %>|<%= bold %>--frozen<%= normalred %> to disable this error.'
|
_zimfw_print_error $'Module was not installed using zimfw\'s degit. Use zmodule option <%= bold %>-z<%= normalred %>|<%= bold %>--frozen<%= normalred %> to disable this error.'
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
readonly INFO=("${(@f)"$(<${INFO_TARGET})"}")
|
||||||
|
if [[ ${URL} != ${INFO[1]} ]]; then
|
||||||
|
_zimfw_print_error 'The zimfw degit URL does not match. Expected '${URL}$'. Use zmodule option <%= bold %>-z<%= normalred %>|<%= bold %>--frozen<%= normalred %> to disable this error.'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
|
|
@ -67,10 +67,10 @@ Options:
|
||||||
_zimfw_compile
|
_zimfw_compile
|
||||||
;;
|
;;
|
||||||
check-dumpfile) _zimfw_check_dumpfile ;;
|
check-dumpfile) _zimfw_check_dumpfile ;;
|
||||||
clean) _zimfw_source_zimrc 2 && _zimfw_clean_compiled && _zimfw_clean_dumpfile ;;
|
clean) _zimfw_source_zimrc 0 && _zimfw_clean_compiled && _zimfw_clean_dumpfile ;;
|
||||||
clean-compiled) _zimfw_source_zimrc 2 && _zimfw_clean_compiled ;;
|
clean-compiled) _zimfw_source_zimrc 0 && _zimfw_clean_compiled ;;
|
||||||
clean-dumpfile) _zimfw_clean_dumpfile ;;
|
clean-dumpfile) _zimfw_clean_dumpfile ;;
|
||||||
compile) _zimfw_source_zimrc 2 && _zimfw_compile ;;
|
compile) _zimfw_source_zimrc 0 && _zimfw_compile ;;
|
||||||
help) print -R ${zusage} ;;
|
help) print -R ${zusage} ;;
|
||||||
info) _zimfw_info ;;
|
info) _zimfw_info ;;
|
||||||
list)
|
list)
|
||||||
|
@ -96,12 +96,12 @@ Options:
|
||||||
(( _zprintlevel-- ))
|
(( _zprintlevel-- ))
|
||||||
_zimfw_source_zimrc 2 && _zimfw_build && _zimfw_compile
|
_zimfw_source_zimrc 2 && _zimfw_build && _zimfw_compile
|
||||||
;;
|
;;
|
||||||
uninstall) _zimfw_source_zimrc 2 && _zimfw_list_unuseds && _zimfw_uninstall ;;
|
uninstall) _zimfw_source_zimrc 0 && _zimfw_list_unuseds && _zimfw_uninstall ;;
|
||||||
check-version) _zimfw_check_version 1 ;;
|
check-version) _zimfw_check_version 1 ;;
|
||||||
upgrade)
|
upgrade)
|
||||||
_zimfw_upgrade || return 1
|
_zimfw_upgrade || return 1
|
||||||
(( _zprintlevel-- ))
|
(( _zprintlevel-- ))
|
||||||
_zimfw_source_zimrc 2 && _zimfw_compile
|
_zimfw_source_zimrc 0 && _zimfw_compile
|
||||||
;;
|
;;
|
||||||
version) print -R ${_zversion} ;;
|
version) print -R ${_zversion} ;;
|
||||||
*)
|
*)
|
||||||
|
|
29
zimfw.zsh
29
zimfw.zsh
|
@ -462,7 +462,7 @@ _zimfw_compile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_zimfw_info() {
|
_zimfw_info() {
|
||||||
print -R 'zimfw version: '${_zversion}' (built at 2024-08-20 13:01:29 UTC, previous commit is 7f3491b)'
|
print -R 'zimfw version: '${_zversion}' (built at 2024-09-16 23:05:08 UTC, previous commit is ded640e)'
|
||||||
local zparam
|
local zparam
|
||||||
for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do
|
for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do
|
||||||
print -R ${(r.22....:.)zparam}${(P)zparam}
|
print -R ${(r.22....:.)zparam}${(P)zparam}
|
||||||
|
@ -599,15 +599,9 @@ _zimfw_download_tarball() {
|
||||||
fi
|
fi
|
||||||
readonly HEADERS_TARGET=${DIR}/${TEMP}_headers
|
readonly HEADERS_TARGET=${DIR}/${TEMP}_headers
|
||||||
{
|
{
|
||||||
if [[ -r ${INFO_TARGET} ]]; then
|
readonly INFO=("${(@f)"$(<${INFO_TARGET})"}")
|
||||||
readonly INFO=("${(@f)"$(<${INFO_TARGET})"}")
|
# Previous REV is in line 2, reserved for future use.
|
||||||
if [[ ${URL} != ${INFO[1]} ]]; then
|
readonly INFO_HEADER=${INFO[3]}
|
||||||
_zimfw_print_error "The zimfw degit URL does not match. Expected ${URL}. Will not try to ${ACTION}."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
# Previous REV is in line 2, reserved for future use.
|
|
||||||
readonly INFO_HEADER=${INFO[3]}
|
|
||||||
fi
|
|
||||||
readonly TARBALL_URL=https://api.github.com/repos/${REPO}/tarball/${REV}
|
readonly TARBALL_URL=https://api.github.com/repos/${REPO}/tarball/${REV}
|
||||||
if [[ ${ACTION} == check ]]; then
|
if [[ ${ACTION} == check ]]; then
|
||||||
if [[ -z ${INFO_HEADER} ]] return 0
|
if [[ -z ${INFO_HEADER} ]] return 0
|
||||||
|
@ -686,6 +680,11 @@ _zimfw_tool_degit() {
|
||||||
_zimfw_print_error $'Module was not installed using zimfw\'s degit. Use zmodule option \E[1m-z\E[0;31m|\E[1m--frozen\E[0;31m to disable this error.'
|
_zimfw_print_error $'Module was not installed using zimfw\'s degit. Use zmodule option \E[1m-z\E[0;31m|\E[1m--frozen\E[0;31m to disable this error.'
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
readonly INFO=("${(@f)"$(<${INFO_TARGET})"}")
|
||||||
|
if [[ ${URL} != ${INFO[1]} ]]; then
|
||||||
|
_zimfw_print_error 'The zimfw degit URL does not match. Expected '${URL}$'. Use zmodule option \E[1m-z\E[0;31m|\E[1m--frozen\E[0;31m to disable this error.'
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
@ -973,10 +972,10 @@ Options:
|
||||||
_zimfw_compile
|
_zimfw_compile
|
||||||
;;
|
;;
|
||||||
check-dumpfile) _zimfw_check_dumpfile ;;
|
check-dumpfile) _zimfw_check_dumpfile ;;
|
||||||
clean) _zimfw_source_zimrc 2 && _zimfw_clean_compiled && _zimfw_clean_dumpfile ;;
|
clean) _zimfw_source_zimrc 0 && _zimfw_clean_compiled && _zimfw_clean_dumpfile ;;
|
||||||
clean-compiled) _zimfw_source_zimrc 2 && _zimfw_clean_compiled ;;
|
clean-compiled) _zimfw_source_zimrc 0 && _zimfw_clean_compiled ;;
|
||||||
clean-dumpfile) _zimfw_clean_dumpfile ;;
|
clean-dumpfile) _zimfw_clean_dumpfile ;;
|
||||||
compile) _zimfw_source_zimrc 2 && _zimfw_compile ;;
|
compile) _zimfw_source_zimrc 0 && _zimfw_compile ;;
|
||||||
help) print -R ${zusage} ;;
|
help) print -R ${zusage} ;;
|
||||||
info) _zimfw_info ;;
|
info) _zimfw_info ;;
|
||||||
list)
|
list)
|
||||||
|
@ -1002,12 +1001,12 @@ Options:
|
||||||
(( _zprintlevel-- ))
|
(( _zprintlevel-- ))
|
||||||
_zimfw_source_zimrc 2 && _zimfw_build && _zimfw_compile
|
_zimfw_source_zimrc 2 && _zimfw_build && _zimfw_compile
|
||||||
;;
|
;;
|
||||||
uninstall) _zimfw_source_zimrc 2 && _zimfw_list_unuseds && _zimfw_uninstall ;;
|
uninstall) _zimfw_source_zimrc 0 && _zimfw_list_unuseds && _zimfw_uninstall ;;
|
||||||
check-version) _zimfw_check_version 1 ;;
|
check-version) _zimfw_check_version 1 ;;
|
||||||
upgrade)
|
upgrade)
|
||||||
_zimfw_upgrade || return 1
|
_zimfw_upgrade || return 1
|
||||||
(( _zprintlevel-- ))
|
(( _zprintlevel-- ))
|
||||||
_zimfw_source_zimrc 2 && _zimfw_compile
|
_zimfw_source_zimrc 0 && _zimfw_compile
|
||||||
;;
|
;;
|
||||||
version) print -R ${_zversion} ;;
|
version) print -R ${_zversion} ;;
|
||||||
*)
|
*)
|
||||||
|
|
Loading…
Reference in a new issue