Skip to content

Commit 142f3ca

Browse files
committed
feat core: finally finish placeholders
1 parent 964bd37 commit 142f3ca

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

Diff for: blueprint.sh

+26-18
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,15 @@ depend() {
162162
# Assign variables for extension flags.
163163
assignflags() {
164164
F_ignorePlaceholders=false
165-
F_ignoreAlphabetPlaceholders=false
165+
F_forceLegacyPlaceholders=false
166166
F_hasInstallScript=false
167167
F_hasRemovalScript=false
168168
F_hasExportScript=false
169169
F_developerIgnoreInstallScript=false
170170
F_developerIgnoreRebuild=false
171171
F_developerForceMigrate=false
172172
if [[ ( $flags == *"ignorePlaceholders,"* ) || ( $flags == *"ignorePlaceholders" ) ]]; then F_ignorePlaceholders=true ;fi
173-
if [[ ( $flags == *"ignoreAlphabetPlaceholders,"* ) || ( $flags == *"ignoreAlphabetPlaceholders" ) ]]; then F_ignoreAlphabetPlaceholders=true ;fi
173+
if [[ ( $flags == *"forceLegacyPlaceholders,"* ) || ( $flags == *"forceLegacyPlaceholders" ) ]]; then F_forceLegacyPlaceholders=true ;fi
174174
if [[ ( $flags == *"hasInstallScript,"* ) || ( $flags == *"hasInstallScript" ) ]]; then F_hasInstallScript=true ;fi
175175
if [[ ( $flags == *"hasRemovalScript,"* ) || ( $flags == *"hasRemovalScript" ) ]]; then F_hasRemovalScript=true ;fi
176176
if [[ ( $flags == *"hasExportScript,"* ) || ( $flags == *"hasExportScript" ) ]]; then F_hasExportScript=true ;fi
@@ -553,7 +553,8 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) || ( $2 == "-add" ) ]]; then VCMD="
553553

554554
# Use either legacy or stable placeholders for backwards compatibility.
555555
if [[ $target == "alpha-"* ]] \
556-
|| [[ $target == "indev-"* ]]; then
556+
|| [[ $target == "indev-"* ]] \
557+
|| $F_forceLegacyPlaceholders; then
557558

558559
# (v1) Legacy placeholders
559560
INSTALLMODE="normal"
@@ -575,22 +576,19 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) || ( $2 == "-add" ) ]]; then VCMD="
575576
-e "s~\^#blueprintversion#\^~$VERSION~g" \
576577
-e "s~\^#timestamp#\^~$INSTALL_STAMP~g" \
577578
-e "s~\^#componentroot#\^~@/blueprint/extensions/$identifier~g" \
579+
\
580+
-e "s~__version__~$version~g" \
581+
-e "s~__author__~$author~g" \
582+
-e "s~__identifier__~$identifier~g" \
583+
-e "s~__name__~$name~g" \
584+
-e "s~__path__~$FOLDER~g" \
585+
-e "s~__datapath__~$FOLDER/.blueprint/extensions/$identifier/private~g" \
586+
-e "s~__publicpath__~$FOLDER/.blueprint/extensions/$identifier/public~g" \
587+
-e "s~__installmode__~$INSTALLMODE~g" \
588+
-e "s~__blueprintversion__~$VERSION~g" \
589+
-e "s~__timestamp__~$INSTALL_STAMP~g" \
590+
-e "s~__componentroot__~@/blueprint/extensions/$identifier~g" \
578591
"$file"
579-
if ! $F_ignoreAlphabetPlaceholders; then
580-
sed -i \
581-
-e "s~__version__~$version~g" \
582-
-e "s~__author__~$author~g" \
583-
-e "s~__identifier__~$identifier~g" \
584-
-e "s~__name__~$name~g" \
585-
-e "s~__path__~$FOLDER~g" \
586-
-e "s~__datapath__~$FOLDER/.blueprint/extensions/$identifier/private~g" \
587-
-e "s~__publicpath__~$FOLDER/.blueprint/extensions/$identifier/public~g" \
588-
-e "s~__installmode__~$INSTALLMODE~g" \
589-
-e "s~__blueprintversion__~$VERSION~g" \
590-
-e "s~__timestamp__~$INSTALL_STAMP~g" \
591-
-e "s~__componentroot__~@/blueprint/extensions/$identifier~g" \
592-
"$file"
593-
fi
594592
elif [ -d "$file" ]; then
595593
PLACE_PLACEHOLDERS "$file"
596594
fi
@@ -621,6 +619,8 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) || ( $2 == "-add" ) ]]; then VCMD="
621619
-e "s~\\{timestamp~{!!!!timestamp~g" \
622620
-e "s~\\{mode~{!!!!mode~g" \
623621
-e "s~\\{target~{!!!!target~g" \
622+
-e "s~\\{root~{!!!!root~g" \
623+
-e "s~\\{webroot~{!!!!webroot~g" \
624624
-e "s~\\{is_~{!!!!is_~g" \
625625
\
626626
-e "s~{identifier}~$identifier~g" \
@@ -631,10 +631,16 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) || ( $2 == "-add" ) ]]; then VCMD="
631631
-e "s~{timestamp}~$INSTALL_STAMP~g" \
632632
-e "s~{mode}~$INSTALL_MODE~g" \
633633
-e "s~{target}~$VERSION~g" \
634+
-e "s~{root}~$FOLDER~g" \
635+
-e "s~{webroot}~/~g" \
634636
\
635637
-e "s~{identifier^}~${identifier^}~g" \
636638
-e "s~{identifier!}~${identifier^^}~g" \
637639
-e "s~{name!}~${name^^}~g" \
640+
-e "s~{root/public}~$FOLDER/.blueprint/extensions/$identifier/public~g" \
641+
-e "s~{root/data}~$FOLDER/.blueprint/extensions/$identifier/private~g" \
642+
-e "s~{webroot/public}~/extensions/$identifier~g" \
643+
-e "s~{webroot/fs}~/fs/extensions/$identifier~g" \
638644
\
639645
-e "s~{is_target}~$IS_TARGET~g" \
640646
\
@@ -646,6 +652,8 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) || ( $2 == "-add" ) ]]; then VCMD="
646652
-e "s~{!!!!timestamp~{timestamp~g" \
647653
-e "s~{!!!!mode~{mode~g" \
648654
-e "s~{!!!!target~{target~g" \
655+
-e "s~{!!!!root~{root~g" \
656+
-e "s~{!!!!webroot~{webroot~g" \
649657
-e "s~{!!!!is_~{is~g" \
650658
"$file"
651659

0 commit comments

Comments
 (0)