From 8e677c05f369a1d9194bcba2509074ca16c54773 Mon Sep 17 00:00:00 2001 From: Nick Yeoman Date: Tue, 6 Jun 2023 01:58:54 -0700 Subject: [PATCH] working now --- README.md | 52 ++++++++++++++++++------ bin/component_parts/defaultview.sh | 2 +- bin/component_parts/displaycontroller.sh | 4 +- bin/component_parts/manifest.sh | 4 +- bin/component_parts/provider.sh | 4 +- bin/component_parts/view.sh | 4 +- bin/create_component.sh | 3 +- 7 files changed, 51 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 2eff5dd..67c6cf5 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,44 @@ Joomla CMS. Make sure the projectName is set correctly, it's very important, because it's used for git, docker, mysql and joomla. -## Installation -1. Clone me ```git clone git@git.nickyeoman.com:nick/joomla.git projectName``` -1. cd projectName -1. Setup your .env file ```mv env.sample .env``` then edit with your favorite editor. -1. Prepare your project for git ```bash bin/new_project.sh``` -1. Run the containers to initialize ```sudo bash bin/docker_up.sh``` -1. cli installer ```bash bin/setup_joomla_installer.sh``` -1. Manually set Site Meta Description in [Administrator](http://localhost:8000/administrator/index.php?option=com_config) -1. Run ```sudo bash bin/finalize.sh``` +## Quick Installation -## Working Environment +```bash +# STEP 1 +# Clone the repo (change projectName to the name of your project) +git clone git@git.nickyeoman.com:nick/joomla.git projectName + +# STEP 2 +# Move into the dir +cd projectName + +# STEP 3 +# Setup your env file +mv env.sample .env +vi .env + +# STEP 4 +# Prepare your project for git +bash bin/new_project.sh + +# STEP 5 +# Run the containers to initialize +sudo bash bin/docker_up.sh + +# STEP 6 +# Joomla cli installer +sudo bash bin/setup_joomla_installer.sh + +# STEP 7 +# Manually set Site Meta Description in [Administrator](http://localhost:8000/administrator/index.php?option=com_config) + +# Step 8 +# Clean up and Config +sudo bash bin/finalize.sh + +``` + +## Development Environment Let's update our bash_profile with some alias: ```bash @@ -35,6 +62,7 @@ joomla cache:clean 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. +1. build the zip file by running bin/build_component.sh ## References @@ -44,7 +72,7 @@ joomla cache:clean * 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 +* Can't get this one working either: 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) + * Can't get this one working [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) \ No newline at end of file diff --git a/bin/component_parts/defaultview.sh b/bin/component_parts/defaultview.sh index 977728b..87f6748 100644 --- a/bin/component_parts/defaultview.sh +++ b/bin/component_parts/defaultview.sh @@ -6,7 +6,7 @@ if [[ -z "${name}" ]]; then exit 1 fi -cat < admin/src/View/${name}/html/default.php +cat < admin/tmpl/${name}/default.php

Hello ${name}!

diff --git a/bin/component_parts/displaycontroller.sh b/bin/component_parts/displaycontroller.sh index 21899fa..9931236 100644 --- a/bin/component_parts/displaycontroller.sh +++ b/bin/component_parts/displaycontroller.sh @@ -8,7 +8,7 @@ fi cat < admin/src/Controller/DisplayController.php ${name}.xml COM_${name^^}_DESCRIPTION - harvst\Component\\${name} + Harvst\Component\\${name^} - ${name} + ${name^} language services diff --git a/bin/component_parts/provider.sh b/bin/component_parts/provider.sh index 3c4de10..9411f2b 100644 --- a/bin/component_parts/provider.sh +++ b/bin/component_parts/provider.sh @@ -16,8 +16,8 @@ use Joomla\DI\ServiceProviderInterface; return new class implements ServiceProviderInterface { public function register(Container \$container): void { - \$container->registerServiceProvider(new MVCFactory('\\harvst\\Component\\${name}')); - \$container->registerServiceProvider(new ComponentDispatcherFactory('\\harvst\\Component\\${name}')); + \$container->registerServiceProvider(new MVCFactory('\\\\Harvst\\\\Component\\\\${name^}')); + \$container->registerServiceProvider(new ComponentDispatcherFactory('\\\\Harvst\\\\Component\\\\${name^}')); \$container->set( ComponentInterface::class, function (Container \$container) { diff --git a/bin/component_parts/view.sh b/bin/component_parts/view.sh index 08741d0..6f2ab02 100644 --- a/bin/component_parts/view.sh +++ b/bin/component_parts/view.sh @@ -6,10 +6,10 @@ if [[ -z "${name}" ]]; then exit 1 fi -cat < admin/src/View/${name}/HtmlView.php +cat < admin/src/View/${name^}/HtmlView.php /dev/null 2>&1 && pwd)" @@ -57,7 +58,7 @@ mkdir -p "$component_dir" cd "$component_dir" || exit mkdir -p site mkdir -p admin/language/en-GB admin/services -mkdir -p admin/src/View/${name} admin/tmpl/${name} +mkdir -p admin/src/Controller admin/src/View/${name^} admin/tmpl/${name} # Source the files for generating component files source "$script_dir/component_parts/manifest.sh"