Skip to content

Commit

Permalink
feat core Console: add artisan extension api
Browse files Browse the repository at this point in the history
  • Loading branch information
prplwtf committed May 11, 2024
1 parent 7ff4f20 commit 5ae2257
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Empty file.
29 changes: 25 additions & 4 deletions blueprint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,15 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) || ( $2 == "-add" ) ]]; then VCMD="

requests_views="$conf_requests_views"; #(optional)
requests_controllers="$conf_requests_controllers"; #(optional)
requests_artisan="$conf_requests_artisan"; #(optional)
requests_routers="$conf_requests_routers"; #(optional)
requests_routers_application="$conf_requests_routers_application"; #(optional)
requests_routers_client="$conf_requests_routers_client"; #(optional)
requests_routers_web="$conf_requests_routers_web"; #(optional)

database_migrations="$conf_database_migrations"; #(optional)

console_artisan="$conf_console_artisan"; #(optional)


# assign config aliases
if [[ $requests_routers_application == "" ]] \
Expand All @@ -446,7 +447,8 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) || ( $2 == "-add" ) ]]; then VCMD="
|| [[ ( $requests_routers_application == "/"* ) || ( $requests_routers_application == *"/.."* ) || ( $requests_routers_application == *"../"* ) || ( $requests_routers_application == *"/../"* ) || ( $requests_routers_application == *"~"* ) || ( $requests_routers_application == *"\\"* ) ]] \
|| [[ ( $requests_routers_client == "/"* ) || ( $requests_routers_client == *"/.."* ) || ( $requests_routers_client == *"../"* ) || ( $requests_routers_client == *"/../"* ) || ( $requests_routers_client == *"~"* ) || ( $requests_routers_client == *"\\"* ) ]] \
|| [[ ( $requests_routers_web == "/"* ) || ( $requests_routers_web == *"/.."* ) || ( $requests_routers_web == *"../"* ) || ( $requests_routers_web == *"/../"* ) || ( $requests_routers_web == *"~"* ) || ( $requests_routers_web == *"\\"* ) ]] \
|| [[ ( $database_migrations == "/"* ) || ( $database_migrations == *"/.."* ) || ( $database_migrations == *"../"* ) || ( $database_migrations == *"/../"* ) || ( $database_migrations == *"~"* ) || ( $database_migrations == *"\\"* ) ]]; then
|| [[ ( $database_migrations == "/"* ) || ( $database_migrations == *"/.."* ) || ( $database_migrations == *"../"* ) || ( $database_migrations == *"/../"* ) || ( $database_migrations == *"~"* ) || ( $database_migrations == *"\\"* ) ]] \
|| [[ ( $console_artisan == "/"* ) || ( $console_artisan == *"/.."* ) || ( $console_artisan == *"../"* ) || ( $console_artisan == *"/../"* ) || ( $console_artisan == *"~"* ) || ( $console_artisan == *"\\"* ) ]]; then
rm -R ".blueprint/tmp/$n"
PRINT FATAL "Config file paths cannot escape the extension bundle."
exit 1
Expand All @@ -458,7 +460,8 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) || ( $2 == "-add" ) ]]; then VCMD="
|| [[ ( $data_public == *"/" ) ]] \
|| [[ ( $requests_views == *"/" ) ]] \
|| [[ ( $requests_controllers == *"/" ) ]] \
|| [[ ( $database_migrations == *"/" ) ]]; then
|| [[ ( $database_migrations == *"/" ) ]] \
|| [[ ( $console_artisan == *"/" ) ]]; then
rm -R ".blueprint/tmp/$n"
PRINT FATAL "Directory paths in conf.yml should not end with a slash."
exit 1
Expand Down Expand Up @@ -788,6 +791,14 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) || ( $2 == "-add" ) ]]; then VCMD="
fi
fi

# Place and link artisan directory.
if [[ $console_artisan != "" ]]; then
PRINT INFO "Cloning and linking artisan directory.."
mkdir -p ".blueprint/extensions/$identifier/console/artisan"
cp -R ".blueprint/tmp/$n/$console_artisan/"* ".blueprint/extensions/$identifier/console/artisan/" 2>> $BLUEPRINT__DEBUG
ln -s -r -T $FOLDER/.blueprint/extensions/"$identifier"/console/artisan "$FOLDER/app/Console/Commands/BlueprintFramework/Extensions/$identifier" 2>> $BLUEPRINT__DEBUG
fi

# Create, link and connect components directory.
if [[ $dashboard_components != "" ]]; then
YARN="y"
Expand Down Expand Up @@ -1456,13 +1467,14 @@ if [[ ( $2 == "-r" ) || ( $2 == "-remove" ) ]]; then VCMD="y"

requests_views="$conf_requests_views"; #(optional)
requests_controllers="$conf_requests_controllers"; #(optional)
requests_artisan="$conf_requests_artisan"; #(optional)
requests_routers="$conf_requests_routers"; #(optional)
requests_routers_application="$conf_requests_routers_application"; #(optional)
requests_routers_client="$conf_requests_routers_client"; #(optional)
requests_routers_web="$conf_requests_routers_web"; #(optional)

database_migrations="$conf_database_migrations"; #(optional)

console_artisan="$conf_console_artisan"; #(optional)
else
PRINT FATAL "Extension configuration file not found or detected."
exit 1
Expand Down Expand Up @@ -1691,6 +1703,15 @@ if [[ ( $2 == "-r" ) || ( $2 == "-remove" ) ]]; then VCMD="y"
&>> $BLUEPRINT__DEBUG
fi

# Remove console folder
if [[ $console_artisan != "" ]]; then # further expand on this if needed
PRINT INFO "Removing and unlinking console folder.."
rm -R \
".blueprint/extensions/$identifier/console" \
"app/Console/Commands/BlueprintFramework/Extensions/$identifier"
# add more files if needed
fi

# Remove private folder
PRINT INFO "Removing and unlinking private folder.."
rm -R ".blueprint/extensions/$identifier/private"
Expand Down

0 comments on commit 5ae2257

Please sign in to comment.