Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/cloudflare/wrangle…
Browse files Browse the repository at this point in the history
…r-action-3.1.1
  • Loading branch information
ss-o committed Sep 16, 2023
2 parents 4188a38 + b63a13c commit d37a75a
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 30 deletions.
10 changes: 10 additions & 0 deletions .trunk/config/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ["{|}"]
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
15 changes: 11 additions & 4 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@ cli:
plugins:
sources:
- id: trunk
ref: v1.2.1
ref: v1.2.3
uri: https://github.com/trunk-io/plugins
repo:
repo:
host: github.com
owner: z-shell
name: zi-src
lint:
disabled:
- yamllint
- trufflehog
- renovate
- checkov
- trivy
enabled:
- git-diff-check@SYSTEM
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- shfmt@3.5.0
- shfmt@3.6.0
- [email protected]
actions:
enabled:
Expand All @@ -30,5 +36,6 @@ actions:
- trunk-cache-prune
runtimes:
enabled:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
2 changes: 1 addition & 1 deletion lib/checksum.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
aff5e54299d6cd07fc123f8200c456b12bfcc23bb921ebcc2c326d9afd163d04 lib/sh/install_zpmod.sh
13668e0d6edce92994b0434932873d8a8a2c2579a2cb53964de19212f02a2954 lib/sh/install_zpmod.sh
6214cad3026f4150dfe1070592f6b24256cae5c60c596bdfebda07ffeaaf39fc lib/sh/install.sh
23a563e80249a866c7cba3ac44eaedb1ca38f20c35690fb764a7cb75e95d38be lib/zsh/init.zsh
2 changes: 2 additions & 0 deletions lib/sh/install_alpha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# -*- mode: sh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=sh sw=2 ts=2 et

# shellcheck disable=all

# Temporary work directory
trap 'rm -rf "$WORKDIR"' EXIT INT

Expand Down
50 changes: 25 additions & 25 deletions lib/sh/install_zpmod.sh
Original file line number Diff line number Diff line change
@@ -1,95 +1,95 @@
#!/usr/bin/env sh

setup_environment() {
if [ -z "$ZI_HOME" ]; then
if [ -d "$HOME"/.zi ]; then
if [ -z "${ZI_HOME}" ]; then
if [ -d "${HOME}"/.zi ]; then
ZI_HOME="${HOME}/.zi"
elif [ -d "$ZDOTDIR"/.zi ]; then
elif [ -d "${ZDOTDIR}"/.zi ]; then
ZI_HOME="${ZDOTDIR}/.zi"
elif [ -d "$XDG_DATA_HOME"/.zi ]; then
elif [ -d "${XDG_DATA_HOME}"/.zi ]; then
ZI_HOME="${XDG_DATA_HOME}/.zi"
else
ZI_HOME="${HOME}/.zi"
fi
fi
if [ -z "$MOD_HOME" ]; then
if [ -z "${MOD_HOME}" ]; then
MOD_HOME="${ZI_HOME}/zmodules/zpmod"
fi
if ! test -d "${MOD_HOME}"; then
mkdir -p "${MOD_HOME}"
chmod g-rwX "${MOD_HOME}"
fi
if [ ! -d "$MOD_HOME" ]; then
printf '%s\n' "$col_error== Error: Failed to setup module directory ==$col_rst"
if [ ! -d "${MOD_HOME}" ]; then
printf '%s\n' "${col_error}== Error: Failed to setup module directory ==${col_rst}"
exit 255
fi
}

setup_zpmod_repository() {
printf '%s\n' "$col_pname== Downloading ZPMOD module to ${MOD_HOME}"
printf '%s\n' "${col_pname}== Downloading ZPMOD module to ${MOD_HOME}"
if test -d "${MOD_HOME}/.git"; then
cd "${MOD_HOME}" || exit 255
git pull -q origin main
else
git clone --depth 10 -q https://github.com/z-shell/zpmod.git "$MOD_HOME"
git clone --depth 10 -q https://github.com/z-shell/zpmod.git "${MOD_HOME}"
fi
}

