manifest and language is working so far

This commit is contained in:
Nick Yeoman 2023-05-31 12:25:05 -07:00
parent 2e56d220d3
commit 63183262d4
6 changed files with 121 additions and 43 deletions

View File

@ -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/)
* [Minimal component](https://joomla.stackexchange.com/questions/22176/minimal-basic-structure-for-a-frontend-joomla-component-without-using-joomla-mvc)

View File

@ -0,0 +1,8 @@
#!/bin/bash
cat <<EOM > admin/language/en-GB/en-GB.com_${name}.ini
; com_${name}
COM_${name^^}_DESCRIPTION="Placeholder description, edit in language file"
EOM

View File

@ -16,54 +16,28 @@ cat <<EOM > ${name}.xml
<?xml version="1.0" encoding="UTF-8"?>
<extension type="component" method="upgrade">
<name>com_${name}</name>
<!-- The following elements are optional and free of formatting conttraints -->
<creationDate>${current_date}</creationDate>
<author>${JOOMLA_USER}</author>
<authorEmail>${EMAIL}</authorEmail>
<authorUrl>https://www.example.com/</authorUrl>
<copyright>Copyright (C) 2023 ${JOOMLA_USER}, All rights reserved.</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<!-- The version string is recorded in the components table -->
<version>0.0.1</version>
<!-- The description is optional and defaults to the name -->
<description>COM_${name}_XML_DESCRIPTION</description>
<namespace path="src">J4xdemos\Component\${name#com_}</namespace>
<description>COM_${name^^}_DESCRIPTION</description>
<install> <!-- Runs on install -->
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.sql</file>
</sql>
</install>
<uninstall> <!-- Runs on uninstall -->
<sql>
<file driver="mysql" charset="utf8">sql/uninstall.mysql.sql</file>
</sql>
</uninstall>
<!-- Site Main File Copy Section -->
<!-- Note the folder attribute: This attribute describes the folder
to copy FROM in the package to install therefore files copied
in this section are copied from /site/ in the package -->
<files folder="site">
<folder>forms</folder>
<folder>language</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<namespace path="src">harvst\Component\com_${name}</namespace>
<administration>
<!-- The link that will appear in the Admin panel's "Components" menu -->
<menu link="index.php?option=com_${name}">${name}</menu>
<files folder="admin">
<file>access.xml</file>
<file>config.xml</file>
<folder>forms</folder>
<folder>language</folder>
<folder>services</folder>
<folder>sql</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
<menu img="class:default" link="option=com_mywalks">com_mywalks</menu>
</administration>
</extension>
EOM

View File

@ -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"

View File

@ -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"

75
docs/CLI.md Normal file
View File

@ -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)