diff --git a/README.md b/README.md index 4c11bac..94dcc5f 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ bes-build ========= 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 ``` -wget https://raw.githubusercontent.com/meta-tech/bes-build/master/dist/bes-build -chmod +x bes-build -sudo mv bes-build /usr/local/bin +wget https://raw.githubusercontent.com/meta-tech/bes-build/latest/dist/bes-build +bash ./bes-build -i ``` ### Usage @@ -20,6 +20,8 @@ cd /home/repo/meta-tech/bes bes-build # you can now execute program with : ./dist/bes +# to display help execute : +bes-build -h ``` ### Requirements @@ -38,3 +40,10 @@ using bes-build script require you to conform to these following rules : |--- file3.sh ``` * 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(){ + ... +} +``` diff --git a/dist/bes-build b/dist/bes-build index d2aab7a..4c835fd 100755 --- a/dist/bes-build +++ b/dist/bes-build @@ -110,9 +110,9 @@ bes.echo.state(){ bes.echo.rs(){ local rs=${1:-0} if [ "$rs" -eq 0 ]; then - echo -e "\n ${Cdone} done ${Coff}" + echo -e " ${Cdone} done ${Coff}" else - echo -e "\n ${Cfail} failed ${Coff}" + echo -e " ${Cfail} failed ${Coff}" fi } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -157,25 +157,26 @@ bes.color.map(){ bes.install(){ local path=${1:-/usr/local/bin} - + local done=1 bes.echo.title "Installing bes-build ${Coff}in" "$path" if [ -f "./bes-build" ]; then rm ./bes-build 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 chmod +x ./bes-build if [ -d $path ]; then - bes.echo.action "install bes-build in ${Copt}$path/bes-build" sudo mv ./bes-build $path/bes-build - bes.echo.state $? + local done=$? + bes.echo.state $done else bes.echo.error "install directory do not exists : ${Cspe}$path" fi else bes.echo.error "can not download latest version of bes-build" fi + bes.echo.rs $done } bes.usage(){ @@ -194,7 +195,7 @@ bes.usage(){ echo -e "${Coff}" } -BES_BUILD_VERSION=0.3 +BES_BUILD_VERSION=0.4 APP_DIR=$(pwd) APP_NAME=$(basename $(pwd)) APP_BIN=$APP_DIR/dist/$APP_NAME diff --git a/src/display.sh b/src/display.sh index 2841d7c..89caeed 100755 --- a/src/display.sh +++ b/src/display.sh @@ -68,9 +68,9 @@ bes.echo.state(){ bes.echo.rs(){ local rs=${1:-0} if [ "$rs" -eq 0 ]; then - echo -e "\n ${Cdone} done ${Coff}" + echo -e " ${Cdone} done ${Coff}" else - echo -e "\n ${Cfail} failed ${Coff}" + echo -e " ${Cfail} failed ${Coff}" fi } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/install.sh b/src/install.sh index 41e9895..1920cea 100644 --- a/src/install.sh +++ b/src/install.sh @@ -2,23 +2,24 @@ bes.install(){ local path=${1:-/usr/local/bin} - + local done=1 bes.echo.title "Installing bes-build ${Coff}in" "$path" if [ -f "./bes-build" ]; then rm ./bes-build 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 chmod +x ./bes-build if [ -d $path ]; then - bes.echo.action "install bes-build in ${Copt}$path/bes-build" sudo mv ./bes-build $path/bes-build - bes.echo.state $? + local done=$? + bes.echo.state $done else bes.echo.error "install directory do not exists : ${Cspe}$path" fi else bes.echo.error "can not download latest version of bes-build" fi + bes.echo.rs $done } diff --git a/src/main.sh b/src/main.sh index 539fd1c..7a4384b 100755 --- a/src/main.sh +++ b/src/main.sh @@ -1,6 +1,6 @@ #!/bin/bash -BES_BUILD_VERSION=0.3 +BES_BUILD_VERSION=0.4 APP_DIR=$(pwd) APP_NAME=$(basename $(pwd)) APP_BIN=$APP_DIR/dist/$APP_NAME