Skip to content

Commit

Permalink
add metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
francescobianco committed Jun 27, 2024
1 parent 81ffb95 commit 6b591bc
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 21 deletions.
59 changes: 49 additions & 10 deletions bin/mush
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @package: mush
# @build_type: bin
# @build_with: Mush 0.2.0 (2024-03-21)
# @build_date: 2024-06-27T13:59:42Z
# @build_date: 2024-06-27T14:49:34Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down Expand Up @@ -73,11 +73,6 @@ main() {
eval "set -- --help"
fi

if [ "${1:0:1}" != "-" ] && command -v "mush-$1" >/dev/null 2>&1; then
"mush-$1" "$@"
exit $?
fi

eval "$(getoptions parser_definition parse "$0") exit 1"
parse "$@"
eval "set -- $REST"
Expand Down Expand Up @@ -513,14 +508,17 @@ run_install() {

if [ -n "$PACKAGE_PATH" ]; then
package_path=$(realpath "$PACKAGE_PATH")

[ "${VERBOSE}" -gt 5 ] && console_info "Installing" "path='$PACKAGE_PATH' realpath='$package_path'"

if [ -f "${package_path}/Manifest.toml" ]; then
exec_manifest_lookup "${package_path}"
MUSH_TARGET_PATH=target/release
exec_legacy_fetch "${MUSH_TARGET_PATH}"
exec_legacy_build "${MUSH_TARGET_PATH}"
exec_dependencies "${MUSH_TARGET_PATH}"
exec_build_release "$@"
exec_install_binaries
exec_install
else
console_error "'${package_path}' does not contain a Manifest.toml file. --path must point to a directory containing a Manifest.toml file."
Expand Down Expand Up @@ -927,7 +925,7 @@ console_hint() {
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:38Z
## @build_date: 2024-06-27T14:49:29Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down Expand Up @@ -1473,6 +1471,37 @@ exec_init() {
console_status "Created" "binary (application) package"
}

exec_install_binaries() {
echo "${MUSH_BINARIES}"

local binaries
local bin_name
local bin_path

binaries="${MUSH_BINARIES}"

IFS=$'\n'
for bin in $binaries; do
bin_name=""
bin_path=""

IFS=',' read -r -a fields <<< "$bin"
for field in "${fields[@]}"; do
case "$field" in
name=*)
bin_name="${field#name=}"
;;
path=*)
bin_path="${field#path=}"
;;
esac
done

echo "name: $bin_name, path: $bin_path"
done
}


exec_install() {
local package_name
local package_version
Expand Down Expand Up @@ -1748,7 +1777,7 @@ manifest_parse() {
#echo "S:"
newline=$'\n'
section=MUSH_USTABLE
while IFS= read line || [[ -n "${line}" ]]; do
while IFS= read -r line || [[ -n "${line}" ]]; do
line="${line#"${line%%[![:space:]]*}"}"
line="${line%"${line##*[![:space:]]}"}"
line_number=$((line_number + 1))
Expand Down Expand Up @@ -1785,6 +1814,10 @@ manifest_parse() {
"[features]")
section=MUSH_FEATURE
;;
"[[bin]]")
section=MUSH_BINARIES
MUSH_BINARIES="${MUSH_BINARIES}${newline}"
;;
[a-z]*)
case $section in
MUSH_PACKAGE)
Expand Down Expand Up @@ -1828,6 +1861,12 @@ manifest_parse() {
MUSH_FEATURES="${MUSH_FEATURES}${feature}=${value}${newline}"
#eval "${section}_${field}=\$value"
;;
MUSH_BINARIES)
field=$(echo "$line" | cut -d'=' -f1 | xargs | tr '-' '_')
value=$(echo "$line" | cut -d'=' -f2 | xargs)
MUSH_BINARIES="${MUSH_BINARIES}${field}=${value},"
#eval "${section}_${field}=\$value"
;;
*)
;;
esac
Expand Down Expand Up @@ -2235,7 +2274,7 @@ process_dependencies_build() {
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:39Z
## @build_date: 2024-06-27T14:49:30Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down Expand Up @@ -2294,7 +2333,7 @@ console_print() {
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:42Z
## @build_date: 2024-06-27T14:49:34Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion lib/code_dumper
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:38Z
## @build_date: 2024-06-27T14:49:29Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion lib/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:39Z
## @build_date: 2024-06-27T14:49:30Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion lib/getoptions
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:42Z
## @build_date: 2024-06-27T14:49:34Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down
3 changes: 3 additions & 0 deletions src/commands/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ run_install() {

if [ -n "$PACKAGE_PATH" ]; then
package_path=$(realpath "$PACKAGE_PATH")

[ "${VERBOSE}" -gt 5 ] && console_info "Installing" "path='$PACKAGE_PATH' realpath='$package_path'"

if [ -f "${package_path}/Manifest.toml" ]; then
exec_manifest_lookup "${package_path}"
MUSH_TARGET_PATH=target/release
exec_legacy_fetch "${MUSH_TARGET_PATH}"
exec_legacy_build "${MUSH_TARGET_PATH}"
exec_dependencies "${MUSH_TARGET_PATH}"
exec_build_release "$@"
exec_install_binaries
exec_install
else
console_error "'${package_path}' does not contain a Manifest.toml file. --path must point to a directory containing a Manifest.toml file."
Expand Down
31 changes: 31 additions & 0 deletions src/tasks/install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@

exec_install_binaries() {
echo "${MUSH_BINARIES}"

local binaries
local bin_name
local bin_path

binaries="${MUSH_BINARIES}"

IFS=$'\n'
for bin in $binaries; do
bin_name=""
bin_path=""

IFS=',' read -r -a fields <<< "$bin"
for field in "${fields[@]}"; do
case "$field" in
name=*)
bin_name="${field#name=}"
;;
path=*)
bin_path="${field#path=}"
;;
esac
done

echo "name: $bin_name, path: $bin_path"
done
}


