mirror of
https://github.com/silverstripe/recipe-plugin.git
synced 2024-10-22 14:05:55 +02:00
Initial commit of installer
This commit is contained in:
commit
e6e6e5ae44
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/vendor/
|
27
composer.json
Normal file
27
composer.json
Normal 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
34
src/RecipeInstaller.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
27
src/RecipeInstallerPlugin.php
Normal file
27
src/RecipeInstallerPlugin.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user