Skip to content

Commit

Permalink
update bake examples
Browse files Browse the repository at this point in the history
  • Loading branch information
chen56 committed Apr 18, 2024
1 parent 9ef4aa5 commit d835936
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 2,157 deletions.
1 change: 1 addition & 0 deletions packages/you_bake/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor/
29 changes: 8 additions & 21 deletions packages/you_bake/examples/1.hello/bake
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,23 @@
########################################################


# 模版脚本,用来获取本脚本的realpath
# 我在我的所有脚本头都会放这个函数,方便得到真正的当前脚本目录
# On Mac OS, readlink -f doesn't work, so use._real_path get the real path of the file
_real_path() (
cd "$(dirname "$1")" || exit 200
declare file
file="$PWD/$(basename "$1")"
while [[ -L "$file" ]]; do
file="$(readlink "$file")"
cd -P "$(dirname "$file")" || exit 200
file="$PWD/$(basename "$file")"
done
echo "$file"
)
# 得到当前脚本目录
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

SCRIPT_PATH="$(_real_path "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
cd "$SCRIPT_DIR" || exit 200

# 脚本动态安装bake.bash依赖到: vendor/bake.bash
_install_bake(){
mkdir -p "$SCRIPT_DIR/vendor"
echo "$SCRIPT_PATH -> _install_bake ▶︎【curl -o $SCRIPT_DIR/bake.bash https://github.com/chen56/you/raw/main/packages/you_bake/bake.bash】"
curl -L -o "$SCRIPT_DIR/vendor/bake.bash" https://github.com/chen56/you/raw/main/packages/you_bake/bake.bash ;
mkdir -p "vendor"
echo "_install_bake ▶︎【curl -o bake.bash https://github.com/chen56/you/raw/main/packages/you_bake/bake.bash】"
curl -L -o "vendor/bake.bash" https://github.com/chen56/you/raw/main/packages/you_bake/bake.bash ;
}
if ! [[ -f "$SCRIPT_DIR/vendor/bake.bash" ]]; then
if ! [[ -f "vendor/bake.bash" ]]; then
_install_bake
fi

# include common script
source "$SCRIPT_DIR/vendor/bake.bash"
source "vendor/bake.bash"


##########################################
Expand Down
Loading

0 comments on commit d835936

Please sign in to comment.