manage external dependencies

This commit is contained in:
a-sansara 2017-07-06 23:16:57 +02:00
parent 0abc7d132b
commit 0a0dea72c7
9 changed files with 402 additions and 273 deletions

View File

@ -66,7 +66,7 @@ to use **bes-build** like a dependency manager, you need a `bes.ini` file in you
```ini ```ini
[require] [require]
bes.echo = 1.0 bes.echo = 1.1
``` ```
then you can run the `update` command before building then you can run the `update` command before building
@ -80,3 +80,30 @@ bes-build update
on next build, **bes-build** will append the dependencies to your dist file on next build, **bes-build** will append the dependencies to your dist file
### External dependencies
since version 0.6 you can now add external dependencies :
```ini
[require]
test.echo = https://git.pluie.org/meta-tech/bes-echo:master
```
### Releasing bes lib
if you intend to release your lib as a bes dependency you must provide a bes.ini file as following :
(example is taken from bes-echo)
```
[project]
vendor = bes
name = echo
version = 1.1
license = "GNU GPL v3"
author = a-Sansara
type = library
homepage = "https://git.pluie.org/meta-tech/bes-echo"
description = "bash bes display utility library"
keywords = "bash, bes"
```

323
dist/bes-build vendored
View File

@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.build(){ function bes.build ()
{
bes.echo.title "building project" "$APP_NAME" bes.echo.title "building project" "$APP_NAME"
if [ -d "$APP_DIR/src" ]; then if [ -d "$APP_DIR/src" ]; then
if [ ! -d "$APP_DIR/dist" ]; then if [ ! -d "$APP_DIR/dist" ]; then
@ -21,24 +22,25 @@ bes.build(){
fi fi
echo "#!/bin/bash" > $APP_BIN echo "#!/bin/bash" > $APP_BIN
bes.echo.action "reading ${Coff}dependencies" bes.echo.action "reading ${Coff}dependencies"
for vendor in "$APP_DIR/vendor/*"; do if [ -d "$APP_DIR/vendor" ]; then
if [ "$(basename $vendor)" != "." ] && [ "$(basename $vendor)" != ".." ]; then for vendor in $(ls $APP_DIR/vendor/); do
local vendorName="$(basename $vendor)" if [ "$vendor" != "." ] && [ "$vendor" != ".." ]; then
for project in "$vendor/*"; do for project in $(ls $APP_DIR/vendor/$vendor/); do
if [ "$(basename $project)" != "." ] && [ "$(basename $project)" != ".." ]; then if [ "$project" != "." ] && [ "$project" != ".." ]; then
for entry in "$project/src"/*.sh; do for entry in $(ls $APP_DIR/vendor/$vendor/$project/src/); do
local vendorName="$(basename $vendor)" local entrypath="$APP_DIR/vendor/$vendor/$project/src/$(basename $entry)"
local project="$(basename $(dirname $(dirname $entry)))" if [ -f "$entrypath" ] && [ "${entrypath: -3}" = ".sh" ]; then
local entrypath="$APP_DIR/vendor/$vendorName/$project/src/$(basename $entry)" tail -n +2 "$entrypath" >> "$APP_BIN"
if [ -f "$entrypath" ]; then bes.echo " ${Cspe}- ${Cok}appending ${Cusa}$vendorName/$project/${Coff}src/$(basename $entry)"
tail -n +2 "$entrypath" >> "$APP_BIN" fi
bes.echo " ${Cspe}- ${Cok}appending ${Cusa}$vendorName/$project/${Coff}src/$(basename $entry)" done
fi fi
done done
fi fi
done done
fi else
done bes.echo " no dependencies, did you forget to run bes-build update ?"
fi
bes.echo.state 0 bes.echo.state 0
bes.echo.action "reading ${Coff}src/" bes.echo.action "reading ${Coff}src/"
@ -63,9 +65,15 @@ bes.build(){
bes.echo.state 1 bes.echo.state 1
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.boot () #
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-echo
# @app bes-echo
# @license GNU GPL v3
# @date 2017-05-13 23:50:54 CET
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function bes.echo.boot ()
{ {
BES_TERM_WIDTH=${BES_TERM_WIDTH:-105} BES_TERM_WIDTH=${BES_TERM_WIDTH:-105}
BES_NOCOLOR=${BES_NOCOLOR:-0} BES_NOCOLOR=${BES_NOCOLOR:-0}
@ -84,7 +92,7 @@ bes.echo.boot ()
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo () function bes.echo ()
{ {
local msg=${1:-''} local msg=${1:-''}
local isAction=${2:-'0'} local isAction=${2:-'0'}
@ -106,19 +114,19 @@ bes.echo ()
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.action () function bes.echo.action ()
{ {
bes.echo "$1" 1 bes.echo "$1" 1
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.title () function bes.echo.title ()
{ {
echo echo
bes.echo " ${Citem}☪ ${Csection}$1 ${Cspe}$2${Coff}" bes.echo " ${Citem}☪ ${Csection}$1 ${Cspe}$2${Coff}"
echo echo
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.keyval () function bes.echo.keyval ()
{ {
local c=': ' local c=': '
if [ ! "$BES_NOCOLOR" = 1 ]; then if [ ! "$BES_NOCOLOR" = 1 ]; then
@ -129,7 +137,7 @@ bes.echo.keyval ()
bes.echo "$(printf $len $1) $c$2 " 1 " " bes.echo "$(printf $len $1) $c$2 " 1 " "
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.state () function bes.echo.state ()
{ {
local len=8 local len=8
printf "%0.s " $(seq 1 $(($BES_TERM_WIDTH-${len}))) printf "%0.s " $(seq 1 $(($BES_TERM_WIDTH-${len})))
@ -140,7 +148,7 @@ bes.echo.state ()
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.rs () function bes.echo.rs ()
{ {
local rs=${1:-0} local rs=${1:-0}
if [ "$rs" -eq 0 ]; then if [ "$rs" -eq 0 ]; then
@ -150,12 +158,12 @@ bes.echo.rs ()
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.error () function bes.echo.error ()
{ {
echo -e "\n${Cerr} error : ${Coff}\n\t$1 ${Coff}\n" echo -e "\n${Cerr} error : ${Coff}\n\t$1 ${Coff}\n"
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.sepline () function bes.echo.sepline ()
{ {
local char=${1:-'_'} local char=${1:-'_'}
local width=${2:-$BES_TERM_WIDTH} local width=${2:-$BES_TERM_WIDTH}
@ -164,7 +172,7 @@ bes.echo.sepline ()
echo -e "${Coff}" echo -e "${Coff}"
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.app () function bes.echo.app ()
{ {
local msg=${1:-''} local msg=${1:-''}
local version=${2:-''} local version=${2:-''}
@ -180,7 +188,7 @@ bes.echo.app ()
bes.echo.sepline bes.echo.sepline
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.colormap () function bes.echo.colormap ()
{ {
for fgbg in 38 48 ; do for fgbg in 38 48 ; do
for color in {0..256} ; do for color in {0..256} ; do
@ -194,8 +202,16 @@ bes.echo.colormap ()
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.boot bes.echo.boot
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# bes alter '__' to '_' #
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-echo
# @app bes-ini
# @license GNU GPL v3
# @date 2017-05-19 22:52:59 CET
#
# bes alter '__' to '_' , rename bes.ini to bes.ini
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# #
# > https://github.com/rudimeier/bash_ini_parser # > https://github.com/rudimeier/bash_ini_parser
# #
@ -210,14 +226,14 @@ bes.echo.boot
# #
# See README for usage. # See README for usage.
# #
# # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function read_ini() function bes.ini ()
{ {
# Be strict with the prefix, since it's going to be run through eval # Be strict with the prefix, since it's going to be run through eval
function check_prefix() function check_prefix()
{ {
if ! [[ "${VARNAME_PREFIX}" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]] ;then if ! [[ "${VARNAME_PREFIX}" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]] ;then
echo "read_ini: invalid prefix '${VARNAME_PREFIX}'" >&2 echo "bes.ini: invalid prefix '${VARNAME_PREFIX}'" >&2
return 1 return 1
fi fi
} }
@ -225,7 +241,7 @@ function read_ini()
function check_ini_file() function check_ini_file()
{ {
if [ ! -r "$INI_FILE" ] ;then if [ ! -r "$INI_FILE" ] ;then
echo "read_ini: '${INI_FILE}' doesn't exist or not" \ echo "bes.ini: '${INI_FILE}' doesn't exist or not" \
"readable" >&2 "readable" >&2
return 1 return 1
fi fi
@ -244,7 +260,7 @@ function read_ini()
} }
# unset all local functions and restore shopt settings before returning # unset all local functions and restore shopt settings before returning
# from read_ini() # from bes.ini()
function cleanup_bash() function cleanup_bash()
{ {
shopt -q -u ${SWITCH_SHOPT} shopt -q -u ${SWITCH_SHOPT}
@ -311,8 +327,8 @@ function read_ini()
done done
if [ -z "$INI_FILE" ] && [ "${CLEAN_ENV}" = 0 ] ;then if [ -z "$INI_FILE" ] && [ "${CLEAN_ENV}" = 0 ] ;then
echo -e "Usage: read_ini [-c] [-b 0| -b 1]] [-p PREFIX] FILE"\ echo -e "Usage: bes.ini [-c] [-b 0| -b 1]] [-p PREFIX] FILE"\
"[SECTION]\n or read_ini -c [-p PREFIX]" >&2 "[SECTION]\n or bes.ini -c [-p PREFIX]" >&2
cleanup_bash cleanup_bash
return 1 return 1
fi fi
@ -477,42 +493,40 @@ function read_ini()
cleanup_bash cleanup_bash
} }
# < https://github.com/rudimeier/bash_ini_parser # < https://github.com/rudimeier/bash_ini_parser
bes.ini(){
read_ini $*
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.install(){ function bes.install ()
local path=${1:-/usr/local/bin} {
local app=${1}
local url=${2}
local path=${3:-/usr/local/bin}
local done=1 local done=1
bes.echo.title "Installing bes-build ${Coff}in" "$path" bes.echo.title "Installing $app ${Coff}in" "$path"
if [ -f "./bes-build" ]; then if [ -f "./$app" ]; then
rm ./bes-build rm ./$app
fi fi
wget -q https://git.pluie.org/meta-tech/bes-build/raw/latest/dist/bes-build wget -q $url
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
chmod +x ./bes-build chmod +x ./$app
if [ -d $path ]; then if [ -d $path ]; then
sudo mv ./bes-build $path/bes-build sudo mv ./$app $path/$app
local done=$? local done=$?
bes.echo.state $done bes.echo.state $done
else else
bes.echo.error "install directory do not exists : ${Cspe}$path" bes.echo.error "install directory do not exists : ${Cspe}$path"
fi fi
else else
bes.echo.error "can not download latest version of bes-build" bes.echo.error "can not download latest version of app $app. please check url : $url"
fi fi
bes.echo.rs $done bes.echo.rs $done
} }
BES_LIB="echo" BES_LIB="echo install ini"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.inlist () function bes.inlist ()
{ {
local rs=1 local rs=1
if [[ "$2" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]] ; then if [[ "$2" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]] ; then
@ -521,119 +535,156 @@ bes.inlist ()
return $rs return $rs
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.update () function bes.update ()
{ {
bes.ini $APP_DIR/bes.ini -p bes -b 1
bes.echo.title "Reading Project" $APP_NAME bes.echo.title "Reading Project" $APP_NAME
bes.echo.keyval path $APP_DIR bes.echo.keyval path $APP_DIR
local keys="vendor name version license author"
local value=""
for key in $keys; do
value="bes_project_$key"
if [ ! -z "${!value}" ]; then
bes.echo.keyval $key "${!value}"
fi
done
bes.ini "$APP_DIR/bes.ini" require -p bes -b 1 if [ -f $APP_DIR/bes.ini ]; then
local prefix="bes_require" bes.ini $APP_DIR/bes.ini -p bes -b 1
local key=""
if [ ! -z "${bes_ALL_VARS}" ]; then local keys="vendor name version license author"
bes.echo.title "Checking Dependencies" local value=""
for name in ${bes_ALL_VARS}; do for key in $keys; do
key=${name:${#prefix}+1} value="bes_project_$key"
bes.echo.keyval ${key//_/.} ${!name} if [ ! -z "${!value}" ]; then
bes.echo.keyval $key "${!value}"
fi
done
bes.ini "$APP_DIR/bes.ini" require -p bes -b 1
local prefix="bes_require"
local key=""
local bescheck=1;
if [ ! -z "${bes_ALL_VARS}" ]; then
bes.echo.title "Checking Dependencies"
for name in ${bes_ALL_VARS}; do
key=${name:${#prefix}+1}
bes.echo.keyval ${key//_/.} ${!name}
done
echo echo
local project=${key#*_} for name in ${bes_ALL_VARS}; do
local vendor=${key%_*} key=${name:${#prefix}+1}
local version=${!name} bes.echo.title "Loading" "${key//_/.}${Cusa} ${!name}${Coff}"
local project=${key#*_}
if [ "$vendor" = "bes" ]; then local vendor=${key%_*}
if bes.inlist "$project" "$BES_LIB"; then local version=${!name}
bes.inlist "$project" "$BES_LIB"
if [ "$vendor" = "bes" ]; then
if bes.inlist "$project" "$BES_LIB"; then
if [ "$bescheck" = "1" ]; then
if [ ! -d "$APP_DIR/vendor/$vendor" ]; then
bes.echo.action "creating vendor directory ${Cusa}$vendor"
mkdir -p "$APP_DIR/vendor/$vendor"
else
bes.echo.action "checking vendor directory ${Cusa}$vendor"
fi
bes.echo.state $?
bescheck=0
fi
cd "$APP_DIR/vendor/$vendor"
bes.echo.action "updating repository $Cusa$vendor.$project ${Coff}:$Cusa $version"
if [ ! -d "$project" ]; then
git clone -q "https://git.pluie.org/meta-tech/$vendor-$project" "$project" 2>&1 >/dev/null
#~ bes.echo.state $?
cd $project
else
cd $project
git fetch --all -q 2>&1 >/dev/null
#~ bes.echo.state $?
fi
#~ bes.echo.action "checkout to version $Cusa$version"
local branch=$(git branch --no-color | grep \* | cut -d ' ' -f2-)
# branch=${branch:5: -3}
if [ "$branch" != "$version" ]; then
git checkout -q $version 2>&1 >/dev/null
fi
bes.echo.state $?
for entry in "$APP_DIR/vendor/$vendor/$project/src"/*.sh; do
bes.echo " ${Cspe}- ${Cok}set for autoloading ${Coff}src/$(basename $entry)"
# tail -n +2 "$entry" >> "$APP_BIN"
done
bes.echo.state $?
fi
else
if [ ! -d "$APP_DIR/vendor/$vendor" ]; then if [ ! -d "$APP_DIR/vendor/$vendor" ]; then
bes.echo.action "creating vendor directory ${Cusa}$vendor" bes.echo.action "creating vendor directory ${Cusa}$vendor"
mkdir -p "$APP_DIR/vendor/$vendor" mkdir -p "$APP_DIR/vendor/$vendor"
else bes.echo.state $?
bes.echo.action "checking vendor directory ${Cusa}$vendor"
fi fi
bes.echo.state $? if [ "${version:0:4}" = "http" ]; then
cd "$APP_DIR/vendor/$vendor" local req=${!name}
bes.echo.action "updating repository $Cusa$vendor.$project ${Coff}:$Cusa $version" local path=${req#*:}
if [ ! -d "$project" ]; then local tag=${req##*:}
git clone -q "https://git.pluie.org/meta-tech/$vendor-$project" "$project" 2>&1 >/dev/null local repo=${req%:*}
#~ bes.echo.state $? echo "$APP_DIR/vendor/$vendor/$project"
cd $project echo $(pwd)
else if [ ! -d "$APP_DIR/vendor/$vendor/$project" ]; then
cd $project mkdir "$APP_DIR/vendor/$vendor"
git fetch --all -q 2>&1 >/dev/null cd $_
#~ bes.echo.state $? git clone $repo $project
fi
cd "$APP_DIR/vendor/$vendor/$project"
git checkout $tag
for entry in "$APP_DIR/vendor/$vendor/$project/src"/*.sh; do
bes.echo " ${Cspe}- ${Cok}set for autoloading ${Coff}src/$(basename $entry)"
# tail -n +2 "$entry" >> "$APP_BIN"
done
bes.echo.state $?
fi fi
#~ bes.echo.action "checkout to version $Cusa$version"
local branch=$(git branch --no-color | grep \* | cut -d ' ' -f2-)
# branch=${branch:5: -3}
if [ "$branch" != "$version" ]; then
git checkout -q -b $version 2>&1 >/dev/null
fi
bes.echo.state $?
for entry in "$APP_DIR/vendor/$vendor/$project/src"/*.sh; do
bes.echo " ${Cspe}- ${Cok}set for autoloading ${Coff}src/$(basename $entry)"
# tail -n +2 "$entry" >> "$APP_BIN"
done
bes.echo.state $?
fi fi
fi bes.echo.rs
bes.echo.rs done
fi
local req=${!name} else
local path=${req#*:} echo
local repo=${req%:*} bes.echo ' no bes.ini file for your project'
local repoName=bes_repo_$repo bes.echo.state
local repoVar=${!repoName}
local src=${!repoName}$path
#~ echo "$name : ${!name}"
#~ echo "\$req : ${req}"
#~ echo "\$repo : ${repo}"
#~ echo "\$path : ${path}"
#~ echo "\$repoName : ${repoName}"
#~ echo "\$repoVar : ${repoVar}"
#~ echo "\$src : ${src}"
done
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.usage(){ function bes.usage ()
{
echo -e " ${Cusa}Usage :${Coff}\n echo -e " ${Cusa}Usage :${Coff}\n
${Ccom}\tBuild current project (overwrite existing build) ${Ccom}\tBuild current project (overwrite existing build)
${Cspe}\tbes-build ${Copt} ${Cspe}\t$APP_NAME ${Copt}
${Ccom}\tBuild current project and backup existing build ${Ccom}\tBuild current project and backup existing build
${Cspe}\tbes-build ${Copt}-b${Ctext}, ${Copt}backup ${Cspe}\t$APP_NAME ${Copt}-b${Ctext}, ${Copt}backup
${Ccom}\tInstall or update bes-build on specified BINDIR directory or in /etc/local/bin directory ${Ccom}\tInstall or update $APP_NAME on specified BINDIR directory or in /etc/local/bin directory
${Cspe}\tbes-build ${Copt}-i${Ctext}, ${Copt}install ${Copt}[ ${Ctext}BINDIR${Copt} ] ${Cspe}\t$APP_NAME ${Copt}-i${Ctext}, ${Copt}install ${Copt}[ ${Ctext}BINDIR${Copt} ]
${Ccom}\tDisplay program version ${Ccom}\tDisplay program version
${Cspe}\tbes-build ${Copt}-v${Ctext}, ${Copt}version ${Cspe}\t$APP_NAME ${Copt}-v${Ctext}, ${Copt}version
${Ccom}\tDisplay this help ${Ccom}\tDisplay this help
${Cspe}\tbes-build ${Copt}-h${Ctext}, ${Copt}help" ${Cspe}\t$APP_NAME ${Copt}-h${Ctext}, ${Copt}help"
echo -e "${Coff}" echo -e "${Coff}"
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_BUILD_VERSION=0.6 #
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-build
# @app bes-build
# @license GNU GPL v3
# @date 2017-06-16 04:38:52 CET
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_VERSION=0.6
BES_NAME="bes-build"
BES_URL="https://git.pluie.org/meta-tech/$BES_NAME/raw/latest/dist/$BES_NAME"
APP_DIR=$(pwd) APP_DIR=$(pwd)
APP_NAME=$(basename $(pwd)) APP_NAME=$(basename $(pwd))
APP_BIN=$APP_DIR/dist/$APP_NAME APP_BIN=$APP_DIR/dist/$APP_NAME
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.main(){ function bes.main ()
{
if [ "$1" = "version" ] || [ "$1" = "-v" ]; then if [ "$1" = "version" ] || [ "$1" = "-v" ]; then
echo $BES_BUILD_VERSION echo $BES_VERSION
else else
bes.echo.app 'bes-build' $BES_BUILD_VERSION bes.echo.app "$BES_NAME" "$BES_VERSION"
echo echo
if [ "$1" = "install" ] || [ "$1" = "-i" ]; then if [ "$1" = "install" ] || [ "$1" = "-i" ]; then
bes.install "$2" bes.install "$BES_NAME" "$BES_URL" "$2"
elif [ "$1" = "help" ] || [ "$1" = "-h" ]; then elif [ "$1" = "help" ] || [ "$1" = "-h" ]; then
bes.usage bes.usage
elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then

View File

@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.build(){ function bes.build ()
{
bes.echo.title "building project" "$APP_NAME" bes.echo.title "building project" "$APP_NAME"
if [ -d "$APP_DIR/src" ]; then if [ -d "$APP_DIR/src" ]; then
if [ ! -d "$APP_DIR/dist" ]; then if [ ! -d "$APP_DIR/dist" ]; then
@ -21,24 +22,25 @@ bes.build(){
fi fi
echo "#!/bin/bash" > $APP_BIN echo "#!/bin/bash" > $APP_BIN
bes.echo.action "reading ${Coff}dependencies" bes.echo.action "reading ${Coff}dependencies"
for vendor in "$APP_DIR/vendor/*"; do if [ -d "$APP_DIR/vendor" ]; then
if [ "$(basename $vendor)" != "." ] && [ "$(basename $vendor)" != ".." ]; then for vendor in $(ls $APP_DIR/vendor/); do
local vendorName="$(basename $vendor)" if [ "$vendor" != "." ] && [ "$vendor" != ".." ]; then
for project in "$vendor/*"; do for project in $(ls $APP_DIR/vendor/$vendor/); do
if [ "$(basename $project)" != "." ] && [ "$(basename $project)" != ".." ]; then if [ "$project" != "." ] && [ "$project" != ".." ]; then
for entry in "$project/src"/*.sh; do for entry in $(ls $APP_DIR/vendor/$vendor/$project/src/); do
local vendorName="$(basename $vendor)" local entrypath="$APP_DIR/vendor/$vendor/$project/src/$(basename $entry)"
local project="$(basename $(dirname $(dirname $entry)))" if [ -f "$entrypath" ] && [ "${entrypath: -3}" = ".sh" ]; then
local entrypath="$APP_DIR/vendor/$vendorName/$project/src/$(basename $entry)" tail -n +2 "$entrypath" >> "$APP_BIN"
if [ -f "$entrypath" ]; then bes.echo " ${Cspe}- ${Cok}appending ${Cusa}$vendorName/$project/${Coff}src/$(basename $entry)"
tail -n +2 "$entrypath" >> "$APP_BIN" fi
bes.echo " ${Cspe}- ${Cok}appending ${Cusa}$vendorName/$project/${Coff}src/$(basename $entry)" done
fi fi
done done
fi fi
done done
fi else
done bes.echo " no dependencies, did you forget to run bes-build update ?"
fi
bes.echo.state 0 bes.echo.state 0
bes.echo.action "reading ${Coff}src/" bes.echo.action "reading ${Coff}src/"

View File

@ -1,7 +1,13 @@
#!/bin/bash #!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.boot () #
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-echo
# @app bes-echo
# @license GNU GPL v3
# @date 2017-05-13 23:50:54 CET
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function bes.echo.boot ()
{ {
BES_TERM_WIDTH=${BES_TERM_WIDTH:-105} BES_TERM_WIDTH=${BES_TERM_WIDTH:-105}
BES_NOCOLOR=${BES_NOCOLOR:-0} BES_NOCOLOR=${BES_NOCOLOR:-0}
@ -20,7 +26,7 @@ bes.echo.boot ()
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo () function bes.echo ()
{ {
local msg=${1:-''} local msg=${1:-''}
local isAction=${2:-'0'} local isAction=${2:-'0'}
@ -42,19 +48,19 @@ bes.echo ()
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.action () function bes.echo.action ()
{ {
bes.echo "$1" 1 bes.echo "$1" 1
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.title () function bes.echo.title ()
{ {
echo echo
bes.echo " ${Citem}${Csection}$1 ${Cspe}$2${Coff}" bes.echo " ${Citem}${Csection}$1 ${Cspe}$2${Coff}"
echo echo
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.keyval () function bes.echo.keyval ()
{ {
local c=': ' local c=': '
if [ ! "$BES_NOCOLOR" = 1 ]; then if [ ! "$BES_NOCOLOR" = 1 ]; then
@ -65,7 +71,7 @@ bes.echo.keyval ()
bes.echo "$(printf $len $1) $c$2 " 1 " " bes.echo "$(printf $len $1) $c$2 " 1 " "
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.state () function bes.echo.state ()
{ {
local len=8 local len=8
printf "%0.s " $(seq 1 $(($BES_TERM_WIDTH-${len}))) printf "%0.s " $(seq 1 $(($BES_TERM_WIDTH-${len})))
@ -76,7 +82,7 @@ bes.echo.state ()
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.rs () function bes.echo.rs ()
{ {
local rs=${1:-0} local rs=${1:-0}
if [ "$rs" -eq 0 ]; then if [ "$rs" -eq 0 ]; then
@ -86,12 +92,12 @@ bes.echo.rs ()
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.error () function bes.echo.error ()
{ {
echo -e "\n${Cerr} error : ${Coff}\n\t$1 ${Coff}\n" echo -e "\n${Cerr} error : ${Coff}\n\t$1 ${Coff}\n"
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.sepline () function bes.echo.sepline ()
{ {
local char=${1:-'_'} local char=${1:-'_'}
local width=${2:-$BES_TERM_WIDTH} local width=${2:-$BES_TERM_WIDTH}
@ -100,7 +106,7 @@ bes.echo.sepline ()
echo -e "${Coff}" echo -e "${Coff}"
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.app () function bes.echo.app ()
{ {
local msg=${1:-''} local msg=${1:-''}
local version=${2:-''} local version=${2:-''}
@ -116,7 +122,7 @@ bes.echo.app ()
bes.echo.sepline bes.echo.sepline
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.echo.colormap () function bes.echo.colormap ()
{ {
for fgbg in 38 48 ; do for fgbg in 38 48 ; do
for color in {0..256} ; do for color in {0..256} ; do

View File

@ -1,6 +1,14 @@
#!/bin/bash #!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# bes alter '__' to '_' #
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-echo
# @app bes-ini
# @license GNU GPL v3
# @date 2017-05-19 22:52:59 CET
#
# bes alter '__' to '_' , rename bes.ini to bes.ini
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# #
# > https://github.com/rudimeier/bash_ini_parser # > https://github.com/rudimeier/bash_ini_parser
# #
@ -15,14 +23,14 @@
# #
# See README for usage. # See README for usage.
# #
# # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function read_ini() function bes.ini ()
{ {
# Be strict with the prefix, since it's going to be run through eval # Be strict with the prefix, since it's going to be run through eval
function check_prefix() function check_prefix()
{ {
if ! [[ "${VARNAME_PREFIX}" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]] ;then if ! [[ "${VARNAME_PREFIX}" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]] ;then
echo "read_ini: invalid prefix '${VARNAME_PREFIX}'" >&2 echo "bes.ini: invalid prefix '${VARNAME_PREFIX}'" >&2
return 1 return 1
fi fi
} }
@ -30,7 +38,7 @@ function read_ini()
function check_ini_file() function check_ini_file()
{ {
if [ ! -r "$INI_FILE" ] ;then if [ ! -r "$INI_FILE" ] ;then
echo "read_ini: '${INI_FILE}' doesn't exist or not" \ echo "bes.ini: '${INI_FILE}' doesn't exist or not" \
"readable" >&2 "readable" >&2
return 1 return 1
fi fi
@ -49,7 +57,7 @@ function read_ini()
} }
# unset all local functions and restore shopt settings before returning # unset all local functions and restore shopt settings before returning
# from read_ini() # from bes.ini()
function cleanup_bash() function cleanup_bash()
{ {
shopt -q -u ${SWITCH_SHOPT} shopt -q -u ${SWITCH_SHOPT}
@ -116,8 +124,8 @@ function read_ini()
done done
if [ -z "$INI_FILE" ] && [ "${CLEAN_ENV}" = 0 ] ;then if [ -z "$INI_FILE" ] && [ "${CLEAN_ENV}" = 0 ] ;then
echo -e "Usage: read_ini [-c] [-b 0| -b 1]] [-p PREFIX] FILE"\ echo -e "Usage: bes.ini [-c] [-b 0| -b 1]] [-p PREFIX] FILE"\
"[SECTION]\n or read_ini -c [-p PREFIX]" >&2 "[SECTION]\n or bes.ini -c [-p PREFIX]" >&2
cleanup_bash cleanup_bash
return 1 return 1
fi fi
@ -282,9 +290,4 @@ function read_ini()
cleanup_bash cleanup_bash
} }
# < https://github.com/rudimeier/bash_ini_parser # < https://github.com/rudimeier/bash_ini_parser
bes.ini(){
read_ini $*
}

View File

@ -1,26 +1,29 @@
#!/bin/bash #!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.install(){ function bes.install ()
local path=${1:-/usr/local/bin} {
local app=${1}
local url=${2}
local path=${3:-/usr/local/bin}
local done=1 local done=1
bes.echo.title "Installing bes-build ${Coff}in" "$path" bes.echo.title "Installing $app ${Coff}in" "$path"
if [ -f "./bes-build" ]; then if [ -f "./$app" ]; then
rm ./bes-build rm ./$app
fi fi
wget -q https://git.pluie.org/meta-tech/bes-build/raw/latest/dist/bes-build wget -q $url
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
chmod +x ./bes-build chmod +x ./$app
if [ -d $path ]; then if [ -d $path ]; then
sudo mv ./bes-build $path/bes-build sudo mv ./$app $path/$app
local done=$? local done=$?
bes.echo.state $done bes.echo.state $done
else else
bes.echo.error "install directory do not exists : ${Cspe}$path" bes.echo.error "install directory do not exists : ${Cspe}$path"
fi fi
else else
bes.echo.error "can not download latest version of bes-build" bes.echo.error "can not download latest version of app $app. please check url : $url"
fi fi
bes.echo.rs $done bes.echo.rs $done
} }

View File

@ -1,20 +1,29 @@
#!/bin/bash #!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_BUILD_VERSION=0.6 #
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-build
# @app bes-build
# @license GNU GPL v3
# @date 2017-06-16 04:38:52 CET
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_VERSION=0.6
BES_NAME="bes-build"
BES_URL="https://git.pluie.org/meta-tech/$BES_NAME/raw/latest/dist/$BES_NAME"
APP_DIR=$(pwd) APP_DIR=$(pwd)
APP_NAME=$(basename $(pwd)) APP_NAME=$(basename $(pwd))
APP_BIN=$APP_DIR/dist/$APP_NAME APP_BIN=$APP_DIR/dist/$APP_NAME
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.main(){ function bes.main ()
{
if [ "$1" = "version" ] || [ "$1" = "-v" ]; then if [ "$1" = "version" ] || [ "$1" = "-v" ]; then
echo $BES_BUILD_VERSION echo $BES_VERSION
else else
bes.echo.app 'bes-build' $BES_BUILD_VERSION bes.echo.app "$BES_NAME" "$BES_VERSION"
echo echo
if [ "$1" = "install" ] || [ "$1" = "-i" ]; then if [ "$1" = "install" ] || [ "$1" = "-i" ]; then
bes.install "$2" bes.install "$BES_NAME" "$BES_URL" "$2"
elif [ "$1" = "help" ] || [ "$1" = "-h" ]; then elif [ "$1" = "help" ] || [ "$1" = "-h" ]; then
bes.usage bes.usage
elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then

View File

@ -1,9 +1,9 @@
#!/bin/bash #!/bin/bash
BES_LIB="echo" BES_LIB="echo install ini"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.inlist () function bes.inlist ()
{ {
local rs=1 local rs=1
if [[ "$2" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]] ; then if [[ "$2" =~ (^|[[:space:]])"$1"($|[[:space:]]) ]] ; then
@ -12,83 +12,110 @@ bes.inlist ()
return $rs return $rs
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.update () function bes.update ()
{ {
bes.ini $APP_DIR/bes.ini -p bes -b 1
bes.echo.title "Reading Project" $APP_NAME bes.echo.title "Reading Project" $APP_NAME
bes.echo.keyval path $APP_DIR bes.echo.keyval path $APP_DIR
local keys="vendor name version license author"
local value=""
for key in $keys; do
value="bes_project_$key"
if [ ! -z "${!value}" ]; then
bes.echo.keyval $key "${!value}"
fi
done
bes.ini "$APP_DIR/bes.ini" require -p bes -b 1 if [ -f $APP_DIR/bes.ini ]; then
local prefix="bes_require" bes.ini $APP_DIR/bes.ini -p bes -b 1
local key=""
if [ ! -z "${bes_ALL_VARS}" ]; then local keys="vendor name version license author"
bes.echo.title "Checking Dependencies" local value=""
for name in ${bes_ALL_VARS}; do for key in $keys; do
key=${name:${#prefix}+1} value="bes_project_$key"
bes.echo.keyval ${key//_/.} ${!name} if [ ! -z "${!value}" ]; then
bes.echo.keyval $key "${!value}"
fi
done
bes.ini "$APP_DIR/bes.ini" require -p bes -b 1
local prefix="bes_require"
local key=""
local bescheck=1;
if [ ! -z "${bes_ALL_VARS}" ]; then
bes.echo.title "Checking Dependencies"
for name in ${bes_ALL_VARS}; do
key=${name:${#prefix}+1}
bes.echo.keyval ${key//_/.} ${!name}
done
echo echo
local project=${key#*_} for name in ${bes_ALL_VARS}; do
local vendor=${key%_*} key=${name:${#prefix}+1}
local version=${!name} bes.echo.title "Loading" "${key//_/.}${Cusa} ${!name}${Coff}"
local project=${key#*_}
if [ "$vendor" = "bes" ]; then local vendor=${key%_*}
if bes.inlist "$project" "$BES_LIB"; then local version=${!name}
bes.inlist "$project" "$BES_LIB"
if [ "$vendor" = "bes" ]; then
if bes.inlist "$project" "$BES_LIB"; then
if [ "$bescheck" = "1" ]; then
if [ ! -d "$APP_DIR/vendor/$vendor" ]; then
bes.echo.action "creating vendor directory ${Cusa}$vendor"
mkdir -p "$APP_DIR/vendor/$vendor"
else
bes.echo.action "checking vendor directory ${Cusa}$vendor"
fi
bes.echo.state $?
bescheck=0
fi
cd "$APP_DIR/vendor/$vendor"
bes.echo.action "updating repository $Cusa$vendor.$project ${Coff}:$Cusa $version"
if [ ! -d "$project" ]; then
git clone -q "https://git.pluie.org/meta-tech/$vendor-$project" "$project" 2>&1 >/dev/null
#~ bes.echo.state $?
cd $project
else
cd $project
git fetch --all -q 2>&1 >/dev/null
#~ bes.echo.state $?
fi
#~ bes.echo.action "checkout to version $Cusa$version"
local branch=$(git branch --no-color | grep \* | cut -d ' ' -f2-)
# branch=${branch:5: -3}
if [ "$branch" != "$version" ]; then
git checkout -q $version 2>&1 >/dev/null
fi
bes.echo.state $?
for entry in "$APP_DIR/vendor/$vendor/$project/src"/*.sh; do
bes.echo " ${Cspe}- ${Cok}set for autoloading ${Coff}src/$(basename $entry)"
# tail -n +2 "$entry" >> "$APP_BIN"
done
bes.echo.state $?
fi
else
if [ ! -d "$APP_DIR/vendor/$vendor" ]; then if [ ! -d "$APP_DIR/vendor/$vendor" ]; then
bes.echo.action "creating vendor directory ${Cusa}$vendor" bes.echo.action "creating vendor directory ${Cusa}$vendor"
mkdir -p "$APP_DIR/vendor/$vendor" mkdir -p "$APP_DIR/vendor/$vendor"
else bes.echo.state $?
bes.echo.action "checking vendor directory ${Cusa}$vendor"
fi fi
bes.echo.state $? if [ "${version:0:4}" = "http" ]; then
cd "$APP_DIR/vendor/$vendor" local req=${!name}
bes.echo.action "updating repository $Cusa$vendor.$project ${Coff}:$Cusa $version" local path=${req#*:}
if [ ! -d "$project" ]; then local tag=${req##*:}
git clone -q "https://git.pluie.org/meta-tech/$vendor-$project" "$project" 2>&1 >/dev/null local repo=${req%:*}
#~ bes.echo.state $? echo "$APP_DIR/vendor/$vendor/$project"
cd $project echo $(pwd)
else if [ ! -d "$APP_DIR/vendor/$vendor/$project" ]; then
cd $project mkdir "$APP_DIR/vendor/$vendor"
git fetch --all -q 2>&1 >/dev/null cd $_
#~ bes.echo.state $? git clone $repo $project
fi
cd "$APP_DIR/vendor/$vendor/$project"
git checkout $tag
for entry in "$APP_DIR/vendor/$vendor/$project/src"/*.sh; do
bes.echo " ${Cspe}- ${Cok}set for autoloading ${Coff}src/$(basename $entry)"
# tail -n +2 "$entry" >> "$APP_BIN"
done
bes.echo.state $?
fi fi
#~ bes.echo.action "checkout to version $Cusa$version"
local branch=$(git branch --no-color | grep \* | cut -d ' ' -f2-)
# branch=${branch:5: -3}
if [ "$branch" != "$version" ]; then
git checkout -q -b $version 2>&1 >/dev/null
fi
bes.echo.state $?
for entry in "$APP_DIR/vendor/$vendor/$project/src"/*.sh; do
bes.echo " ${Cspe}- ${Cok}set for autoloading ${Coff}src/$(basename $entry)"
# tail -n +2 "$entry" >> "$APP_BIN"
done
bes.echo.state $?
fi fi
fi bes.echo.rs
bes.echo.rs done
fi
local req=${!name} else
local path=${req#*:} echo
local repo=${req%:*} bes.echo ' no bes.ini file for your project'
local repoName=bes_repo_$repo bes.echo.state
local repoVar=${!repoName}
local src=${!repoName}$path
#~ echo "$name : ${!name}"
#~ echo "\$req : ${req}"
#~ echo "\$repo : ${repo}"
#~ echo "\$path : ${path}"
#~ echo "\$repoName : ${repoName}"
#~ echo "\$repoVar : ${repoVar}"
#~ echo "\$src : ${src}"
done
fi fi
} }

View File

@ -1,18 +1,19 @@
#!/bin/bash #!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.usage(){ function bes.usage ()
{
echo -e " ${Cusa}Usage :${Coff}\n echo -e " ${Cusa}Usage :${Coff}\n
${Ccom}\tBuild current project (overwrite existing build) ${Ccom}\tBuild current project (overwrite existing build)
${Cspe}\tbes-build ${Copt} ${Cspe}\t$APP_NAME ${Copt}
${Ccom}\tBuild current project and backup existing build ${Ccom}\tBuild current project and backup existing build
${Cspe}\tbes-build ${Copt}-b${Ctext}, ${Copt}backup ${Cspe}\t$APP_NAME ${Copt}-b${Ctext}, ${Copt}backup
${Ccom}\tInstall or update bes-build on specified BINDIR directory or in /etc/local/bin directory ${Ccom}\tInstall or update $APP_NAME on specified BINDIR directory or in /etc/local/bin directory
${Cspe}\tbes-build ${Copt}-i${Ctext}, ${Copt}install ${Copt}[ ${Ctext}BINDIR${Copt} ] ${Cspe}\t$APP_NAME ${Copt}-i${Ctext}, ${Copt}install ${Copt}[ ${Ctext}BINDIR${Copt} ]
${Ccom}\tDisplay program version ${Ccom}\tDisplay program version
${Cspe}\tbes-build ${Copt}-v${Ctext}, ${Copt}version ${Cspe}\t$APP_NAME ${Copt}-v${Ctext}, ${Copt}version
${Ccom}\tDisplay this help ${Ccom}\tDisplay this help
${Cspe}\tbes-build ${Copt}-h${Ctext}, ${Copt}help" ${Cspe}\t$APP_NAME ${Copt}-h${Ctext}, ${Copt}help"
echo -e "${Coff}" echo -e "${Coff}"
} }