add version + install

This commit is contained in:
a-sansara 2017-04-30 03:31:36 +02:00
parent a37468e027
commit ab999408d1
4 changed files with 82 additions and 27 deletions

55
dist/bes-build vendored
View File

@ -10,7 +10,7 @@ bes.build(){
fi fi
if [ -f "$APP_BIN" ]; then if [ -f "$APP_BIN" ]; then
if [ "$1" = "-s" ]; then if [ "$1" = "-s" ]; then
bes.echo.action "backup last build ${Coff}dist/$(date +%y%m%d)-$APP_NAME${Coff}" bes.echo.action "backup last build to ${Coff}dist/$(date +%y%m%d)-$APP_NAME${Coff}"
mv $APP_BIN $APP_DIR/dist/$(date +%y%m%d)-$APP_NAME mv $APP_BIN $APP_DIR/dist/$(date +%y%m%d)-$APP_NAME
else else
bes.echo.action "removing ${Coff}dist/$APP_NAME${Coff}" bes.echo.action "removing ${Coff}dist/$APP_NAME${Coff}"
@ -68,12 +68,12 @@ bes.echo(){
c=$Caction c=$Caction
fi fi
if [ ! "$isAction" = 0 ]; then if [ ! "$isAction" = 0 ]; then
c=" $Citem$symbol $c" c=" $Citem$symbol $c"
fi fi
echo -e " $c$msg$Coff" echo -e " $c$msg$Coff"
else else
if [ ! "$isAction" = 0 ]; then if [ ! "$isAction" = 0 ]; then
msg=" $symbol $msg" msg=" $symbol $msg"
fi fi
echo -e "$msg" echo -e "$msg"
fi fi
@ -134,31 +134,58 @@ bes.title(){
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.color.map(){ bes.color.map(){
for fgbg in 38 48 ; do for fgbg in 38 48 ; do
for color in {0..256} ; do for color in {0..256} ; do
echo -en "\e[${fgbg};5;${color}m ${color}\t\e[0m" echo -en "\e[${fgbg};5;${color}m ${color}\t\e[0m"
if [ $((($color + 1) % 7)) == 0 ] ; then if [ $((($color + 1) % 7)) == 0 ] ; then
echo echo
fi fi
done done
echo echo
done done
} }
BES_BUILD_VERSION=0.2 bes.install(){
local path=${1:-/usr/local/bin}
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
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 $?
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_BUILD_VERSION=0.3
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(){ bes.main(){
bes.title 'bes-build' $BES_BUILD_VERSION if [ "$1" = "version" ]; then
echo echo $BES_BUILD_VERSION
if [ "$1" = "install" ]; then else
bes.install bes.title 'bes-build' $BES_BUILD_VERSION
elif [ -z "$1" ] || [ "$1" = "-s" ]; then echo
bes.build "$1" if [ "$1" = "install" ]; then
bes.install $2
elif [ -z "$1" ] || [ "$1" = "-s" ]; then
bes.build "$1"
fi
echo
fi fi
echo
} }
bes.main $* bes.main $*

View File

@ -27,12 +27,12 @@ bes.echo(){
c=$Caction c=$Caction
fi fi
if [ ! "$isAction" = 0 ]; then if [ ! "$isAction" = 0 ]; then
c=" $Citem$symbol $c" c=" $Citem$symbol $c"
fi fi
echo -e " $c$msg$Coff" echo -e " $c$msg$Coff"
else else
if [ ! "$isAction" = 0 ]; then if [ ! "$isAction" = 0 ]; then
msg=" $symbol $msg" msg=" $symbol $msg"
fi fi
echo -e "$msg" echo -e "$msg"
fi fi
@ -93,11 +93,11 @@ bes.title(){
} }
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bes.color.map(){ bes.color.map(){
for fgbg in 38 48 ; do for fgbg in 38 48 ; do
for color in {0..256} ; do for color in {0..256} ; do
echo -en "\e[${fgbg};5;${color}m ${color}\t\e[0m" echo -en "\e[${fgbg};5;${color}m ${color}\t\e[0m"
if [ $((($color + 1) % 7)) == 0 ] ; then if [ $((($color + 1) % 7)) == 0 ] ; then
echo echo
fi fi
done done
echo echo

24
src/install.sh Normal file
View File

@ -0,0 +1,24 @@
#!/bin/bash
bes.install(){
local path=${1:-/usr/local/bin}
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
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 $?
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
}

View File

@ -1,19 +1,23 @@
#!/bin/bash #!/bin/bash
BES_BUILD_VERSION=0.2 BES_BUILD_VERSION=0.3
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(){ bes.main(){
bes.title 'bes-build' $BES_BUILD_VERSION if [ "$1" = "version" ]; then
echo echo $BES_BUILD_VERSION
if [ "$1" = "install" ]; then else
bes.install bes.title 'bes-build' $BES_BUILD_VERSION
elif [ -z "$1" ] || [ "$1" = "-s" ]; then echo
bes.build "$1" if [ "$1" = "install" ]; then
bes.install $2
elif [ -z "$1" ] || [ "$1" = "-s" ]; then
bes.build "$1"
fi
echo
fi fi
echo
} }
bes.main $* bes.main $*