Compare commits

..

3 Commits
0.11 ... master

Author SHA1 Message Date
98dd0da601 update migration to meta-tech.academy 2022-11-06 23:23:40 +01:00
a-Sansara
1ee9ac25e7 version 0.13 - add cmd new project 2021-03-02 01:39:55 +01:00
a-Sansara
bc386594d9 version 0.12 - add secure lib 2019-11-18 14:06:10 +01:00
9 changed files with 275 additions and 43 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.3 bes.echo = 1.4
``` ```
then you can run the `update` command before building then you can run the `update` command before building
@ -86,7 +86,7 @@ since version 0.6 you can now add external dependencies :
```ini ```ini
[require] [require]
test.echo = https://git.pluie.org/meta-tech/bes-echo:master test.echo = https://gitea.meta-tech.academy/meta-tech/bes-echo:master
``` ```
@ -99,14 +99,14 @@ if you intend to release your lib as a bes dependency you must provide a bes.ini
[project] [project]
vendor = bes vendor = bes
name = echo name = echo
version = 1.3 version = 1.4
license = "GNU GPL v3" license = "GNU GPL v3"
author = a-Sansara author = a-Sansara
type = library type = library
homepage = "https://git.pluie.org/meta-tech/bes-echo" homepage = "https://gitea.meta-tech.academy/meta-tech/bes-echo"
description = "bash bes display utility library" description = "bash bes display utility library"
keywords = "bash, bes" keywords = "bash, bes"
[require] [require]
bes.color = 1.3 bes.color = 1.4
``` ```

View File

@ -1,11 +1,11 @@
[project] [project]
vendor = bes vendor = bes
name = build name = build
version = 0.11 version = 0.13
license = "GNU GPL v3" license = "GNU GPL v3"
author = a-Sansara author = a-Sansara
type = application type = application
homepage = "https://git.pluie.org/meta-tech/bes-build" homepage = "https://gitea.meta-tech.academy/meta-tech/bes-build"
description = "bash bes build application for bash programs" description = "bash bes build application for bash programs"
keywords = "bash, bes, build" keywords = "bash, bes, build"

137
dist/bes-build vendored
View File