build_zpmod_module() {
if command -v zsh >/dev/null; then
printf '%s\n' "$col_info2-- Checking version --$col_rst"
printf '%s\n' "${col_info2}-- Checking version --${col_rst}"
ZSH_CURRENT=$(zsh --version </dev/null | head -n1 | cut -d" " -f2,6- | tr -d '-')
ZSH_REQUIRED="5.8"
if expr "$ZSH_CURRENT" \< "$ZSH_REQUIRED" >/dev/null; then
printf '%s\n' "$col_error-- Zsh version 5.8.1 and above required --$col_rst"
if expr "${ZSH_CURRENT}" \< "${ZSH_REQUIRED}" >/dev/null; then
printf '%s\n' "${col_error}-- Zsh version 5.8.1 and above required --${col_rst}"
exit 1
else
(
printf '%s\n' "$col_info2-- Zsh version $ZSH_CURRENT --$col_rst"
printf '%s\n' "${col_info2}-- Zsh version ${ZSH_CURRENT} --${col_rst}"
cd "${MOD_HOME}" || exit 255
printf '%s\n' "$col_pname== Building module ZPMOD, running: a make clean, then ./configure and then make ==$col_rst"
printf '%s\n' "$col_pname== The module sources are located at: ${MOD_HOME} ==$col_rst"
printf '%s\n' "${col_pname}== Building module ZPMOD, running: a make clean, then ./configure and then make ==${col_rst}"
printf '%s\n' "${col_pname}== The module sources are located at: ${MOD_HOME} ==${col_rst}"
if test -f Makefile; then
if [ "$1" = "--clean" ]; then
printf '%s\n' "$col_info2-- make distclean --$col_rst"
printf '%s\n' "${col_info2}-- make distclean --${col_rst}"
make distclean
true
else
printf '%s\n' "$col_info2-- make clean (pass --clean to invoke \`make distclean') --$col_rst"
printf '%s\n' "${col_info2}-- make clean (pass --clean to invoke \`make distclean') --${col_rst}"
make clean
fi
fi

INSTALL_PATH="/usr/local"
export PATH=$INSTALL_PATH/bin:"$PATH"
export LD_LIBRARY_PATH=$INSTALL_PATH/lib:"$LD_LIBRARY_PATH"
export CFLAGS=-I$INSTALL_PATH/include
export CPPFLAGS="-I$INSTALL_PATH/include" LDFLAGS="-L$INSTALL_PATH/lib"
export PATH="${INSTALL_PATH}"/bin:"${PATH}"
export LD_LIBRARY_PATH="${INSTALL_PATH}"/lib:"${LD_LIBRARY_PATH}"
export CFLAGS=-I"${INSTALL_PATH}"/include
export CPPFLAGS="-I${INSTALL_PATH}/include" LDFLAGS="-L${INSTALL_PATH}/lib"
CFLAGS="-g -Wall -O3" ./configure --disable-gdbm --without-tcsetpgrp --quiet

printf '%s\n' "$col_info2-- Running make --$col_rst"
printf '%s\n' "${col_info2}-- Running make --${col_rst}"
if make -j 4 >/dev/null && [ -f Src/zi/zpmod.so ]; then
cp -vf Src/zi/zpmod.so Src/zi/zpmod.bundle
command cat <<-EOF
▓▒░ Module has been built correctly.
▓▒░ To load the module, add following 2 lines to .zshrc, at top:
[0m [38;5;51m module_path+=( "$MOD_HOME/Src" )
[0m [38;5;51m module_path+=( "${MOD_HOME}/Src" )
  zmodload zi/zpmod
▓▒░ See 'zpmod -h' for more information.
▓▒░ Run 'zpmod source-study' to see profile data,
▓▒░ Guaranteed, automatic compilation of any sourced script.
EOF
else
printf '%s\n' "${col_error}Module didn't build.$col_rst. You can copy the error messages and submit"
printf '%s\n' "${col_error}Module didn't build.${col_rst}. You can copy the error messages and submit"
printf '%s\n' "error-report at: https://github.com/z-shell/zpmod/issues"
exit 255
fi
)
fi
else
printf '%s\n' "${col_error} Zsh is not installed. Please install zsh and try again.$col_rst"
printf '%s\n' "${col_error} Zsh is not installed. Please install zsh and try again.${col_rst}"
exit 255
fi
}
Expand Down

0 comments on commit d37a75a

Please sign in to comment.