Joomla Custom Compoment Dev Env : Hot Deployment

非 Y 不嫁゛ 提交于 2019-12-08 12:17:28

问题


I'm planning on developing a Joomla custom component and storing the files in a git repo. The structure of my git project will mimic the deployed joomla struture

<root>
-administrator
  -components
    -com_abc
-components
  -com_abc
-modules
  -com_abc
-plugins
  -com_abc

Rather than having to copy/zip the php/html files for the component each time i'd like to try and use the joomla root folder as the root for my git project. I'd use the git ignore feature to exclude files that belong to the joomla core project. I'm wondering has anybody done something similar and how do you initially deploy your component. Is is just a case of using the Joomla Extension Manager and pointing the directory to the joomla root dir?


回答1:


I myself did this kind thing not long ago. I used the following three links to setup my development structure:

  • Extension development using eclipse and phing
  • Working with git and github
  • Working with git and github/My first pull request

What I now got is a separate Eclipse project for my local Joomla installation and every Joomla extension/template. On every extension I use Git, but not the Joomla installation itself.

Every time I make a change to a extension, I use a Eclipse builder to call on Phing that copies the edited files to my Joomla installation. This way, I can test the changes locally. When I'm ready to deploy the extensions to a remote site, I use Phing to build the zip packages so that I can manually install them using the Joomla Extension Manager.

Note that I'm on Windows and but I think it's a good solution for other operating systems too. Using Eclipse as editor is also nice, with code completion etc. I used Notepad++ before.

My extensions folder structure:

com_extensionname
    - backend
         - assets
         - controllers
         - helpers
         - language
         - models
         - sql
         - tables
         - views
         - access.xml
         - extensionname.php
         - config.xml
         - controller.php
         - index.html
         - router.php
         - LICENSE.txt
    - frontend
         - assets
         - controllers
         - helpers
         - language
         - models
         - views
         - extensionname.php
         - controller.php
         - index.html
         - router.php
    - build.xml
    - extensionname.xml

The Eclipse external tool to run the following file:

Location: Path to phing.bat
Working Directory: ${project_loc}
Arguments: create_packages (This only argument only goes to the "Create packages"-tool

Example of Phing xml file (build.xml):

<?xml version="1.0" encoding="UTF-8"?>
<project name="Project Name" default="copy_to_test" basedir=".">
<property name="test" value="YOUR PATH TO LOCAL JOOMLA INSTALLATION" override="true" />
<property name="src" value="${project.basedir}" override="true"/>

<!-- Package properties -->
<property name="package_path" value="PATH WHERE PACKAGES SHOULD GO" override="true" />
<property name="package_name" value="com_YOUREXTENSION" override="true" />

<!-- Files -->
<fileset dir="./frontend" id="frontend_files">
    <include name="**" />
    <exclude name="language/**" />
</fileset>
<fileset dir="./backend" id="backend_files">
    <include name="**" />
    <exclude name="language/**" />
    <exclude name="packages/**" />
</fileset>

<!-- Language files -->
<fileset dir="./frontend/language" id="frontend_language_files">
    <include name="**" />
</fileset>
<fileset dir="./backend/language" id="backend_language_files">
    <include name="**" />
</fileset>

<!-- All files (for packaging) -->
<fileset dir="${src}" id="allfiles">
    <include name="**" />
    <exclude name="backend/packages/**" />
    <exclude name=".**" />
</fileset>

<!-- Target: Copy to test -->
<target name="copy_to_test" description="Copies files to test project.">
    <echo message="Running build.xml. Copying files from dev to test..." />

    <!-- Manifest file -->
    <copy file="MANIFEST_FILE.xml" todir="${test}/administrator/components/com_YOUREXTENSION" />

    <!-- Component files -->
    <copy todir="${test}/components/com_YOUREXTENSION">
        <fileset refid="frontend_files" />
    </copy>
    <copy todir="${test}/administrator/components/com_YOUREXTENSION">
        <fileset refid="backend_files" />
    </copy>

    <!-- Language files -->
    <copy todir="${test}/language/en-GB">
        <fileset refid="frontend_language_files" />
    </copy>
    <copy todir="${test}/administrator/language/en-GB">
        <fileset refid="backend_language_files" />
    </copy>
</target>

<!-- Target: Create packages -->
<target name="create_packages" description="Generates package files">
    <echo message="Running build.xml. Generating package files" />

    <!-- <propertyprompt propertyName="package_version" defaultValue="" promptText="Enter version" /> -->
    <xmlproperty file="MANIFEST_FILE.xml"/>

    <delete file="${package_path}/${package_name}-${extension.version}.zip" />
    <delete file="${package_path}/${package_name}-${extension.version}.tar.gz" />

    <zip destfile="${package_path}/${package_name}-${extension.version}.zip">
        <fileset refid="allfiles" />
    </zip>
    <tar destfile="${package_path}/${package_name}-${extension.version}.tar.gz" compression="gzip">
        <fileset refid="allfiles" />
    </tar>
</target>



来源:https://stackoverflow.com/questions/9315526/joomla-custom-compoment-dev-env-hot-deployment

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!