@ -743,7 +743,102 @@ meta = 39 100 170" > "$tmp"
fi fi
} }
BES_LIB="color echo install ini service dep1 dep2" function bes.build.new () {
local prj=${1}
echo.title "creating new project" "$prj"
if [ -d "$APP_DIR/$prj" ]; then
echo.error "directory $prj already exists" 1
else
echo.action "creating directory" "$prj" "*" "Cusa"
mkdir "$APP_DIR/$prj"
echo.state $?
echo.action "creating project config file" "bes.ini" "*" "Cusa"
echo -e "[project]
vendor =
name = $prj
version = 0.1
license = \"GNU GPL v3\"
author =
type = application
homepage =
description = \"bash bes $prj application\"
keywords = \"bash $prj\"
[require]
bes.install = 1.4
" > "$APP_DIR/$prj/bes.ini"
echo.state $?
echo.action "Creating directory" "src" "*" "Cusa"
mkdir $APP_DIR/$prj/src
echo.state $?
echo.action "Adding default templates" "main" "*" "Cusa"
echo "#!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_VERSION=0.1
BES_AUTHOR=me
BES_LICENSE=MIT
BES_NAME=\"$prj\"
BES_URL=\"https://your.forge.git/vendor/\$BES_NAME/raw/latest/dist/\$BES_NAME\"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function $prj.main ()
{
echo.msg \"hello bes\" \"\$Citem\"
echo.rs \$?
echo
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function bes.main ()
{
if [ \"\$1\" = \"version\" ] || [ \"\$1\" = \"-v\" ]; then
echo \$BES_VERSION
else
echo.app \"\$BES_NAME\" \"\$BES_VERSION\" \"\$BES_AUTHOR\" \"\$BES_LICENSE\"
echo
if [ \"\$1\" = \"install\" ] || [ \"\$1\" = \"-i\" ]; then
bes.install \"\$BES_NAME\" \"\$BES_URL\" \"\$2\"
elif [ \"\$1\" = \"help\" ] || [ \"\$1\" = \"-h\" ]; then
$prj.usage
else
$prj.main
fi
echo
fi
}
bes.main \$*
" > "$APP_DIR/$prj/src/main.sh"
echo.state $?
echo.action "Adding default template" "usage" "*" "Cusa"
echo "#!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function $prj.usage ()
{
echo -e \" \${Cusa}Usage :\${Coff}\n
\${Ccom}\tInstall or update \$BES_NAME on specified BINDIR directory or in /usr/local/bin directory
\${Cspe}\t\$BES_NAME \${Copt}-i\${Ctext}, \${Copt}install \${Copt}[ \${Ctext}BINDIR\${Copt} ]
\${Ccom}\tDisplay program version
\${Cspe}\t\$BES_NAME \${Copt}-v\${Ctext}, \${Copt}version
\${Ccom}\tDisplay this help
\${Cspe}\t\$BES_NAME \${Copt}-h\${Ctext}, \${Copt}help\"
echo -e \"${Coff}\"
}
" > "$APP_DIR/$prj/src/usage.sh"
echo.state $?
echo.rs $?
echo
fi
}
function bes.build.require () {
local dep=${1}
echo.msg "coming soon"
echo.rs 1
}
BES_LIB="color echo install ini service secure dep1 dep2"
BES_LOADED_LIB= BES_LOADED_LIB=
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function bes.inlist () function bes.inlist ()
@ -833,7 +928,7 @@ function bes.loadDep ()
cd "$APP_DIR/vendor/$vendor" cd "$APP_DIR/vendor/$vendor"
echo.action "updating repository $Cusa$vendor.$project ${Coff}:$Cusa $version" echo.action "updating repository $Cusa$vendor.$project ${Coff}:$Cusa $version"
if [ ! -d "$project" ]; then if [ ! -d "$project" ]; then
git clone -q "https://git.pluie.org/meta-tech/$vendor-$project" "$project" 2>&1 >/dev/null git clone -q "https://gitea.meta-tech.academy/meta-tech/$vendor-$project" "$project" 2>&1 >/dev/null
#~ echo.state $? #~ echo.state $?
cd $project cd $project
else else
@ -918,16 +1013,20 @@ function bes.update ()
function bes.usage () function bes.usage ()
{ {
echo -e " ${Cusa}Usage :${Coff}\n echo -e " ${Cusa}Usage :${Coff}\n
${Ccom}\tCreate new bes project
${Cspe}\t$BES_NAME ${Copt}-n${Ctext}, ${Copt}new ${Copt}[ ${Ctext}PROJECT_NAME${Copt} ]
${Ccom}\tUpdate current project dependencies
${Cspe}\t$BES_NAME ${Copt}-u${Ctext}, ${Copt}update
${Ccom}\tBuild current project (overwrite existing build) ${Ccom}\tBuild current project (overwrite existing build)
${Cspe}\t$APP_NAME ${Copt} ${Cspe}\t$BES_NAME ${Copt}
${Ccom}\tBuild current project and backup existing build ${Ccom}\tBuild current project and backup existing build
${Cspe}\t$APP_NAME ${Copt}-b${Ctext}, ${Copt}backup ${Cspe}\t$BES_NAME ${Copt}-b${Ctext}, ${Copt}backup
${Ccom}\tInstall or update $APP_NAME on specified BINDIR directory or in /usr/local/bin directory ${Ccom}\tInstall or update $APP_NAME on specified BINDIR directory or in /usr/local/bin directory
${Cspe}\t$APP_NAME ${Copt}-i${Ctext}, ${Copt}install ${Copt}[ ${Ctext}BINDIR${Copt} ] ${Cspe}\t$BES_NAME ${Copt}-i${Ctext}, ${Copt}install ${Copt}[ ${Ctext}BINDIR${Copt} ]
${Ccom}\tDisplay program version ${Ccom}\tDisplay program version
${Cspe}\t$APP_NAME ${Copt}-v${Ctext}, ${Copt}version ${Cspe}\t$BES_NAME ${Copt}-v${Ctext}, ${Copt}version
${Ccom}\tDisplay this help ${Ccom}\tDisplay this help
${Cspe}\t$APP_NAME ${Copt}-h${Ctext}, ${Copt}help" ${Cspe}\t$BES_NAME ${Copt}-h${Ctext}, ${Copt}help"
echo -e "${Coff}" echo -e "${Coff}"
} }
@ -935,15 +1034,15 @@ function bes.usage ()
bes.boot bes.boot
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# #
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-build # @author a-Sansara - https://gitea.meta-tech.academy/meta-tech/bes-build
# @app bes-build # @app bes-build
# @license GNU GPL v3 # @license GNU GPL v3
# @date 2017-06-16 04:38:52 CET # @date 2017-06-16 04:38:52 CET
# #
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_VERSION=0.11 BES_VERSION=0.13
BES_NAME="bes-build" BES_NAME="bes-build"
BES_URL="https://git.pluie.org/meta-tech/$BES_NAME/raw/latest/dist/$BES_NAME" BES_URL="https://gitea.meta-tech.academy/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
@ -956,15 +1055,31 @@ function bes.main ()
else else
echo.app "$BES_NAME" "$BES_VERSION" echo.app "$BES_NAME" "$BES_VERSION"
echo echo
enusage=0
if [ "$1" = "install" ] || [ "$1" = "-i" ]; then if [ "$1" = "install" ] || [ "$1" = "-i" ]; then
bes.install "$BES_NAME" "$BES_URL" "$2" "bes.build.install" bes.install "$BES_NAME" "$BES_URL" "$2" "bes.build.install"
elif [ "$1" = "help" ] || [ "$1" = "-h" ]; then elif [ "$1" = "help" ] || [ "$1" = "-h" ]; then
bes.usage enusage=1
elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then
bes.update bes.update
elif [ "$1" = "new" ] || [ "$1" = "-n" ]; then
if [ ! -z "$2" ]; then
bes.build.new $2
else
enusage=1
fi
elif [ "$1" = "require" ] || [ "$1" = "-r" ]; then
if [ ! -z "$2" ]; then
bes.build.require $2
else
enusage=1
fi
elif [ -z "$1" ] || [ "$1" = "backup" ] || [ "$1" = "-b" ]; then elif [ -z "$1" ] || [ "$1" = "backup" ] || [ "$1" = "-b" ]; then
bes.build "$1" bes.build "$1"
fi fi
if [ "$enusage" = "1" ]; then
bes.usage
fi
echo echo
fi fi
} }

View File

@ -1,15 +1,15 @@
#!/bin/bash #!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# #
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-build # @author a-Sansara - https://gitea.meta-tech.academy/meta-tech/bes-build
# @app bes-build # @app bes-build
# @license GNU GPL v3 # @license GNU GPL v3
# @date 2017-06-16 04:38:52 CET # @date 2017-06-16 04:38:52 CET
# #
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_VERSION=0.11 BES_VERSION=0.13
BES_NAME="bes-build" BES_NAME="bes-build"
BES_URL="https://git.pluie.org/meta-tech/$BES_NAME/raw/latest/dist/$BES_NAME" BES_URL="https://gitea.meta-tech.academy/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
@ -22,15 +22,31 @@ function bes.main ()
else else
echo.app "$BES_NAME" "$BES_VERSION" echo.app "$BES_NAME" "$BES_VERSION"
echo echo
enusage=0
if [ "$1" = "install" ] || [ "$1" = "-i" ]; then if [ "$1" = "install" ] || [ "$1" = "-i" ]; then
bes.install "$BES_NAME" "$BES_URL" "$2" "bes.build.install" bes.install "$BES_NAME" "$BES_URL" "$2" "bes.build.install"
elif [ "$1" = "help" ] || [ "$1" = "-h" ]; then elif [ "$1" = "help" ] || [ "$1" = "-h" ]; then
bes.usage enusage=1
elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then
bes.update bes.update
elif [ "$1" = "new" ] || [ "$1" = "-n" ]; then
if [ ! -z "$2" ]; then
bes.build.new $2
else
enusage=1
fi
elif [ "$1" = "require" ] || [ "$1" = "-r" ]; then
if [ ! -z "$2" ]; then
bes.build.require $2
else
enusage=1
fi
elif [ -z "$1" ] || [ "$1" = "backup" ] || [ "$1" = "-b" ]; then elif [ -z "$1" ] || [ "$1" = "backup" ] || [ "$1" = "-b" ]; then
bes.build "$1" bes.build "$1"
fi fi
if [ "$enusage" = "1" ]; then
bes.usage
fi
echo echo
fi fi
} }

