version 0.4

This commit is contained in:
a-sansara 2017-04-30 04:26:52 +02:00
parent d3a63b09bd
commit b3cbc33450
5 changed files with 29 additions and 18 deletions

View File

@ -2,14 +2,14 @@ bes-build
========= =========
bes-build is a bash script to build bash program. bes-build is a bash script to build bash program.
the building process simply consist to append shell script files from your `src/` project directory into a single `dist/project` executable file the building process simply consist to append shell script files from your `src/` project directory
into a single `dist/project` executable file
### Install ### Install
``` ```
wget https://raw.githubusercontent.com/meta-tech/bes-build/master/dist/bes-build wget https://raw.githubusercontent.com/meta-tech/bes-build/latest/dist/bes-build
chmod +x bes-build bash ./bes-build -i
sudo mv bes-build /usr/local/bin
``` ```
### Usage ### Usage
@ -20,6 +20,8 @@ cd /home/repo/meta-tech/bes
bes-build bes-build
# you can now execute program with : # you can now execute program with :
./dist/bes ./dist/bes
# to display help execute :
bes-build -h
``` ```
### Requirements ### Requirements
@ -38,3 +40,10 @@ using bes-build script require you to conform to these following rules :
|--- file3.sh |--- file3.sh
``` ```
* each `src/` shell file require a `shebang` on first line (**#!/bin/bash**) * each `src/` shell file require a `shebang` on first line (**#!/bin/bash**)
* src/main.sh file is append to the end of the build file
* we strongly recommand you to use function and prefix function name
```shell
bes.install(){
...
}
```

15
dist/bes-build vendored
View File

@ -110,9 +110,9 @@ bes.echo.state(){
bes.echo.rs(){ bes.echo.rs(){
local rs=${1:-0} local rs=${1:-0}
if [ "$rs" -eq 0 ]; then if [ "$rs" -eq 0 ]; then
echo -e "\n ${Cdone} done ${Coff}" echo -e " ${Cdone} done ${Coff}"
else else
echo -e "\n ${Cfail} failed ${Coff}" echo -e " ${Cfail} failed ${Coff}"
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -157,25 +157,26 @@ bes.color.map(){
bes.install(){ bes.install(){
local path=${1:-/usr/local/bin} local path=${1:-/usr/local/bin}
local done=1
bes.echo.title "Installing bes-build ${Coff}in" "$path" bes.echo.title "Installing bes-build ${Coff}in" "$path"
if [ -f "./bes-build" ]; then if [ -f "./bes-build" ]; then
rm ./bes-build rm ./bes-build
fi fi
wget -q https://git.pluie.org/meta-tech/bes-build/raw/master/dist/bes-build wget -q https://git.pluie.org/meta-tech/bes-build/raw/latest/dist/bes-build
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
chmod +x ./bes-build chmod +x ./bes-build
if [ -d $path ]; then if [ -d $path ]; then
bes.echo.action "install bes-build in ${Copt}$path/bes-build"
sudo mv ./bes-build $path/bes-build sudo mv ./bes-build $path/bes-build
bes.echo.state $? local 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 bes-build"
fi fi
bes.echo.rs $done
} }
bes.usage(){ bes.usage(){
@ -194,7 +195,7 @@ bes.usage(){
echo -e "${Coff}" echo -e "${Coff}"
} }
BES_BUILD_VERSION=0.3 BES_BUILD_VERSION=0.4
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

View File

@ -68,9 +68,9 @@ bes.echo.state(){
bes.echo.rs(){ bes.echo.rs(){
local rs=${1:-0} local rs=${1:-0}
if [ "$rs" -eq 0 ]; then if [ "$rs" -eq 0 ]; then
echo -e "\n ${Cdone} done ${Coff}" echo -e " ${Cdone} done ${Coff}"
else else
echo -e "\n ${Cfail} failed ${Coff}" echo -e " ${Cfail} failed ${Coff}"
fi fi
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -2,23 +2,24 @@
bes.install(){ bes.install(){
local path=${1:-/usr/local/bin} local path=${1:-/usr/local/bin}
local done=1
bes.echo.title "Installing bes-build ${Coff}in" "$path" bes.echo.title "Installing bes-build ${Coff}in" "$path"
if [ -f "./bes-build" ]; then if [ -f "./bes-build" ]; then
rm ./bes-build rm ./bes-build
fi fi
wget -q https://git.pluie.org/meta-tech/bes-build/raw/master/dist/bes-build wget -q https://git.pluie.org/meta-tech/bes-build/raw/latest/dist/bes-build
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
chmod +x ./bes-build chmod +x ./bes-build
if [ -d $path ]; then if [ -d $path ]; then
bes.echo.action "install bes-build in ${Copt}$path/bes-build"
sudo mv ./bes-build $path/bes-build sudo mv ./bes-build $path/bes-build
bes.echo.state $? local 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 bes-build"
fi fi
bes.echo.rs $done
} }

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
BES_BUILD_VERSION=0.3 BES_BUILD_VERSION=0.4
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