exec_install() {
local package_name
local package_version
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/manifest_lookup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ manifest_parse() {
MUSH_BINARIES)
field=$(echo "$line" | cut -d'=' -f1 | xargs | tr '-' '_')
value=$(echo "$line" | cut -d'=' -f2 | xargs)
MUSH_FEATURES="${MUSH_FEATURES}${field}=${value},"
MUSH_BINARIES="${MUSH_BINARIES}${field}=${value},"
#eval "${section}_${field}=\$value"
;;
*)
Expand Down
54 changes: 49 additions & 5 deletions target/release/mush
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @package: mush
# @build_type: bin
# @build_with: Mush 0.2.0 (2024-03-21)
# @build_date: 2024-06-27T13:59:42Z
# @build_date: 2024-06-27T14:49:34Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down Expand Up @@ -508,14 +508,17 @@ run_install() {

if [ -n "$PACKAGE_PATH" ]; then
package_path=$(realpath "$PACKAGE_PATH")

[ "${VERBOSE}" -gt 5 ] && console_info "Installing" "path='$PACKAGE_PATH' realpath='$package_path'"

if [ -f "${package_path}/Manifest.toml" ]; then
exec_manifest_lookup "${package_path}"
MUSH_TARGET_PATH=target/release
exec_legacy_fetch "${MUSH_TARGET_PATH}"
exec_legacy_build "${MUSH_TARGET_PATH}"
exec_dependencies "${MUSH_TARGET_PATH}"
exec_build_release "$@"
exec_install_binaries
exec_install
else
console_error "'${package_path}' does not contain a Manifest.toml file. --path must point to a directory containing a Manifest.toml file."
Expand Down Expand Up @@ -922,7 +925,7 @@ console_hint() {
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:38Z
## @build_date: 2024-06-27T14:49:29Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down Expand Up @@ -1468,6 +1471,37 @@ exec_init() {
console_status "Created" "binary (application) package"
}

exec_install_binaries() {
echo "${MUSH_BINARIES}"

local binaries
local bin_name
local bin_path

binaries="${MUSH_BINARIES}"

IFS=$'\n'
for bin in $binaries; do
bin_name=""
bin_path=""

IFS=',' read -r -a fields <<< "$bin"
for field in "${fields[@]}"; do
case "$field" in
name=*)
bin_name="${field#name=}"
;;
path=*)
bin_path="${field#path=}"
;;
esac
done

echo "name: $bin_name, path: $bin_path"
done
}


exec_install() {
local package_name
local package_version
Expand Down Expand Up @@ -1743,7 +1777,7 @@ manifest_parse() {
#echo "S:"
newline=$'\n'
section=MUSH_USTABLE
while IFS= read line || [[ -n "${line}" ]]; do
while IFS= read -r line || [[ -n "${line}" ]]; do
line="${line#"${line%%[![:space:]]*}"}"
line="${line%"${line##*[![:space:]]}"}"
line_number=$((line_number + 1))
Expand Down Expand Up @@ -1780,6 +1814,10 @@ manifest_parse() {
"[features]")
section=MUSH_FEATURE
;;
"[[bin]]")
section=MUSH_BINARIES
MUSH_BINARIES="${MUSH_BINARIES}${newline}"
;;
[a-z]*)
case $section in
MUSH_PACKAGE)
Expand Down Expand Up @@ -1823,6 +1861,12 @@ manifest_parse() {
MUSH_FEATURES="${MUSH_FEATURES}${feature}=${value}${newline}"
#eval "${section}_${field}=\$value"
;;
MUSH_BINARIES)
field=$(echo "$line" | cut -d'=' -f1 | xargs | tr '-' '_')
value=$(echo "$line" | cut -d'=' -f2 | xargs)
MUSH_BINARIES="${MUSH_BINARIES}${field}=${value},"
#eval "${section}_${field}=\$value"
;;
*)
;;
esac
Expand Down Expand Up @@ -2230,7 +2274,7 @@ process_dependencies_build() {
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:39Z
## @build_date: 2024-06-27T14:49:30Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down Expand Up @@ -2289,7 +2333,7 @@ console_print() {
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:42Z
## @build_date: 2024-06-27T14:49:34Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion target/release/packages/code_dumper/lib.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:38Z
## @build_date: 2024-06-27T14:49:29Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down
2 changes: 1 addition & 1 deletion target/release/packages/console/lib.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
## BP010: Release metadata
## @build_type: lib
## @build_date: 2024-06-27T13:59:39Z
## @build_date: 2024-06-27T14:49:30Z
set -e
use() { return 0; }
extern() { return 0; }
Expand Down

0 comments on commit 6b591bc

Please sign in to comment.