90
src/new.sh Normal file
View File

@ -0,0 +1,90 @@
#!/bin/bash
function bes.build.new () {
local prj=${1}
echo.title "creating new project" "$prj"
if [ -d "$APP_DIR/$prj" ]; then
echo.error "directory $prj already exists" 1
else
echo.action "creating directory" "$prj" "*" "Cusa"
mkdir "$APP_DIR/$prj"
echo.state $?
echo.action "creating project config file" "bes.ini" "*" "Cusa"
echo -e "[project]
vendor =
name = $prj
version = 0.1
license = \"GNU GPL v3\"
author =
type = application
homepage =
description = \"bash bes $prj application\"
keywords = \"bash $prj\"
[require]
bes.install = 1.4
" > "$APP_DIR/$prj/bes.ini"
echo.state $?
echo.action "Creating directory" "src" "*" "Cusa"
mkdir $APP_DIR/$prj/src
echo.state $?
echo.action "Adding default templates" "main" "*" "Cusa"
echo "#!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BES_VERSION=0.1
BES_AUTHOR=me
BES_LICENSE=MIT
BES_NAME=\"$prj\"
BES_URL=\"https://your.forge.git/vendor/\$BES_NAME/raw/latest/dist/\$BES_NAME\"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function $prj.main ()
{
echo.msg \"hello bes\" \"\$Citem\"
echo.rs \$?
echo
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function bes.main ()
{
if [ \"\$1\" = \"version\" ] || [ \"\$1\" = \"-v\" ]; then
echo \$BES_VERSION
else
echo.app \"\$BES_NAME\" \"\$BES_VERSION\" \"\$BES_AUTHOR\" \"\$BES_LICENSE\"
echo
if [ \"\$1\" = \"install\" ] || [ \"\$1\" = \"-i\" ]; then
bes.install \"\$BES_NAME\" \"\$BES_URL\" \"\$2\"
elif [ \"\$1\" = \"help\" ] || [ \"\$1\" = \"-h\" ]; then
$prj.usage
else
$prj.main
fi
echo
fi
}
bes.main \$*
" > "$APP_DIR/$prj/src/main.sh"
echo.state $?
echo.action "Adding default template" "usage" "*" "Cusa"
echo "#!/bin/bash
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function $prj.usage ()
{
echo -e \" \${Cusa}Usage :\${Coff}\n
\${Ccom}\tInstall or update \$BES_NAME on specified BINDIR directory or in /usr/local/bin directory
\${Cspe}\t\$BES_NAME \${Copt}-i\${Ctext}, \${Copt}install \${Copt}[ \${Ctext}BINDIR\${Copt} ]
\${Ccom}\tDisplay program version
\${Cspe}\t\$BES_NAME \${Copt}-v\${Ctext}, \${Copt}version
\${Ccom}\tDisplay this help
\${Cspe}\t\$BES_NAME \${Copt}-h\${Ctext}, \${Copt}help\"
echo -e \"${Coff}\"
}
" > "$APP_DIR/$prj/src/usage.sh"
echo.state $?
echo.rs $?
echo
fi
}

7
src/require.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
function bes.build.require () {
local dep=${1}
echo.msg "coming soon"
echo.rs 1
}

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
BES_LIB="color echo install ini service dep1 dep2" BES_LIB="color echo install ini service secure dep1 dep2"
BES_LOADED_LIB= BES_LOADED_LIB=
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function bes.inlist () function bes.inlist ()
@ -90,7 +90,7 @@ function bes.loadDep ()
cd "$APP_DIR/vendor/$vendor" cd "$APP_DIR/vendor/$vendor"
echo.action "updating repository $Cusa$vendor.$project ${Coff}:$Cusa $version" echo.action "updating repository $Cusa$vendor.$project ${Coff}:$Cusa $version"
if [ ! -d "$project" ]; then if [ ! -d "$project" ]; then
git clone -q "https://git.pluie.org/meta-tech/$vendor-$project" "$project" 2>&1 >/dev/null git clone -q "https://gitea.meta-tech.academy/meta-tech/$vendor-$project" "$project" 2>&1 >/dev/null
#~ echo.state $? #~ echo.state $?
cd $project cd $project
else else

View File

@ -4,16 +4,20 @@
function bes.usage () function bes.usage ()
{ {
echo -e " ${Cusa}Usage :${Coff}\n echo -e " ${Cusa}Usage :${Coff}\n
${Ccom}\tCreate new bes project
${Cspe}\t$BES_NAME ${Copt}-n${Ctext}, ${Copt}new ${Copt}[ ${Ctext}PROJECT_NAME${Copt} ]
${Ccom}\tUpdate current project dependencies
${Cspe}\t$BES_NAME ${Copt}-u${Ctext}, ${Copt}update
${Ccom}\tBuild current project (overwrite existing build) ${Ccom}\tBuild current project (overwrite existing build)
${Cspe}\t$APP_NAME ${Copt} ${Cspe}\t$BES_NAME ${Copt}
${Ccom}\tBuild current project and backup existing build ${Ccom}\tBuild current project and backup existing build
${Cspe}\t$APP_NAME ${Copt}-b${Ctext}, ${Copt}backup ${Cspe}\t$BES_NAME ${Copt}-b${Ctext}, ${Copt}backup
${Ccom}\tInstall or update $APP_NAME on specified BINDIR directory or in /usr/local/bin directory ${Ccom}\tInstall or update $APP_NAME on specified BINDIR directory or in /usr/local/bin directory
${Cspe}\t$APP_NAME ${Copt}-i${Ctext}, ${Copt}install ${Copt}[ ${Ctext}BINDIR${Copt} ] ${Cspe}\t$BES_NAME ${Copt}-i${Ctext}, ${Copt}install ${Copt}[ ${Ctext}BINDIR${Copt} ]
${Ccom}\tDisplay program version ${Ccom}\tDisplay program version
${Cspe}\t$APP_NAME ${Copt}-v${Ctext}, ${Copt}version ${Cspe}\t$BES_NAME ${Copt}-v${Ctext}, ${Copt}version
${Ccom}\tDisplay this help ${Ccom}\tDisplay this help
${Cspe}\t$APP_NAME ${Copt}-h${Ctext}, ${Copt}help" ${Cspe}\t$BES_NAME ${Copt}-h${Ctext}, ${Copt}help"
echo -e "${Coff}" echo -e "${Coff}"
} }