Initial commit of installer

This commit is contained in:
Damian Mooyman 2016-09-12 15:35:13 +12:00
commit e6e6e5ae44
4 changed files with 89 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/vendor/

27
composer.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "tractorcow/recipe-installer",
"description": "Helper plugin to install SilverStripe recipes",
"type": "composer-plugin",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Damian Mooyman",
"email": "damian@silverstripe.com"
}
],
"autoload": {
"psr-4": {
"SilverStripe\\RecipeInstaller\\": "src/"
}
},
"extra": {
"class": "SilverStripe\\RecipeInstaller\\RecipeInstallerPlugin"
},
"require": {
"composer-plugin-api": "^1.1"
},
"require-dev": {
"composer/composer": "^1.2"
},
"minimum-stability": "dev"
}

34
src/RecipeInstaller.php Normal file
View File

@ -0,0 +1,34 @@
<?php
namespace SilverStripe\RecipeInstaller;
use Composer\Installer\BinaryInstaller;
use Composer\Installer\LibraryInstaller;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\Util\Filesystem;
class RecipeInstaller extends LibraryInstaller {
public function __construct(
IOInterface $io,
Composer $composer,
$type = 'silverstripe-recipe',
Filesystem $filesystem = null,
BinaryInstaller $binaryInstaller = null
) {
parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
}
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
{
parent::install($repo, $package);
// Install recipe skeleton
var_dump($package);
var_dump($this->getInstallPath($package));
var_dump($package->getExtra());
var_dump($repo);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace SilverStripe\RecipeInstaller;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
/**
* Register the RecipeInstaller
*/
class RecipeInstallerPlugin implements PluginInterface
{
/**
* Apply plugin modifications to Composer
*
* @param Composer $composer
* @param IOInterface $io
*/
public function activate(Composer $composer, IOInterface $io)
{
$installer = new RecipeInstaller($io, $composer);
$composer->getInstallationManager()->addInstaller($installer);
}
}