Skip to content

Commit

Permalink
#47: rolling forward changes from #50
Browse files Browse the repository at this point in the history
  • Loading branch information
yiendos committed Dec 16, 2020
1 parent a706fef commit 9152b1f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"class": "Joomlatools\\Composer\\Plugin"
},
"require": {
"composer-plugin-api": "^1.0"
"composer-plugin-api": "^2.0"
}
}
4 changes: 4 additions & 0 deletions src/Joomlatools/Composer/ExtensionInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public function __construct(IOInterface $io)

public function execute()
{
if (!Util::isJoomla() && !Util::isJoomlatoolsPlatform()) {
return true;
}

$application = Bootstrapper::getInstance()->getApplication();

if ($application === false)
Expand Down
20 changes: 15 additions & 5 deletions src/Joomlatools/Composer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ class Plugin implements PluginInterface, EventSubscriberInterface
*/
public function activate(Composer $composer, IOInterface $io)
{
if (!Util::isJoomla() && !Util::isJoomlatoolsPlatform()) {
throw new \RuntimeException('Working directory is not a valid Joomla installation');
}

$this->_composer = $composer;
$this->_io = $io;

if (!Util::isJoomla() && !Util::isJoomlatoolsPlatform()) {
return true;
}

$credentials = $this->_composer->getConfig()->get('joomla');

if(is_null($credentials) || !is_array($credentials)) {
Expand All @@ -64,7 +64,7 @@ public function activate(Composer $composer, IOInterface $io)
public static function getSubscribedEvents()
{
return array(
ScriptEvents::POST_AUTOLOAD_DUMP => 'postAutoloadDump'
'post-autoload-dump' => 'postAutoloadDump'
);
}

Expand All @@ -73,4 +73,14 @@ public function postAutoloadDump(Event $event)
$extensionInstaller = new ExtensionInstaller($this->_io);
$extensionInstaller->execute();
}

public function uninstall(Composer $composer, IOInterface $io)
{
// TODO: Implement uninstall() method.
}

public function deactivate(Composer $composer, IOInterface $io)
{
// TODO: Implement deactivate() method.
}
}

0 comments on commit 9152b1f

Please sign in to comment.