Skip to content

Commit 0c19fe4

Browse files
authored
Akaunting module (#489)
1 parent e481fb9 commit 0c19fe4

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ is **not needed** to install packages with these frameworks.
2828
2929
| Framework | Types
3030
| --------- | -----
31+
| Akaunting | `akaunting-module`
3132
| Asgard | `asgard-module`<br>`asgard-theme`
3233
| Attogram | `attogram-module`
3334
| AGL | `agl-module`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Composer\Installers;
4+
5+
class AkauntingInstaller extends BaseInstaller
6+
{
7+
/** @var array<string, string> */
8+
protected $locations = array(
9+
'module' => 'modules/{$name}',
10+
);
11+
12+
/**
13+
* Format package name to CamelCase
14+
*/
15+
public function inflectPackageVars(array $vars): array
16+
{
17+
$vars['name'] = strtolower($this->pregReplace('/(?<=\\w)([A-Z])/', '_\\1', $vars['name']));
18+
$vars['name'] = str_replace(array('-', '_'), ' ', $vars['name']);
19+
$vars['name'] = str_replace(' ', '', ucwords($vars['name']));
20+
21+
return $vars;
22+
}
23+
}

src/Composer/Installers/Installer.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Installer extends LibraryInstaller
2020
* @var array<string, string>
2121
*/
2222
private $supportedTypes = array(
23+
'akaunting' => 'AkauntingInstaller',
2324
'asgard' => 'AsgardInstaller',
2425
'attogram' => 'AttogramInstaller',
2526
'agl' => 'AglInstaller',

tests/Composer/Installers/Test/InstallerTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public function supportsProvider(): array
8383
{
8484
return array(
8585
array('agl-module', true),
86+
array('akaunting-module', true),
8687
array('annotatecms-module', true),
8788
array('annotatecms-component', true),
8889
array('annotatecms-service', true),
@@ -270,6 +271,7 @@ public function installPathProvider(): array
270271
{
271272
return array(
272273
array('agl-module', 'More/MyTestPackage/', 'agl/my_test-package'),
274+
array('akaunting-module', 'modules/MyPackage', 'shama/MyPackage'),
273275
array('annotatecms-module', 'addons/modules/my_module/', 'vysinsky/my_module'),
274276
array('annotatecms-component', 'addons/components/my_component/', 'vysinsky/my_component'),
275277
array('annotatecms-service', 'addons/services/my_service/', 'vysinsky/my_service'),

0 commit comments

Comments
 (0)