mirror of
https://github.com/TangentFoxy/love-release.git
synced 2025-07-28 19:12:19 +00:00
Improves modules sourcing
A module should always begin with a test to `execute_module` to see if it should be executed. As modules are always sourced (even when embedded), a simple `return` will stop the subscript. Modules are executed in a subscript, so the global space will not be polluted, and will also be reset after the execution of the module. This commit also solves some bugs in Makefile and lua parser.
This commit is contained in:
6
Makefile
6
Makefile
@@ -11,7 +11,7 @@ SED_INSTALL_DIR=$(shell echo "$(INSTALL_DIR)" | sed -e 's/[\/&]/\\&/g')
|
||||
|
||||
love-release: clean
|
||||
mkdir -p $(BUILD_DIR)
|
||||
sed -e 's/INSTALL=false/INSTALL=true/' -e 's/SCRIPTS_DIR="scripts"/SCRIPTS_DIR="$(SED_INSTALL_DIR)\/scripts"/' love-release.sh > '$(BUILD_DIR)/love-release'
|
||||
sed -e 's/INSTALLED=false/INSTALLED=true/' -e 's/SCRIPTS_DIR="scripts"/SCRIPTS_DIR="$(SED_INSTALL_DIR)\/scripts"/' love-release.sh > '$(BUILD_DIR)/love-release'
|
||||
cp love-release.1 '$(BUILD_DIR)/love-release.1'
|
||||
gzip '$(BUILD_DIR)/love-release.1'
|
||||
|
||||
@@ -26,9 +26,9 @@ install:
|
||||
embedded: clean
|
||||
mkdir -p '$(BUILD_DIR)'
|
||||
sed 's/EMBEDDED=false/EMBEDDED=true/' love-release.sh > '$(BUILD_DIR)/love-release.sh'
|
||||
for file in scripts/*; do \
|
||||
for file in scripts/*.sh; do \
|
||||
module="$$(basename -s '.sh' "$$file")"; \
|
||||
content='if [[ $$(execute_module "'"$$module"'") == true ]]; then'$$'\n'"$$(cat $$file)"$$'\n''fi'$$'\n\n'; \
|
||||
content='(source <(cat <<\EndOfModule'$$'\n'"$$(cat $$file)"$$'\n''EndOfModule'$$'\n''))'$$'\n\n'; \
|
||||
echo "$$content" >> "$(BUILD_DIR)/tmp"; \
|
||||
done
|
||||
sed -i.bak -e '/include_scripts_here$$/r $(BUILD_DIR)/tmp' '$(BUILD_DIR)/love-release.sh';
|
||||
|
Reference in New Issue
Block a user