feat: Add file headers
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
SHELL := /bin/bash
|
||||
.PHONY: help
|
||||
VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1`)
|
||||
|
||||
help: ## Display this help page
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
@@ -18,9 +19,19 @@ _remove_comments_from_file:
|
||||
@cat $(file) | sed '/^$$/d' | sed '/^#/d' | sed '/^\s*#/d' | tee $(file) > /dev/null
|
||||
|
||||
_push_module:
|
||||
echo "=> Push module $(module)"
|
||||
cp src/$(module).sh dist/$(module).sh
|
||||
@echo "=> Push module $(module)"
|
||||
@cp src/$(module).sh dist/$(module).sh
|
||||
@$(MAKE) _remove_comments_from_file file=dist/$(module).sh
|
||||
@$(MAKE) _add_license_header file=dist/$(module).sh bundle=$(module)
|
||||
|
||||
_add_license_header:
|
||||
@export suffix=$(shell uuidgen) && \
|
||||
echo "=> Add license header for bundle $(bundle) to file $(file)" && \
|
||||
export VERSION="$(shell printf "%-8s" $(VERSION))" && \
|
||||
export BUNDLE="$(shell printf "%-20s" $(bundle))" && \
|
||||
cat .development/license-header-template | envsubst > /tmp/license-add.${suffix} && \
|
||||
cat $(file) >> /tmp/license-add.${suffix} && \
|
||||
cat /tmp/license-add.${suffix} > $(file)
|
||||
|
||||
build: ## Bundle script to dist folder and remove all top level comments
|
||||
@echo "=> Create dist folder"
|
||||
@@ -31,7 +42,9 @@ build: ## Bundle script to dist folder and remove all top level comments
|
||||
@echo "=> Bundle and remove comments from target files"
|
||||
@docker run --rm bash-tui-toolkit/builder 'bash_bundler bundle --entry src/main.sh --output /dev/stderr' 2>dist/bundle.sh
|
||||
@$(MAKE) _remove_comments_from_file file=dist/bundle.sh
|
||||
@$(MAKE) _add_license_header file=dist/bundle.sh bundle=bundle
|
||||
@$(MAKE) _push_module module=logging
|
||||
@$(MAKE) _push_module module=prompts
|
||||
@$(MAKE) _push_module module=user_feedback
|
||||
$(MAKE) _push_module module=platform_helpers
|
||||
@$(MAKE) _push_module module=platform_helpers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user