Skip to content
This repository was archived by the owner on Feb 28, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
14ed6ca
update composer reqs
marcogiovinazzi Feb 25, 2018
35fdb5b
update composer reqs
marcogiovinazzi Feb 25, 2018
8023412
Merge branch '1.0' of github.com:comodojo/comodojo-installer into 1.0
marcogiovinazzi Mar 20, 2018
07e4ec8
update composer reqs
marcogiovinazzi Feb 25, 2018
0052cec
Merge branch '1.0' of github.com:comodojo/comodojo-installer into 1.0
marcogiovinazzi Nov 19, 2018
0f586ce
Merge branch 'master' into 1.0
marcogiovinazzi Dec 2, 2018
ea3d5c4
Update composer.json
marcogiovinazzi Dec 3, 2018
199a91f
Update composer.json
pmacelli Oct 7, 2021
8c95af0
Update composer.json
pmacelli Oct 7, 2021
65170e5
Update Plugin.php
pmacelli Oct 7, 2021
99229d3
Update Plugin.php
pmacelli Oct 7, 2021
d8393e5
Update composer.json
pmacelli Oct 7, 2021
932de81
Update composer.json
pmacelli Oct 7, 2021
c2b39e6
Update composer.json
pmacelli Oct 7, 2021
7202536
Update composer.json
pmacelli Oct 8, 2021
82e2d15
Update Installer.php
pmacelli Oct 8, 2021
b8dcd8f
Update Installer.php
pmacelli Oct 8, 2021
531416c
Update Installer.php
pmacelli Oct 8, 2021
b1af35c
Update Installer.php
pmacelli Oct 8, 2021
b2f47ec
Update Installer.php
pmacelli Oct 8, 2021
84ff199
Update Installer.php
pmacelli Oct 8, 2021
8456c93
Update Installer.php
pmacelli Oct 8, 2021
c762158
Update Installer.php
pmacelli Oct 8, 2021
87e8ab4
Update Installer.php
pmacelli Oct 8, 2021
df1d131
Update Installer.php
pmacelli Oct 8, 2021
1f98334
Update Installer.php
pmacelli Oct 8, 2021
ba25e5b
Update Installer.php
pmacelli Oct 8, 2021
2e1840a
Update Installer.php
pmacelli Oct 8, 2021
9f52e06
Update Installer.php
pmacelli Oct 8, 2021
73763fa
Update Installer.php
pmacelli Oct 8, 2021
bdd2d88
Update Installer.php
pmacelli Oct 8, 2021
6c1457e
Update Installer.php
pmacelli Oct 8, 2021
c5d8c70
Update Installer.php
pmacelli Oct 8, 2021
e1335dd
Update Installer.php
pmacelli Oct 8, 2021
84c1f46
Update Installer.php
pmacelli Oct 8, 2021
ab37045
Update Installer.php
pmacelli Oct 8, 2021
9e0c122
Update Installer.php
pmacelli Oct 8, 2021
b0ec8cc
Update Installer.php
pmacelli Oct 8, 2021
bd272f3
Update Installer.php
pmacelli Oct 11, 2021
7889099
Update composer.json
pmacelli Oct 11, 2021
1b588aa
Update composer.json
pmacelli Oct 11, 2021
4dd28f4
Update Plugin.php
pmacelli Oct 11, 2021
10e661f
Update Plugin.php
pmacelli Oct 11, 2021
ea7c2dd
Update Plugin.php
pmacelli Oct 11, 2021
d4323ff
Update Plugin.php
pmacelli Oct 11, 2021
8efd3a6
Update Plugin.php
pmacelli Oct 11, 2021
54e8e2f
Update Plugin.php
pmacelli Oct 11, 2021
cc98eb2
Update Plugin.php
pmacelli Oct 11, 2021
d644772
Update Plugin.php
pmacelli Oct 11, 2021
6aca182
Update Plugin.php
pmacelli Oct 11, 2021
b14920f
Update Plugin.php
pmacelli Oct 11, 2021
8d45f49
Update Installer.php
pmacelli Oct 11, 2021
30d0a75
Update Installer.php
pmacelli Oct 11, 2021
2bc156e
Update composer.json
pmacelli Oct 11, 2021
9924268
Update Plugin.php
pmacelli Oct 11, 2021
e4a9a0e
Update Installer.php
pmacelli Oct 11, 2021
6be7135
Update composer.json
pmacelli Oct 11, 2021
bafe724
Update composer.json
pmacelli Oct 25, 2021
de78cfc
Update composer.json
pmacelli Oct 25, 2021
8f6e8d9
Update composer.json
pmacelli Oct 27, 2021
89a0bbe
Update composer.json
pmacelli Oct 27, 2021
37ff809
Update README.md
pmacelli Nov 3, 2021
93c3d1e
Update README.md
pmacelli Nov 11, 2021
dc2a35b
Update composer.json
pmacelli Nov 11, 2021
fd1b326
Update composer.json
pmacelli Nov 11, 2021
b33e430
Update composer.json
pmacelli Nov 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "comodojo/comodojo-installer",
"name": "pmarcelli/comodojo-installer",
"type": "composer-plugin",
"license": "MIT",
"description": "Modular installer for the Comodojo Project",
Expand Down Expand Up @@ -27,13 +27,13 @@
"class": "Comodojo\\Installer\\Plugin"
},
"require": {
"php": ">=5.6.0",
"composer-plugin-api": "^1.0",
"comodojo/foundation": "dev-master",
"symfony/yaml": "^3.0"
"php": "^7.3",
"composer-plugin-api": "^2.0",
"pmarcelli/foundation": "dev-foundation_u7320",
"symfony/yaml": "^5.3"
},
"require-dev": {
"composer/composer": "^1.0",
"composer/composer": "^2.0",
"phpunit/phpunit": "^4.0|^5.0",
"scrutinizer/ocular": "^1.0"
}
Expand Down
64 changes: 55 additions & 9 deletions src/Comodojo/Installer/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use \Comodojo\Exception\InstallerException;
use \Comodojo\Installer\Components\InstallerDriverManager;
use \Comodojo\Foundation\Utils\ArrayOps;
use React\Promise\PromiseInterface;

