|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Sunnysideup\UpgradeToSilverstripe4\Tasks\IndividualTasks; |
|
4
|
|
|
|
|
5
|
|
|
use Sunnysideup\UpgradeToSilverstripe4\Api\FileSystemFixes; |
|
6
|
|
|
use Sunnysideup\UpgradeToSilverstripe4\Tasks\Task; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Runs through the source code and adds hidden Silverstripe property and method documentation to classes |
|
10
|
|
|
* based on the database array and has many lists |
|
11
|
|
|
*/ |
|
12
|
|
|
class AddResourceGitIgnore extends Task |
|
13
|
|
|
{ |
|
14
|
|
|
protected $taskStep = 's60'; |
|
15
|
|
|
|
|
16
|
|
|
protected $resourcesFolder = 'resources'; |
|
17
|
|
|
|
|
18
|
|
|
protected $string = <<<txt |
|
19
|
|
|
* |
|
20
|
|
|
!.htaccess |
|
21
|
|
|
!.gitignore |
|
22
|
|
|
txt; |
|
23
|
|
|
|
|
24
|
|
|
public function getTitle() |
|
25
|
|
|
{ |
|
26
|
|
|
return 'Add git ignore to resources folder. TO BE COMPLETED'; |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function getDescription() |
|
30
|
|
|
{ |
|
31
|
|
|
return 'Adds a gitignore file to the resources folder'; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function runActualTask($params = []): ?string |
|
35
|
|
|
{ |
|
36
|
|
|
$dir = $this->mu()->getWebRootDirLocation(); |
|
|
|
|
|
|
37
|
|
|
return null; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
protected function updateModuleConfigFile(string $moduleName) |
|
|
|
|
|
|
41
|
|
|
{ |
|
42
|
|
|
// $moduleLocation = $this->findModuleNameLocation($moduleName); |
|
43
|
|
|
|
|
44
|
|
|
// $fileLocation = $this->mu()->getWebRootDirLocation() . '/' . $moduleLocation . '/_config/' . $this->configFileName; |
|
45
|
|
|
// FileSystemFixes::inst($this->mu()) |
|
46
|
|
|
// ->removeDirOrFile($fileLocation); |
|
47
|
|
|
// $ideannotatorConfigForModule = $this->ideannotatorConfig; |
|
48
|
|
|
// $ideannotatorConfigForModule = str_replace(self::REPLACER, $moduleName, $ideannotatorConfigForModule); |
|
49
|
|
|
// $this->mu()->execMe( |
|
50
|
|
|
// $this->mu()->getWebRootDirLocation(), |
|
51
|
|
|
// 'echo \'' . str_replace('\'', '"', $ideannotatorConfigForModule) . '\' > ' . $fileLocation, |
|
52
|
|
|
// 'Adding IDEAnnotator configuration', |
|
53
|
|
|
// false |
|
54
|
|
|
// ); |
|
55
|
|
|
// if (! file_exists($fileLocation)) { |
|
56
|
|
|
// user_error('Could not locate ' . $fileLocation); |
|
57
|
|
|
// } |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
protected function hasCommitAndPush(): bool |
|
61
|
|
|
{ |
|
62
|
|
|
return true; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|