承接 hgraca/bake 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hgraca/bake

最新稳定版本:v0.2.0

Composer 安装命令:

composer require hgraca/bake

包简介

Make-like functionality, built in Bash.

README 文档

README

Bake is a Make like build system, built in bash.

The intent is to make it easier and more flexible than Make.

How to use

Install

Install with composer require hgraca\bake.

You will need to accept a few plugins so that bash scripts can be managed using composer.

You can install bake autocomplete and global link by running sudo ./vendor/bin/bake install

Global installation

Alternatively, you can also install it globally (tested on Ubuntu based distributions).

Install with composer global require hgraca\bake.

You will need to accept a few plugins so that bash scripts can be managed using composer.

You can install bake autocomplete and global link by running sudo ~/.composer/vendor/bin/bake install

Set up bake home

The bake home, bust be .bake, on the root of your project.

You can place a bootstrap file, bootstrap.sh, in the root of bakes' home.

The recipes must live under .bake/recipes/....

Optionally, you can create folders that will be included according to the environment variable ENV, which you can set in the bootstrap.sh.

In bootstrap.sh you can also set the logging level. You can find all the logging levels here.

Example bootstrap.sh:

#!/usr/bin/env bash

ENV='dev'
export BASH_OVERLAY_LOG_LEVEL=${BASH_OVERLAY_LOG_LEVEL_INFO}

Example .bake structure:

.
├── .bake/
│   ├── bootstrap.sh
│   ├── recipes/
│   │   ├── global-recipes-file-01.sh
│   │   ├── dev/
│   │   │   ├── recipes-file-01.sh
│   │   │   ├── recipes-file-02.sh
│   │   │   └── ...
│   │   └── test/
│   │       ├── recipes-file-03.sh
│   │       ├── recipes-file-04.sh
│   │       └── ...
│   └── whatever-else/
│       └── ...
├── bin
├── src
├── tests
└── ...

Creating and using recipes

In a recipe file you create a function prefixed bake.recipe.<my_recipe>, which you then call like bake <my_recipe>.

For example, take the following recipe file:

#!/usr/bin/env bash

########################################################################################################################
# NAMING CONVENTIONS
#
# Please keep the functions ordered alphabetically
#
# Functions names must start with `bake.` so that on the main script we can find the functions available to our "bake".
# Use `.` as a namespace separator (When we double click, it selects only until the `.`)
# Use `-` as a sub separator (When we double click, it selects only until the `-`)
# Use `_` as a word separator (When we double click, it selects including and over the `_`)
#
# Use `.` as the first character in a function name to hide it
#
# At the end of the file place the aliases for backwards compatibility
#
########################################################################################################################

bake.recipe.my_new_command() {
  echo ""
  echo "==============================================="
  echo "===== Hello word, in ${FUNCNAME[0]}, with arguments $* ..."
  echo "==============================================="
}

########################################################################################################################
# Aliases for backwards compatibility
###

bake.recipe.my_old_command() {
  bake.my_new_command "$@"
}

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-02