From d29b2ddeabb12829686c43a1546a58a5a7e29811 Mon Sep 17 00:00:00 2001 From: Amir Date: Mon, 19 Jul 2021 11:06:00 +0200 Subject: [PATCH 1/4] Akaunting module installer --- src/Composer/Installers/AkauntingInstaller.php | 10 ++++++++++ src/Composer/Installers/Installer.php | 1 + tests/Composer/Installers/Test/InstallerTest.php | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 src/Composer/Installers/AkauntingInstaller.php diff --git a/src/Composer/Installers/AkauntingInstaller.php b/src/Composer/Installers/AkauntingInstaller.php new file mode 100644 index 00000000..a65ec550 --- /dev/null +++ b/src/Composer/Installers/AkauntingInstaller.php @@ -0,0 +1,10 @@ + 'modules/{$name}', + ); +} \ No newline at end of file diff --git a/src/Composer/Installers/Installer.php b/src/Composer/Installers/Installer.php index 5e34941a..490681cf 100644 --- a/src/Composer/Installers/Installer.php +++ b/src/Composer/Installers/Installer.php @@ -20,6 +20,7 @@ class Installer extends LibraryInstaller * @var array */ private $supportedTypes = array( + 'akaunting' => 'AkauntingInstaller', 'asgard' => 'AsgardInstaller', 'attogram' => 'AttogramInstaller', 'agl' => 'AglInstaller', diff --git a/tests/Composer/Installers/Test/InstallerTest.php b/tests/Composer/Installers/Test/InstallerTest.php index f9b7ae57..b51241db 100644 --- a/tests/Composer/Installers/Test/InstallerTest.php +++ b/tests/Composer/Installers/Test/InstallerTest.php @@ -83,6 +83,7 @@ public function supportsProvider(): array { return array( array('agl-module', true), + array('akaunting-module', true), array('annotatecms-module', true), array('annotatecms-component', true), array('annotatecms-service', true), @@ -270,6 +271,7 @@ public function installPathProvider(): array { return array( array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'), + array('akaunting-module', 'modules/MyPackage', 'shama/MyPackage'), array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'), array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'), array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'), From 28a53369211df07cb5e24cfd0c8264189e690245 Mon Sep 17 00:00:00 2001 From: Amir Date: Mon, 19 Jul 2021 11:28:00 +0200 Subject: [PATCH 2/4] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 20c3f649..16d6f7ba 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ is **not needed** to install packages with these frameworks. | Framework | Types | --------- | ----- +| Akaunting | `akaunting-module` | Asgard | `asgard-module`
`asgard-theme` | Attogram | `attogram-module` | AGL | `agl-module` From b9651703729dc350d82e6473cb50b909e86ffb01 Mon Sep 17 00:00:00 2001 From: Amir Date: Mon, 19 Jul 2021 11:31:43 +0200 Subject: [PATCH 3/4] Format package name to CamelCase --- src/Composer/Installers/AkauntingInstaller.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Composer/Installers/AkauntingInstaller.php b/src/Composer/Installers/AkauntingInstaller.php index a65ec550..dcfe1777 100644 --- a/src/Composer/Installers/AkauntingInstaller.php +++ b/src/Composer/Installers/AkauntingInstaller.php @@ -7,4 +7,16 @@ class AkauntingInstaller extends BaseInstaller protected $locations = array( 'module' => 'modules/{$name}', ); + + /** + * Format package name to CamelCase + */ + public function inflectPackageVars($vars) + { + $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name'])); + $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); + $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); + + return $vars; + } } \ No newline at end of file From eeff9a4c05827b7552b4dcff20191cfca8c7f087 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 4 Aug 2021 15:34:38 +0200 Subject: [PATCH 4/4] Fix type info --- src/Composer/Installers/AkauntingInstaller.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Composer/Installers/AkauntingInstaller.php b/src/Composer/Installers/AkauntingInstaller.php index dcfe1777..c504c70f 100644 --- a/src/Composer/Installers/AkauntingInstaller.php +++ b/src/Composer/Installers/AkauntingInstaller.php @@ -4,6 +4,7 @@ class AkauntingInstaller extends BaseInstaller { + /** @var array */ protected $locations = array( 'module' => 'modules/{$name}', ); @@ -11,12 +12,12 @@ class AkauntingInstaller extends BaseInstaller /** * Format package name to CamelCase */ - public function inflectPackageVars($vars) + public function inflectPackageVars(array $vars): array { - $vars['name'] = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name'])); + $vars['name'] = strtolower($this->pregReplace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name'])); $vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']); $vars['name'] = str_replace(' ', '', ucwords($vars['name'])); return $vars; } -} \ No newline at end of file +}