Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
98dd0da601 | |||
|
1ee9ac25e7 | ||
|
bc386594d9 | ||
|
8cf4729a34 | ||
|
1f795886f1 | ||
|
dd14205677 | ||
|
fa7aa891b5 |
11
README.md
11
README.md
|
@ -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.1
|
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,11 +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.1
|
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]
|
||||||
|
bes.color = 1.4
|
||||||
```
|
```
|
||||||
|
|
8
bes.ini
8
bes.ini
|
@ -1,15 +1,13 @@
|
||||||
[project]
|
[project]
|
||||||
vendor = bes
|
vendor = bes
|
||||||
name = build
|
name = build
|
||||||
version = 0.6
|
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"
|
||||||
|
|
||||||
[require]
|
[require]
|
||||||
bes.ini = 1.1
|
bes.install = 1.4
|
||||||
bes.echo = 1.2
|
|
||||||
bes.install = 1.1
|
|
||||||
|
|
373
dist/bes-build
vendored
373
dist/bes-build
vendored
|
@ -1,5 +1,31 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
BES_BOOT=
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.exists () {
|
||||||
|
declare -f $1 > /dev/null
|
||||||
|
#~ [ x$(type -t $1) = xfunction ];
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.boot ()
|
||||||
|
{
|
||||||
|
for fn in $BES_BOOT; do
|
||||||
|
if bes.exists $fn.boot; then
|
||||||
|
$fn.boot
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.reg ()
|
||||||
|
{
|
||||||
|
local sep=" "
|
||||||
|
if [ -z "$BES_BOOT" ]; then
|
||||||
|
sep=""
|
||||||
|
fi
|
||||||
|
BES_BOOT=$BES_BOOT$sep$1
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
#
|
#
|
||||||
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-color
|
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-color
|
||||||
# @app bes-color
|
# @app bes-color
|
||||||
|
@ -10,52 +36,67 @@
|
||||||
function bes.color.boot () {
|
function bes.color.boot () {
|
||||||
BES_NOCOLOR=${BES_NOCOLOR:-0}
|
BES_NOCOLOR=${BES_NOCOLOR:-0}
|
||||||
if [ "$BES_NOCOLOR" -eq 0 ]; then
|
if [ "$BES_NOCOLOR" -eq 0 ]; then
|
||||||
# by convention all colors begins with 'C' uppercase
|
color.load
|
||||||
# followed by a name in lowercase
|
if [ $? -eq 1 ]; then
|
||||||
# background foreground
|
# by convention all colors begins with 'C' uppercase
|
||||||
# R G B R G B
|
# followed by a name in lowercase
|
||||||
color.set "Chead" 53 114 160 195 223 255
|
# but in this calls you dont need to prefix names
|
||||||
color.set "Cheadsep" 53 114 160 252 212 102
|
#
|
||||||
# background
|
# background foreground
|
||||||
# R G B
|
# R G B R G B
|
||||||
color.bg "Cdone" 63 172 138
|
color.set "head" 53 114 160 195 223 255
|
||||||
color.bg "Cfail" 172 63 85
|
color.set "headsep" 53 114 160 252 212 102
|
||||||
# foreground
|
# background
|
||||||
# R G B
|
# R G B
|
||||||
color.fg "Ctitle" 133 92 181
|
color.bg "done" 63 172 138
|
||||||
color.fg "Cheadline" 22 74 133
|
color.bg "fail" 172 63 85
|
||||||
color.fg "Csep" 80 80 80
|
# foreground
|
||||||
color.fg "Cerr" 194 48 64
|
# R G B
|
||||||
color.fg "Cval" 255 175 95
|
color.fg "title" 133 92 181
|
||||||
color.fg "Ckey" 40 168 134
|
color.fg "headline" 22 74 133
|
||||||
color.fg "Caction" 106 183 241
|
color.fg "sep" 80 80 80
|
||||||
color.fg "Csymbol" 255 175 95
|
color.fg "err" 194 48 64
|
||||||
color.fg "Citem" 92 147 181
|
color.fg "val" 255 175 95
|
||||||
color.fg "Cusa" 255 172 0
|
color.fg "key" 40 168 134
|
||||||
color.fg "Cspe" 255 214 166
|
color.fg "action" 106 183 241
|
||||||
color.fg "Copt" 94 215 255
|
color.fg "symbol" 255 175 95
|
||||||
color.fg "Ccom" 175 135 175
|
color.fg "item" 92 147 181
|
||||||
color.fg "Ctext" 0 132 101
|
color.fg "usa" 255 172 0
|
||||||
color.fg "Cmeta" 39 100 170
|
color.fg "spe" 255 214 166
|
||||||
|
color.fg "opt" 94 215 255
|
||||||
|
color.fg "com" 175 135 175
|
||||||
|
color.fg "text" 0 132 101
|
||||||
|
color.fg "meta" 39 100 170
|
||||||
|
echo -e "$Cerr warning ${Coff}cannot load colors config file"
|
||||||
|
fi
|
||||||
Coff="\\033[m"
|
Coff="\\033[m"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
function color.fg()
|
function color.fg()
|
||||||
{
|
{
|
||||||
local -n var=$1
|
local s=${1}
|
||||||
|
if [ ${s:0:1} = "C" ]; then s=${s:1}; fi
|
||||||
|
s=${s,,}
|
||||||
|
local -n var=C$1
|
||||||
var="\033[1;38;2;$2;$3;$4m"
|
var="\033[1;38;2;$2;$3;$4m"
|
||||||
}
|
}
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
function color.bg()
|
function color.bg()
|
||||||
{
|
{
|
||||||
local -n var=$1
|
local s=${1}
|
||||||
|
if [ ${s:0:1} = "C" ]; then s=${s:1}; fi
|
||||||
|
s=${s,,}
|
||||||
|
local -n var=C$1
|
||||||
var="\033[1;48;2;$2;$3;$4m"
|
var="\033[1;48;2;$2;$3;$4m"
|
||||||
}
|
}
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
function color.set()
|
function color.set()
|
||||||
{
|
{
|
||||||
local -n var=$1
|
local s=${1}
|
||||||
|
if [ ${s:0:1} = "C" ]; then s=${s:1}; fi
|
||||||
|
s=${s,,}
|
||||||
|
local -n var=C$1
|
||||||
var="\033[1;48;2;$2;$3;$4;1;38;2;$5;$6;$7m"
|
var="\033[1;48;2;$2;$3;$4;1;38;2;$5;$6;$7m"
|
||||||
}
|
}
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -96,7 +137,30 @@ function color.env () {
|
||||||
var=${!v}
|
var=${!v}
|
||||||
}
|
}
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
bes.color.boot
|
function color.load () {
|
||||||
|
local file=${1:-/usr/share/bes/colors.ini}
|
||||||
|
if [ -f "$file" ]; then
|
||||||
|
local prefix="bes_colors"
|
||||||
|
bes.ini "$file" -p "$prefix" -b 1
|
||||||
|
for name in ${bes_colors_ALL_VARS}; do
|
||||||
|
key="${name:${#prefix}+1}"
|
||||||
|
if [ "${key:0:2}" = "fg" ]; then
|
||||||
|
color.fg "${key:3}" ${!name}
|
||||||
|
elif [ "${key:0:2}" == "bg" ]; then
|
||||||
|
color.bg "${key:3}" ${!name}
|
||||||
|
elif [ "${key:0:3}" == "set" ]; then
|
||||||
|
color.set "${key:4}" ${!name}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
declare -f bes.reg > /dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
bes.reg bes.color
|
||||||
|
fi
|
||||||
#
|
#
|
||||||
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-echo
|
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-echo
|
||||||
# @app bes-echo
|
# @app bes-echo
|
||||||
|
@ -181,7 +245,7 @@ function echo.app ()
|
||||||
local msg=${1:-''}
|
local msg=${1:-''}
|
||||||
local version=${2:-''}
|
local version=${2:-''}
|
||||||
local author=${3:-'a-Sansara'}
|
local author=${3:-'a-Sansara'}
|
||||||
local license=${3:-'GNU GPL v3'}
|
local license=${4:-'GNU GPL v3'}
|
||||||
if [ ! -z "$2" ]; then
|
if [ ! -z "$2" ]; then
|
||||||
msg="$msg ${Cval}v$version"
|
msg="$msg ${Cval}v$version"
|
||||||
fi
|
fi
|
||||||
|
@ -193,7 +257,10 @@ function echo.app ()
|
||||||
echo.sepline
|
echo.sepline
|
||||||
}
|
}
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
bes.echo.boot
|
declare -f bes.reg > /dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
bes.reg bes.echo
|
||||||
|
fi
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
#
|
#
|
||||||
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-echo
|
# @author a-Sansara - https://git.pluie.org/meta-tech/bes-echo
|
||||||
|
@ -499,6 +566,7 @@ function bes.install ()
|
||||||
local app=${1}
|
local app=${1}
|
||||||
local url=${2}
|
local url=${2}
|
||||||
local path=${3:-/usr/local/bin}
|
local path=${3:-/usr/local/bin}
|
||||||
|
local inst=${4:-}
|
||||||
local done=1
|
local done=1
|
||||||
echo.title "Installing $app ${Coff}in" "$path"
|
echo.title "Installing $app ${Coff}in" "$path"
|
||||||
if [ -z "$app" ] || [ -s "$url" ]; then
|
if [ -z "$app" ] || [ -s "$url" ]; then
|
||||||
|
@ -517,8 +585,13 @@ function bes.install ()
|
||||||
else
|
else
|
||||||
echo.error "install directory do not exists : ${Cspe}$path"
|
echo.error "install directory do not exists : ${Cspe}$path"
|
||||||
fi
|
fi
|
||||||
|
if [ ! -z "$inst" ]; then
|
||||||
|
if bes.exists "$inst"; then
|
||||||
|
$inst
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo.error "can not download latest version of app $app. please check url : $url"
|
echo.error "can not download latest version of app $app. please check url : $url"
|
||||||
fi
|
fi
|
||||||
echo.rs $done
|
echo.rs $done
|
||||||
}
|
}
|
||||||
|
@ -527,11 +600,11 @@ function bes.install ()
|
||||||
function bes.build ()
|
function bes.build ()
|
||||||
{
|
{
|
||||||
echo.title "building project" "$APP_NAME"
|
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
|
||||||
echo.action "creating dist directory"
|
echo.action "creating dist directory"
|
||||||
mkdir $APP_DIR/dist
|
mkdir $APP_DIR/dist
|
||||||
cho.state $?
|
echo.state $?
|
||||||
fi
|
fi
|
||||||
if [ -f "$APP_BIN" ]; then
|
if [ -f "$APP_BIN" ]; then
|
||||||
if [ "$1" = "backup" ] || [ "$1" = "-b" ]; then
|
if [ "$1" = "backup" ] || [ "$1" = "-b" ]; then
|
||||||
|
@ -543,7 +616,35 @@ function bes.build ()
|
||||||
fi
|
fi
|
||||||
echo.state $?
|
echo.state $?
|
||||||
fi
|
fi
|
||||||
echo "#!/bin/bash" > $APP_BIN
|
echo "#!/bin/bash
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
BES_BOOT=
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.exists () {
|
||||||
|
declare -f \$1 > /dev/null
|
||||||
|
#~ [ x\$(type -t \$1) = xfunction ];
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.boot ()
|
||||||
|
{
|
||||||
|
for fn in \$BES_BOOT; do
|
||||||
|
if bes.exists \$fn.boot; then
|
||||||
|
\$fn.boot
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.reg ()
|
||||||
|
{
|
||||||
|
local sep=\" \"
|
||||||
|
if [ -z \"\$BES_BOOT\" ]; then
|
||||||
|
sep=\"\"
|
||||||
|
fi
|
||||||
|
BES_BOOT=\$BES_BOOT\$sep\$1
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
" > $APP_BIN
|
||||||
|
#~ echo "#!/bin/bash" > $APP_BIN
|
||||||
echo.action "reading ${Coff}dependencies"
|
echo.action "reading ${Coff}dependencies"
|
||||||
if [ -d "$APP_DIR/vendor" ]; then
|
if [ -d "$APP_DIR/vendor" ]; then
|
||||||
for vendor in $(ls $APP_DIR/vendor/); do
|
for vendor in $(ls $APP_DIR/vendor/); do
|
||||||
|
@ -565,7 +666,7 @@ function bes.build ()
|
||||||
echo.msg " no dependencies, did you forget to run bes-build update ?"
|
echo.msg " no dependencies, did you forget to run bes-build update ?"
|
||||||
fi
|
fi
|
||||||
echo.state 0
|
echo.state 0
|
||||||
|
|
||||||
echo.action "reading ${Coff}src/"
|
echo.action "reading ${Coff}src/"
|
||||||
for entry in "$APP_DIR/src"/*.sh; do
|
for entry in "$APP_DIR/src"/*.sh; do
|
||||||
if [ "$(basename $entry)" != "main.sh" ]; then
|
if [ "$(basename $entry)" != "main.sh" ]; then
|
||||||
|
@ -573,6 +674,8 @@ function bes.build ()
|
||||||
tail -n +2 "$entry" >> "$APP_BIN"
|
tail -n +2 "$entry" >> "$APP_BIN"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
echo "# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
bes.boot" >> "$APP_BIN"
|
||||||
if [ -f "$APP_DIR/src/main.sh" ]; then
|
if [ -f "$APP_DIR/src/main.sh" ]; then
|
||||||
tail -n +2 "$APP_DIR/src/main.sh" >> "$APP_BIN"
|
tail -n +2 "$APP_DIR/src/main.sh" >> "$APP_BIN"
|
||||||
echo.msg " ${Cspe}- ${Cok}appending ${Coff}src/main.sh"
|
echo.msg " ${Cspe}- ${Cok}appending ${Coff}src/main.sh"
|
||||||
|
@ -588,8 +691,154 @@ function bes.build ()
|
||||||
echo.state 1
|
echo.state 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.build.install ()
|
||||||
|
{
|
||||||
|
local path="/usr/share/bes/colors.ini"
|
||||||
|
if [ ! -f "$path" ]; then
|
||||||
|
local dir=$(dirname "$path")
|
||||||
|
if [ ! -d "$dir" ]; then
|
||||||
|
echo.action "Creating default bes share dir" "$Cspe$dir$Cofff"
|
||||||
|
sudo mkdir -p "$dir"
|
||||||
|
echo.state $?
|
||||||
|
fi
|
||||||
|
echo.action "Installing default colors file" "$Cspe$path$Cofff"
|
||||||
|
local tmp=$(mktemp)
|
||||||
|
echo "[set]
|
||||||
|
# background foreground
|
||||||
|
# R G B R G B
|
||||||
|
head = 53 114 160 195 223 255
|
||||||
|
headsep = 53 114 160 252 212 102
|
||||||
|
|
||||||
BES_LIB="color echo install ini dep1 dep2"
|
[bg]
|
||||||
|
# background
|
||||||
|
# R G B
|
||||||
|
done = 63 172 138
|
||||||
|
fail = 172 63 85
|
||||||
|
|
||||||
|
[fg]
|
||||||
|
# foreground
|
||||||
|
# R G B
|
||||||
|
title = 133 92 181
|
||||||
|
headline = 22 74 133
|
||||||
|
sep = 80 80 80
|
||||||
|
err = 194 48 64
|
||||||
|
val = 255 175 95
|
||||||
|
key = 40 168 134
|
||||||
|
action = 106 183 241
|
||||||
|
symbol = 255 175 95
|
||||||
|
item = 92 147 181
|
||||||
|
usa = 255 172 0
|
||||||
|
spe = 255 214 166
|
||||||
|
opt = 94 215 255
|
||||||
|
com = 175 135 175
|
||||||
|
text = 0 132 101
|
||||||
|
meta = 39 100 170" > "$tmp"
|
||||||
|
sudo mv "$tmp" "$path"
|
||||||
|
echo.state $?
|
||||||
|
else
|
||||||
|
echo.action "Installing default colors file" "$Cspe$path$Cofff"
|
||||||
|
echo.error "file already exists, do not rewrite."
|
||||||
|
echo.state 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
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 ()
|
||||||
|
@ -679,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
|
||||||
|
@ -764,32 +1013,38 @@ 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}"
|
||||||
}
|
}
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
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.8
|
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
|
||||||
|
|
||||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -800,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.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
|
||||||
}
|
}
|
||||||
|
|
89
src/build.sh
89
src/build.sh
|
@ -4,11 +4,11 @@
|
||||||
function bes.build ()
|
function bes.build ()
|
||||||
{
|
{
|
||||||
echo.title "building project" "$APP_NAME"
|
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
|
||||||
echo.action "creating dist directory"
|
echo.action "creating dist directory"
|
||||||
mkdir $APP_DIR/dist
|
mkdir $APP_DIR/dist
|
||||||
cho.state $?
|
echo.state $?
|
||||||
fi
|
fi
|
||||||
if [ -f "$APP_BIN" ]; then
|
if [ -f "$APP_BIN" ]; then
|
||||||
if [ "$1" = "backup" ] || [ "$1" = "-b" ]; then
|
if [ "$1" = "backup" ] || [ "$1" = "-b" ]; then
|
||||||
|
@ -20,7 +20,35 @@ function bes.build ()
|
||||||
fi
|
fi
|
||||||
echo.state $?
|
echo.state $?
|
||||||
fi
|
fi
|
||||||
echo "#!/bin/bash" > $APP_BIN
|
echo "#!/bin/bash
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
BES_BOOT=
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.exists () {
|
||||||
|
declare -f \$1 > /dev/null
|
||||||
|
#~ [ x\$(type -t \$1) = xfunction ];
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.boot ()
|
||||||
|
{
|
||||||
|
for fn in \$BES_BOOT; do
|
||||||
|
if bes.exists \$fn.boot; then
|
||||||
|
\$fn.boot
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.reg ()
|
||||||
|
{
|
||||||
|
local sep=\" \"
|
||||||
|
if [ -z \"\$BES_BOOT\" ]; then
|
||||||
|
sep=\"\"
|
||||||
|
fi
|
||||||
|
BES_BOOT=\$BES_BOOT\$sep\$1
|
||||||
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
" > $APP_BIN
|
||||||
|
#~ echo "#!/bin/bash" > $APP_BIN
|
||||||
echo.action "reading ${Coff}dependencies"
|
echo.action "reading ${Coff}dependencies"
|
||||||
if [ -d "$APP_DIR/vendor" ]; then
|
if [ -d "$APP_DIR/vendor" ]; then
|
||||||
for vendor in $(ls $APP_DIR/vendor/); do
|
for vendor in $(ls $APP_DIR/vendor/); do
|
||||||
|
@ -42,7 +70,7 @@ function bes.build ()
|
||||||
echo.msg " no dependencies, did you forget to run bes-build update ?"
|
echo.msg " no dependencies, did you forget to run bes-build update ?"
|
||||||
fi
|
fi
|
||||||
echo.state 0
|
echo.state 0
|
||||||
|
|
||||||
echo.action "reading ${Coff}src/"
|
echo.action "reading ${Coff}src/"
|
||||||
for entry in "$APP_DIR/src"/*.sh; do
|
for entry in "$APP_DIR/src"/*.sh; do
|
||||||
if [ "$(basename $entry)" != "main.sh" ]; then
|
if [ "$(basename $entry)" != "main.sh" ]; then
|
||||||
|
@ -50,6 +78,8 @@ function bes.build ()
|
||||||
tail -n +2 "$entry" >> "$APP_BIN"
|
tail -n +2 "$entry" >> "$APP_BIN"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
echo "# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
bes.boot" >> "$APP_BIN"
|
||||||
if [ -f "$APP_DIR/src/main.sh" ]; then
|
if [ -f "$APP_DIR/src/main.sh" ]; then
|
||||||
tail -n +2 "$APP_DIR/src/main.sh" >> "$APP_BIN"
|
tail -n +2 "$APP_DIR/src/main.sh" >> "$APP_BIN"
|
||||||
echo.msg " ${Cspe}- ${Cok}appending ${Coff}src/main.sh"
|
echo.msg " ${Cspe}- ${Cok}appending ${Coff}src/main.sh"
|
||||||
|
@ -65,3 +95,54 @@ function bes.build ()
|
||||||
echo.state 1
|
echo.state 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
function bes.build.install ()
|
||||||
|
{
|
||||||
|
local path="/usr/share/bes/colors.ini"
|
||||||
|
if [ ! -f "$path" ]; then
|
||||||
|
local dir=$(dirname "$path")
|
||||||
|
if [ ! -d "$dir" ]; then
|
||||||
|
echo.action "Creating default bes share dir" "$Cspe$dir$Cofff"
|
||||||
|
sudo mkdir -p "$dir"
|
||||||
|
echo.state $?
|
||||||
|
fi
|
||||||
|
echo.action "Installing default colors file" "$Cspe$path$Cofff"
|
||||||
|
local tmp=$(mktemp)
|
||||||
|
echo "[set]
|
||||||
|
# background foreground
|
||||||
|
# R G B R G B
|
||||||
|
head = 53 114 160 195 223 255
|
||||||
|
headsep = 53 114 160 252 212 102
|
||||||
|
|
||||||
|
[bg]
|
||||||
|
# background
|
||||||
|
# R G B
|
||||||
|
done = 63 172 138
|
||||||
|
fail = 172 63 85
|
||||||
|
|
||||||
|
[fg]
|
||||||
|
# foreground
|
||||||
|
# R G B
|
||||||
|
title = 133 92 181
|
||||||
|
headline = 22 74 133
|
||||||
|
sep = 80 80 80
|
||||||
|
err = 194 48 64
|
||||||
|
val = 255 175 95
|
||||||
|
key = 40 168 134
|
||||||
|
action = 106 183 241
|
||||||
|
symbol = 255 175 95
|
||||||
|
item = 92 147 181
|
||||||
|
usa = 255 172 0
|
||||||
|
spe = 255 214 166
|
||||||
|
opt = 94 215 255
|
||||||
|
com = 175 135 175
|
||||||
|
text = 0 132 101
|
||||||
|
meta = 39 100 170" > "$tmp"
|
||||||
|
sudo mv "$tmp" "$path"
|
||||||
|
echo.state $?
|
||||||
|
else
|
||||||
|
echo.action "Installing default colors file" "$Cspe$path$Cofff"
|
||||||
|
echo.error "file already exists, do not rewrite."
|
||||||
|
echo.state 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
28
src/main.sh
28
src/main.sh
|
@ -1,17 +1,17 @@
|
||||||
#!/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.8
|
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.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
90
src/new.sh
Normal 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
7
src/require.sh
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function bes.build.require () {
|
||||||
|
local dep=${1}
|
||||||
|
echo.msg "coming soon"
|
||||||
|
echo.rs 1
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
BES_LIB="color echo install ini 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
|
||||||
|
|
14
src/usage.sh
14
src/usage.sh
|
@ -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}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user