feat: Add file headers

This commit is contained in:
Timo Reymann
2023-06-26 15:29:07 +02:00
parent 04c8db14d0
commit c8bccd8ab0
2 changed files with 39 additions and 3 deletions
+23
View File
@@ -0,0 +1,23 @@
###############################################################################
# #
# Bash TUI Toolkit #
# by Timo Reymann #
# #
# version: $VERSION #
# bundle: $BUNDLE #
# #
# Copyright (C) 2023 Timo Reymann (mail@timo-reymann.de) #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License. #
# You may obtain a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
# #
###############################################################################
+16 -3
View File
@@ -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