Skip to content

Commit 38723bf

Browse files
Packaged module and component
1 parent ba5cbad commit 38723bf

File tree

16 files changed

+79
-63
lines changed

16 files changed

+79
-63
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,29 +122,54 @@ jobs:
122122
id: version
123123
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
124124

125-
- name: Create component zip with version
125+
- name: Update XML versions
126+
run: |
127+
sed -i "s|<version>.*</version>|<version>${{ steps.version.outputs.version }}</version>|" src/component/cmsmigrator.xml
128+
sed -i "s|<version>.*</version>|<version>${{ steps.version.outputs.version }}</version>|" src/modules/mod_migrationnotice/mod_migrationnotice.xml
129+
sed -i "s|<version>.*</version>|<version>${{ steps.version.outputs.version }}</version>|" pkg_cmsmigrator.xml
130+
131+
- name: Create component zip
126132
run: |
127133
mkdir -p cypress/fixtures
128134
cd src/component
129135
zip -r ../../cypress/fixtures/com_cmsmigrator_v${{ steps.version.outputs.version }}.zip .
130136
131-
- name: Verify zip file exists
132-
run: ls -lh cypress/fixtures/
137+
- name: Create module zip
138+
run: |
139+
cd src/modules/mod_migrationnotice
140+
zip -r ../../../cypress/fixtures/mod_migrationnotice.zip .
133141
134-
- name: Update XML version
142+
- name: Create package zip
135143
run: |
136-
sed -i "s|<version>.*</version>|<version>${{ steps.version.outputs.version }}</version>|" src/component/cmsmigrator.xml
144+
# Copy package manifest and language files to fixtures
145+
cp pkg_cmsmigrator.xml cypress/fixtures/
146+
cp -r language cypress/fixtures/
147+
148+
# Create constituents directory and move component/module zips there
149+
cd cypress/fixtures
150+
mkdir -p constituents
151+
cp com_cmsmigrator_v${{ steps.version.outputs.version }}.zip constituents/com_cmsmigrator.zip
152+
cp mod_migrationnotice.zip constituents/
153+
154+
# Create the package zip with the new structure
155+
zip -r pkg_cmsmigrator_v${{ steps.version.outputs.version }}.zip \
156+
pkg_cmsmigrator.xml \
157+
constituents/ \
158+
language/
159+
160+
- name: Verify zip files exist
161+
run: ls -lh cypress/fixtures/
137162

138-
- name: Commit version update
163+
- name: Commit version updates
139164
run: |
140165
git config --local user.email "[email protected]"
141166
git config --local user.name "GitHub Action"
142-
git add src/component/cmsmigrator.xml
167+
git add src/component/cmsmigrator.xml src/modules/mod_migrationnotice/mod_migrationnotice.xml pkg_cmsmigrator.xml
143168
git commit -m "Bump version to ${{ steps.version.outputs.version }}" || echo "No changes to commit"
144169
git push origin main
145170
146-
- name: Upload asset to GitHub Release
171+
- name: Upload assets to GitHub Release
147172
run: |
148-
gh release upload ${{ github.event.release.tag_name }} cypress/fixtures/com_cmsmigrator_v${{ steps.version.outputs.version }}.zip --clobber
173+
gh release upload ${{ github.event.release.tag_name }} cypress/fixtures/pkg_cmsmigrator_v${{ steps.version.outputs.version }}.zip --clobber
149174
env:
150175
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

language/en-GB/pkg_cmsmigrator.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
; Package Language File
2+
PKG_CMSMIGRATOR="CMS Migrator Package"
3+
PKG_CMSMIGRATOR_DESCRIPTION="This component helps in migrating websites from other platforms to Joomla."
4+
PKG_CMSMIGRATOR_INSTALL_SUCCESS="CMS Migrator Package has been successfully installed!"
5+
PKG_CMSMIGRATOR_UNINSTALL_SUCCESS="CMS Migrator Package has been successfully uninstalled!"
6+
PKG_CMSMIGRATOR_UPDATE_SUCCESS="CMS Migrator Package has been successfully updated!"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
; Package System Language File
2+
PKG_CMSMIGRATOR="CMS Migrator Package"
3+
PKG_CMSMIGRATOR_DESCRIPTION="This component helps in migrating websites from other platforms to Joomla."

