Skip to content

Commit 2d03b2e

Browse files
author
Michael Babker
authored
Merge pull request #170 from zero-24/supportnoncmslikestructurs2
Support non CMS like Repo Struktures
2 parents e39e5c5 + 498ffb8 commit 2d03b2e

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

administrator/components/com_patchtester/PatchTester/Model/PullModel.php

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ class PullModel extends \JModelDatabase
2626
* @var array
2727
* @since 2.0
2828
*/
29-
protected $nonProductionFolders = array('build', 'docs', 'installation', 'tests', '.github');
29+
protected $nonProductionFolders = array(
30+
'build',
31+
'docs',
32+
'installation',
33+
'tests',
34+
'.github',
35+
);
3036

3137
/**
3238
* Array containing non-production files
@@ -44,6 +50,14 @@ class PullModel extends \JModelDatabase
4450
'phpunit.xml.dist',
4551
'robots.txt.dist',
4652
'travisci-phpunit.xml',
53+
'LICENSE',
54+
'RoboFile.dist.ini',
55+
'RoboFile.php',
56+
'codeception.yml',
57+
'jorobo.dist.ini',
58+
'manifest.xml',
59+
'crowdin.yaml',
60+
'travis-lang-update.sh',
4761
);
4862

4963
/**
@@ -80,10 +94,21 @@ protected function parseFileList($files)
8094
}
8195
}
8296

97+
// Sometimes the repo filename is not the production file name
98+
$prodFileName = $file->filename;
99+
$filePath = explode('/', $prodFileName);
100+
101+
// Remove the `src` here to match the CMS paths if needed
102+
if ($filePath[0] === 'src')
103+
{
104+
$prodFileName = str_replace('src/', '', $prodFileName);
105+
}
106+
83107
$parsedFiles[] = (object) array(
84-
'action' => $file->status,
85-
'filename' => $file->filename,
86-
'fileurl' => $file->contents_url,
108+
'action' => $file->status,
109+
'filename' => $prodFileName,
110+
'repofilename' => $file->filename,
111+
'fileurl' => $file->contents_url,
87112
);
88113
}
89114

@@ -178,7 +203,7 @@ public function apply($id)
178203
try
179204
{
180205
$contentsResponse = $github->getFileContents(
181-
$pull->head->user->login, $this->getState()->get('github_repo'), $file->filename, urlencode($pull->head->ref)
206+
$pull->head->user->login, $this->getState()->get('github_repo'), $file->repofilename, urlencode($pull->head->ref)
182207
);
183208

184209
$contents = json_decode($contentsResponse->body);

administrator/components/com_patchtester/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<option value="joomla:joomla-cms">COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_JOOMLA_CMS</option>
1919
<option value="joomla-extensions:patchtester">COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_PATCHTESTER</option>
2020
<option value="joomla-extensions:install-from-web-client">COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_INSTALL_FROM_WEB</option>
21+
<option value="joomla-extensions:weblinks">COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_WEBLINKS</option>
2122
<option value="custom">COM_PATCHTESTER_FIELD_REPOSITORY_CUSTOM</option>
2223
</field>
2324

administrator/components/com_patchtester/language/en-GB/en-GB.com_patchtester.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ COM_PATCHTESTER_FIELD_REPOSITORY_LABEL="GitHub Repository"
5353
COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_JOOMLA_CMS="Joomla! CMS"
5454
COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_PATCHTESTER="Joomla! Patch Tester Component"
5555
COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_INSTALL_FROM_WEB="Joomla! Install From Web Plugin"
56+
COM_PATCHTESTER_FIELD_REPOSITORY_OPTION_WEBLINKS="Joomla! Weblinks Package"
5657
COM_PATCHTESTER_FIELD_REPOSITORY_CUSTOM="Custom"
5758
COM_PATCHTESTER_FIELDSET_REPOSITORIES_DESC="Configuration Values for GitHub Repository"
5859
COM_PATCHTESTER_FIELDSET_REPOSITORIES_LABEL="GitHub Repository"

0 commit comments

Comments
 (0)