From 63183262d45e8d4c1c2c3773f5bc3bddbb2722cf Mon Sep 17 00:00:00 2001 From: Nick Yeoman Date: Wed, 31 May 2023 12:25:05 -0700 Subject: [PATCH] manifest and language is working so far --- README.md | 28 ++++++++++-- bin/component_parts/language.sh | 8 ++++ bin/component_parts/manifest.sh | 40 +++--------------- bin/create_component.sh | 9 ++-- bin/finalize.sh | 4 +- docs/CLI.md | 75 +++++++++++++++++++++++++++++++++ 6 files changed, 121 insertions(+), 43 deletions(-) create mode 100644 bin/component_parts/language.sh create mode 100644 docs/CLI.md diff --git a/README.md b/README.md index 967a2d3..2eff5dd 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,31 @@ Let's update our bash_profile with some alias: ```bash alias joomla='docker-compose exec -u www-data joomla php cli/joomla.php' ``` -Allowing you to just run commands like this: ```joomla core:check-updates``` +Allowing you to just run commands like this: +```bash +joomla core:check-updates +joomla site:down +joomla extension:list +joomla update:extensions:check +joomla cache:clean + +``` + +## Create A Component + +1. Move to the directory where you would like to keep the component. ```cd ~/joomla-components/``` +1. Run component creator from your Joomla install. ```bash ~/projects/joomla/projectName/bin/create_component.sh``` +1. Optionally save to git repo. ## References +* [Joomla Twig](https://phproberto.github.io/joomla-twig/) + +### Component + +* https://github.com/ceford/j4xdemos-com-mywalks/tree/master +* https://www.abdulwaheed.pk/en/blog/41-information-technology/44-joomla/302-how-to-create-joomla-4-component.html +* https://www.techfry.com/resources/how-to-create-joomla-component +* https://docs.joomla.org/J4.x:Developing_an_MVC_Component/Introduction * [Develop a component](https://docs.joomla.org/J4.x:Developing_an_MVC_Component/Developing_a_Basic_Component) -* [Minimal component](https://joomla.stackexchange.com/questions/22176/minimal-basic-structure-for-a-frontend-joomla-component-without-using-joomla-mvc) -* [Joomla CLI Cheatsheet](https://magazine.joomla.org/all-issues/june-2022/joomla-4-a-powerful-cli-application) -* [Joomla Twig](https://phproberto.github.io/joomla-twig/) \ No newline at end of file +* [Minimal component](https://joomla.stackexchange.com/questions/22176/minimal-basic-structure-for-a-frontend-joomla-component-without-using-joomla-mvc) \ No newline at end of file diff --git a/bin/component_parts/language.sh b/bin/component_parts/language.sh new file mode 100644 index 0000000..ec48044 --- /dev/null +++ b/bin/component_parts/language.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +cat < admin/language/en-GB/en-GB.com_${name}.ini +; com_${name} +COM_${name^^}_DESCRIPTION="Placeholder description, edit in language file" +EOM + + \ No newline at end of file diff --git a/bin/component_parts/manifest.sh b/bin/component_parts/manifest.sh index f75ef5e..a5800fc 100644 --- a/bin/component_parts/manifest.sh +++ b/bin/component_parts/manifest.sh @@ -16,54 +16,28 @@ cat < ${name}.xml com_${name} - ${current_date} ${JOOMLA_USER} ${EMAIL} https://www.example.com/ Copyright (C) 2023 ${JOOMLA_USER}, All rights reserved. GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + 0.0.1 + - COM_${name}_XML_DESCRIPTION - J4xdemos\Component\${name#com_} + COM_${name^^}_DESCRIPTION - - - sql/install.mysql.sql - - - - - sql/uninstall.mysql.sql - - - - - - - - forms - language - src - tmpl - + harvst\Component\com_${name} + + ${name} - access.xml - config.xml - forms language - services - sql - src - tmpl - com_mywalks + EOM diff --git a/bin/create_component.sh b/bin/create_component.sh index 2ec2fd5..7d0bf7a 100644 --- a/bin/create_component.sh +++ b/bin/create_component.sh @@ -7,7 +7,7 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" # ENV File ################################################################################# # Import variables from .env file -if [ -f "$script_dir/.env" ]; then +if [ -f "$script_dir/../.env" ]; then read -p "Found .env file at '$script_dir/.env'. Press Enter to use it, or enter a different file path: " env_file if [ -z "$env_file" ]; then env_file="$script_dir/.env" @@ -55,14 +55,17 @@ mkdir -p "$component_dir" # Create the main component files cd "$component_dir" || exit -mkdir -p site admin +mkdir -p site +mkdir -p admin/language/en-GB # Source the files for generating component files +source "$script_dir/component_parts/manifest.sh" +source "$script_dir/component_parts/language.sh" # source "$script_dir/component_parts/admin_controller.sh" # source "$script_dir/component_parts/site_controller.sh" # source "$script_dir/component_parts/site_controller_base.sh" # source "$script_dir/component_parts/admin_controller_base.sh" -source "$script_dir/component_parts/manifest.sh" + echo "Component framework generated successfully!" echo "You should manually edit the manifest file before checkin" diff --git a/bin/finalize.sh b/bin/finalize.sh index 12c6a32..b37699f 100644 --- a/bin/finalize.sh +++ b/bin/finalize.sh @@ -24,6 +24,4 @@ rm -rf bin/inc_new_project rm -rf bin/new_project.sh rm -rf bin/setup_joomla_installer.sh -# Git -git add . -git commit -m"ran finalize" +echo "Now check the results and commit them to Git" \ No newline at end of file diff --git a/docs/CLI.md b/docs/CLI.md new file mode 100644 index 0000000..a3a9a44 --- /dev/null +++ b/docs/CLI.md @@ -0,0 +1,75 @@ +# CLI Cheatsheet + +## Cache +``` +cache:clean Clean expired cache entries +``` + +## Config +``` +config:get Display the current value of a configuration option +config:set Set a value for a configuration option +``` + +## Core +``` +core:check-updates Check for Joomla updates +core:update Update Joomla +``` + +## Database +``` +database:export database:export +database:import Import the database +``` + +## Extension +``` +extension:discover Discover extensions +extension:discover:install Install discovered extensions +extension:discover:list List discovered extensions +extension:install Install an extension from a URL or from a path +extension:list List installed extensions +extension:remove Remove an extension +``` + +## Finder +``` +finder:index Purges and rebuild the index +Scheduler +scheduler:list List all scheduled tasks +scheduler:run Run one or more scheduled tasks +scheduler:state Enable, disable or trash a scheduled task +``` + +## Session +``` +session:gc Perform session garbage collection +session:metadata:gc Perform session metadata garbage collection +``` + +## Site +``` +site:down Put the site into offline mode +site:up Put the site into online mode +``` + +## Update +``` +update:extensions:check Check for pending extension updates +update:joomla:remove-old-files Remove old system files +``` + +## User +``` +user:add Add a user +user:addtogroup Add a user to a group +user:delete Delete a user +user:list List all users +user:removefromgroup Remove a user from a group +user:reset-password Change a user's password +``` + +## References + +* [Joomla Magazine - Powerful cli](https://magazine.joomla.org/all-issues/june-2022/joomla-4-a-powerful-cli-application) \ No newline at end of file