pkg_cmsmigrator.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* @package CMS Migrator Package
5+
* @subpackage pkg_cmsmigrator
6+
* @copyright Copyright (C) 2025 Open Source Matters, Inc.
7+
* @license GNU General Public License version 2 or later; see LICENSE.txt
8+
*/
9+
-->
10+
<extension type="package" method="upgrade">
11+
<name>PKG_CMSMIGRATOR</name>
12+
<author>Rahul Singh</author>
13+
<authorEmail>[email protected]</authorEmail>
14+
<authorUrl>https://rahulsingh.free.nf/</authorUrl>
15+
<creationDate>2025-10-03</creationDate>
16+
<copyright>(C) 2025 Open Source Matters, Inc.</copyright>
17+
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
18+
<version>0.9.0</version>
19+
<description>PKG_CMSMIGRATOR_DESCRIPTION</description>
20+
<packager>Joomla Academy</packager>
21+
<packagerurl>https://github.com/Rahulsingh1939/JA-Advanced-Migration-Tool</packagerurl>
22+
23+
<files folder="constituents">
24+
<file type="component" id="com_cmsmigrator">com_cmsmigrator.zip</file>
25+
<file type="module" id="mod_migrationnotice" client="site">mod_migrationnotice.zip</file>
26+
</files>
27+
28+
<updateservers>
29+
<server type="extension" priority="1" name="CMS Migrator Package Updates">
30+
<![CDATA[https://api.github.com/repos/Rahulsingh1939/JA-Advanced-Migration-Tool/releases/latest]]>
31+
</server>
32+
</updateservers>
33+
</extension>

src/component/cmsmigrator.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
<files folder="site">
2323
</files>
2424

25-
<!-- Include bundled extensions -->
26-
<files>
27-
<folder>modules</folder>
28-
</files>
29-
3025
<media destination="com_cmsmigrator" folder="media/com_cmsmigrator">
3126
<filename>joomla.asset.json</filename>
3227
<folder>js</folder>

src/component/script.php

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -160,51 +160,14 @@ private function createMediaFolder(): void
160160
}
161161

162162
/**
163-
* Install bundled extensions that come with the component
163+
* Placeholder for future bundled extensions installation
164164
*
165165
* @param InstallerAdapter $parent The installer adapter
166166
*
167167
* @return void
168168
*/
169169
private function installBundledExtensions($parent): void
170170
{
171-
// Get the source path of the component package
172-
$sourcePath = $parent->getParent()->getPath('source');
173-
174-
// Try different possible paths for the module
175-
$possiblePaths = [
176-
$sourcePath . '/modules/mod_migrationnotice',
177-
$sourcePath . '/../modules/mod_migrationnotice',
178-
dirname($sourcePath) . '/modules/mod_migrationnotice'
179-
];
180-
181-
$moduleSourcePath = null;
182-
foreach ($possiblePaths as $path) {
183-
Log::add('Checking path: ' . $path, Log::INFO, 'com_cmsmigrator');
184-
if (file_exists($path) && file_exists($path . '/mod_migrationnotice.xml')) {
185-
$moduleSourcePath = $path;
186-
Log::add('Found module at: ' . $path, Log::INFO, 'com_cmsmigrator');
187-
break;
188-
}
189-
}
190-
191-
if ($moduleSourcePath) {
192-
try {
193-
$moduleInstaller = new Installer();
194-
$result = $moduleInstaller->install($moduleSourcePath);
195-
196-
if ($result) {
197-
Log::add('Successfully installed bundled module: mod_migrationnotice', Log::INFO, 'com_cmsmigrator');
198-
} else {
199-
$errors = $moduleInstaller->getErrors();
200-
Log::add('Failed to install bundled module: mod_migrationnotice. Errors: ' . implode('; ', $errors), Log::WARNING, 'com_cmsmigrator');
201-
}
202-
} catch (\Exception $e) {
203-
Log::add('Exception during module installation: ' . $e->getMessage(), Log::ERROR, 'com_cmsmigrator');
204-
}
205-
} else {
206-
Log::add('Bundled module not found in any of the expected locations', Log::WARNING, 'com_cmsmigrator');
207-
Log::add('Available files in source: ' . print_r(scandir($sourcePath), true), Log::INFO, 'com_cmsmigrator');
208-
}
171+
// module installation code for bundled installer
209172
}
210173
}

src/component/modules/mod_migrationnotice/language/en-GB/mod_migrationnotice.ini renamed to src/modules/mod_migrationnotice/language/en-GB/mod_migrationnotice.ini

File renamed without changes.

src/component/modules/mod_migrationnotice/language/en-GB/mod_migrationnotice.sys.ini renamed to src/modules/mod_migrationnotice/language/en-GB/mod_migrationnotice.sys.ini

File renamed without changes.

src/component/modules/mod_migrationnotice/media/css/module.css renamed to src/modules/mod_migrationnotice/media/css/module.css

File renamed without changes.

src/component/modules/mod_migrationnotice/mod_migrationnotice.xml renamed to src/modules/mod_migrationnotice/mod_migrationnotice.xml

File renamed without changes.

0 commit comments

Comments
 (0)