/**
* @package Comodojo Framework
Expand All @@ -34,14 +35,14 @@ class Installer extends LibraryInstaller {
protected $supported_packages;

protected $drivers = [];

public function __construct(
IOInterface $io,
Composer $composer,
Configuration $configuration,
InstallerConfiguration $installer_configuration
) {

$this->supported_packages = $installer_configuration->getPackageTypes();

$extra = $installer_configuration->getPackageExtra();
Expand All @@ -63,15 +64,30 @@ public function supports($packageType) {
return in_array($packageType, $this->supported_packages);

}

/**
* {@inheritDoc}
*/
public function install(InstalledRepositoryInterface $repo, PackageInterface $package) {

$installPackage = function() use ($package) {

$this->packageInstall($package);

};

// Composer v2 return a promise
$promise = parent::install($repo, $package);

parent::install($repo, $package);
if ($promise instanceof PromiseInterface) {

return $promise->then($installPackage);

$this->packageInstall($package);
}

$installPackage();

return null;

}

Expand All @@ -80,21 +96,51 @@ public function install(InstalledRepositoryInterface $repo, PackageInterface $pa
*/
public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target) {

parent::update($repo, $initial, $target);
$updatePackage = function() use ($initial, $target) {

$this->packageUpdate($initial, $target);

};

// Composer v2 return a promise
$promise = parent::update($repo, $initial, $target);

$this->packageUpdate($initial, $target);
if ($promise instanceof PromiseInterface) {

return $promise->then($updatePackage);

}

$updatePackage();

return null;

}

/**
* {@inheritDoc}
*/
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package) {

$this->packageUninstall($package);
$uninstallPackage = function() use ($package) {

$this->packageUninstall($package);

};

// Composer v2 return a promise
$promise = parent::uninstall($repo, $package);

if ($promise instanceof PromiseInterface) {

return $promise->then($uninstallPackage);

}

parent::uninstall($repo, $package);
$uninstallPackage();

return null;

}

private function packageInstall($package) {
Expand Down
21 changes: 18 additions & 3 deletions src/Comodojo/Installer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,21 @@ class Plugin implements PluginInterface, EventSubscriberInterface {
protected $comodojo_configuration;

protected $comodojo_configuration_persistence;


/**
* {@inheritDoc}
*/
public function deactivate(Composer $composer, IOInterface $io){

}

/**
* {@inheritDoc}
*/
public function uninstall(Composer $composer, IOInterface $io){

}

public function activate(Composer $composer, IOInterface $io) {

// First, get current extra field and init a valid installer configuration
Expand All @@ -56,10 +70,11 @@ public function activate(Composer $composer, IOInterface $io) {

public static function getSubscribedEvents() {

return ['post-create-project-cmd' => 'startPostInstallScript'];

return ['post-create-project-cmd' => 'startPostInstallScript'];
}


public function startPostInstallScript(Event $event) {

$script = $this->installer_configuration->getPostInstallScript();
Expand Down