-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
239 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,3 +75,6 @@ jobs: | |
- stage: test | ||
php: 7.2 | ||
env: TYPO3_VERSION=~9.4.0 | ||
- stage: test | ||
php: 7.2 | ||
env: TYPO3_VERSION=~9.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,18 @@ | |
|
||
namespace KamiYang\ProjectVersion\Backend\ToolbarItems; | ||
|
||
/* | ||
* This file is part of the ProjectVersion project. | ||
* | ||
* It is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* For the full copyright and license information, please read | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use KamiYang\ProjectVersion\Facade\LocalizationUtilityFacade; | ||
use KamiYang\ProjectVersion\Service\ProjectVersionService; | ||
use TYPO3\CMS\Backend\Backend\ToolbarItems\SystemInformationToolbarItem; | ||
|
@@ -13,8 +25,6 @@ | |
|
||
/** | ||
* Class ProjectVersionSlot | ||
* | ||
* @author Jan Stockfisch <[email protected]> | ||
*/ | ||
final class ProjectVersionSlot implements SingletonInterface | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,25 @@ | |
|
||
namespace KamiYang\ProjectVersion\Configuration; | ||
|
||
/* | ||
* This file is part of the ProjectVersion project. | ||
* | ||
* It is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* For the full copyright and license information, please read | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use KamiYang\ProjectVersion\Enumeration\ProjectVersionModeEnumeration; | ||
use TYPO3\CMS\Core\SingletonInterface; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
use TYPO3\CMS\Core\Utility\StringUtility; | ||
|
||
/** | ||
* Class ExtensionConfiguration | ||
* | ||
* @author Jan Stockfisch <[email protected]> | ||
*/ | ||
final class ExtensionConfiguration implements SingletonInterface | ||
{ | ||
|
@@ -42,6 +52,11 @@ final class ExtensionConfiguration implements SingletonInterface | |
*/ | ||
private static $gitFormat = ''; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private static $staticVersion = ''; | ||
|
||
/** | ||
* Fetch absolute version filename. | ||
* | ||
|
@@ -76,13 +91,22 @@ public static function getGitFormat(): string | |
return self::$gitFormat; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public static function getStaticVersion(): string | ||
{ | ||
return self::$staticVersion; | ||
} | ||
|
||
public function __construct() | ||
{ | ||
self::$configuration = $this->getExtensionConfigurationFromGlobals(); | ||
|
||
self::$versionFilePath = $this->resolveVersionFilePath(); | ||
self::$mode = self::$configuration['mode']; | ||
self::$gitFormat = self::$configuration['gitFormat']; | ||
self::$staticVersion = self::$configuration['staticVersion']; | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,20 @@ | |
|
||
namespace KamiYang\ProjectVersion\Enumeration; | ||
|
||
/* | ||
* This file is part of the ProjectVersion project. | ||
* | ||
* It is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* For the full copyright and license information, please read | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Class GitCommandEnumeration | ||
* | ||
* @author Jan Stockfisch <[email protected]> | ||
*/ | ||
final class GitCommandEnumeration | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,25 @@ | |
|
||
namespace KamiYang\ProjectVersion\Enumeration; | ||
|
||
/* | ||
* This file is part of the ProjectVersion project. | ||
* | ||
* It is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* For the full copyright and license information, please read | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Class ProjectVersionModeEnumeration | ||
* | ||
* @author Jan Stockfisch <[email protected]> | ||
*/ | ||
final class ProjectVersionModeEnumeration | ||
{ | ||
const FILE = '0'; | ||
const GIT = '1'; | ||
const GIT_FILE_FALLBACK = '2'; | ||
const STATIC_VERSION = '3'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,22 @@ | |
|
||
namespace KamiYang\ProjectVersion\Facade; | ||
|
||
/* | ||
* This file is part of the ProjectVersion project. | ||
* | ||
* It is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* For the full copyright and license information, please read | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use TYPO3\CMS\Core\Utility\CommandUtility; | ||
|
||
/** | ||
* Class CommandUtilityFacade | ||
* | ||
* @author Jan Stockfisch <[email protected]> | ||
*/ | ||
class CommandUtilityFacade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,18 @@ | |
|
||
namespace KamiYang\ProjectVersion\Facade; | ||
|
||
/* | ||
* This file is part of the ProjectVersion project. | ||
* | ||
* It is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* For the full copyright and license information, please read | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility; | ||
|
||
/** | ||
|
@@ -12,7 +24,6 @@ | |
* | ||
* @see \TYPO3\CMS\Extbase\Utility\LocalizationUtility | ||
* @internal | ||
* @author Jan Stockfisch <[email protected]> | ||
*/ | ||
class LocalizationUtilityFacade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,18 @@ | |
|
||
namespace KamiYang\ProjectVersion\Facade; | ||
|
||
/* | ||
* This file is part of the ProjectVersion project. | ||
* | ||
* It is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* For the full copyright and license information, please read | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; | ||
|
||
/** | ||
|
@@ -11,7 +23,6 @@ | |
* | ||
* @see \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder | ||
* @internal | ||
* @author Jan Stockfisch <[email protected]> | ||
*/ | ||
class SystemEnvironmentBuilderFacade | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,22 @@ | |
|
||
namespace KamiYang\ProjectVersion\Service; | ||
|
||
/* | ||
* This file is part of the ProjectVersion project. | ||
* | ||
* It is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* For the full copyright and license information, please read | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use TYPO3\CMS\Core\SingletonInterface; | ||
|
||
/** | ||
* Class ProjectVersion | ||
* | ||
* @author Jan Stockfisch <[email protected]> | ||
*/ | ||
class ProjectVersion implements SingletonInterface | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,18 @@ | |
|
||
namespace KamiYang\ProjectVersion\Service; | ||
|
||
/* | ||
* This file is part of the ProjectVersion project. | ||
* | ||
* It is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* For the full copyright and license information, please read | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use KamiYang\ProjectVersion\Configuration\ExtensionConfiguration; | ||
use KamiYang\ProjectVersion\Enumeration\GitCommandEnumeration; | ||
use KamiYang\ProjectVersion\Enumeration\ProjectVersionModeEnumeration; | ||
|
@@ -13,8 +25,6 @@ | |
|
||
/** | ||
* Class ProjectVersionService | ||
* | ||
* @author Jan Stockfisch <[email protected]> | ||
*/ | ||
class ProjectVersionService implements SingletonInterface | ||
{ | ||
|
@@ -35,6 +45,9 @@ public function getProjectVersion(): ProjectVersion | |
$projectVersion = GeneralUtility::makeInstance(ProjectVersion::class); | ||
|
||
switch (ExtensionConfiguration::getMode()) { | ||
case ProjectVersionModeEnumeration::STATIC_VERSION: | ||
$this->setStaticVersion($projectVersion); | ||
break; | ||
case ProjectVersionModeEnumeration::GIT: | ||
$this->setVersionFromGit($projectVersion); | ||
break; | ||
|
@@ -114,6 +127,14 @@ protected function isGitAvailable(): bool | |
$returnCode === 0; | ||
} | ||
|
||
/** | ||
* @param \KamiYang\ProjectVersion\Service\ProjectVersion $projectVersion | ||
*/ | ||
private function setStaticVersion(ProjectVersion $projectVersion) | ||
{ | ||
$projectVersion->setVersion(ExtensionConfiguration::getStaticVersion()); | ||
} | ||
|
||
/** | ||
* Resolve version by common VERSION-file. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,18 @@ | |
|
||
namespace KamiYang\ProjectVersion\Tests\Unit\Backend\ToolbarItems; | ||
|
||
/* | ||
* This file is part of the ProjectVersion project. | ||
* | ||
* It is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* For the full copyright and license information, please read | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use KamiYang\ProjectVersion\Backend\ToolbarItems\ProjectVersionSlot; | ||
use KamiYang\ProjectVersion\Facade\LocalizationUtilityFacade; | ||
use KamiYang\ProjectVersion\Service\ProjectVersion; | ||
|
@@ -14,8 +26,6 @@ | |
|
||
/** | ||
* Class ProjectVersionSlotTest | ||
* | ||
* @author Jan Stockfisch <[email protected]> | ||
*/ | ||
class ProjectVersionSlotTest extends UnitTestCase | ||
{ | ||
|
Oops, something went wrong.