-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from phar-io/addWizzard
Use a wizard after "create-project" to gather the basic informations
- Loading branch information
Showing
14 changed files
with
575 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
/vendor/ | ||
composer.lock | ||
.phpunit.cache | ||
tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phive xmlns="https://phar.io/phive"> | ||
<phar name="phpunit" version="^9.5.0" installed="9.5.0" location="./tools/phpunit" copy="false"/> | ||
</phive> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
cacheResultFile=".phpunit.cache/test-results" | ||
executionOrder="depends,defects" | ||
forceCoversAnnotation="true" | ||
beStrictAboutCoversAnnotation="true" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutTodoAnnotatedTests="true" | ||
failOnRisky="true" | ||
failOnWarning="true" | ||
verbose="true"> | ||
<testsuites> | ||
<testsuite name="default"> | ||
<directory suffix="Test.php">tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<coverage cacheDirectory=".phpunit.cache/code-coverage" | ||
processUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
</coverage> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PharIo\Mediator; | ||
|
||
use Composer\Composer; | ||
use Composer\IO\IOInterface; | ||
use Composer\Script\Event; | ||
use PharIo\Mediator\Service\ConfigurationReader; | ||
use PharIo\Mediator\Service\CreateComposerJson; | ||
use PharIo\Mediator\Service\CreateConfigurationFile; | ||
use PharIo\Mediator\Service\CreatePluginClass; | ||
use PharIo\Mediator\Service\DeleteFiles; | ||
use PharIo\Mediator\Service\NamespaceReader; | ||
use SplFileInfo; | ||
use function realpath; | ||
|
||
final class Installer | ||
{ | ||
private $io; | ||
|
||
private $composer; | ||
|
||
private function __construct(IOInterface $io, Composer $composer) | ||
{ | ||
$this->io = $io; | ||
$this->composer = $composer; | ||
} | ||
|
||
public static function install(Event $event): void | ||
{ | ||
$installer = new self($event->getIO(), $event->getComposer()); | ||
|
||
$installer->runInstallation(); | ||
} | ||
|
||
public function runInstallation(): void | ||
{ | ||
$configReader = new ConfigurationReader($this->io); | ||
$namespaceReader = new NamespaceReader($this->io); | ||
$config = $configReader->getConfiguration(); | ||
$namespace = $namespaceReader->getNamespace(); | ||
|
||
$rootDir = realpath(__DIR__ . '/..'); | ||
|
||
$composerJson = new CreateComposerJson(new SplFileInfo($rootDir)); | ||
$composerJson($config, $namespace); | ||
|
||
$mediatorXml = new CreateConfigurationFile(new SplFileInfo($rootDir)); | ||
$mediatorXml($config); | ||
|
||
$pluginPhp = new CreatePluginClass(new SplFileInfo($rootDir)); | ||
|
||
$deletor = new DeleteFiles( | ||
new SplFileInfo($rootDir . '/keys/junitdiff.key'), | ||
new SplFileInfo($rootDir . '/src'), | ||
new SplFileInfo($rootDir . '/tests'), | ||
new SplFileInfo($rootDir . '/.git'), | ||
new SplFileInfo($rootDir . '/.gitignore'), | ||
new SplFileInfo($rootDir . '/composer.lock'), | ||
new SplFileInfo($rootDir . '/LICENSE'), | ||
new SplFileInfo($rootDir . '/phive.xml'), | ||
new SplFileInfo($rootDir . '/phpunit.xml'), | ||
new SplFileInfo($rootDir . '/README.md') | ||
); | ||
$deletor(); | ||
|
||
$pluginPhp($namespace); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,15 @@ | ||
<?php | ||
/** | ||
* Copyright The ComposerDistributor-Team | ||
* | ||
* Licenses under the MIT-license. For details see the included file LICENSE.md | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PharIo\Mediator; | ||
|
||
use Composer\Installer\PackageEvent; | ||
use PharIo\ComposerDistributor\File; | ||
use PharIo\ComposerDistributor\FileList; | ||
use PharIo\ComposerDistributor\PluginBase; | ||
use PharIo\ComposerDistributor\Url; | ||
use PharIo\ComposerDistributor\ConfiguredMediator; | ||
|
||
class Plugin extends PluginBase | ||
final class Plugin extends ConfiguredMediator | ||
{ | ||
public function installOrUpdateFunction(PackageEvent $event): void | ||
{ | ||
$installer = $this->createInstaller( | ||
// Replace this with the name of your plugin | ||
'org_heigl/single-phar-plugin', | ||
// replace this with the path to your key directory | ||
__DIR__ . '/../keys/', | ||
// needs to be passed on! | ||
$event | ||
); | ||
|
||
$installer->install(new FileList( | ||
new File( | ||
// Replace this with the name of the binary that you want to use within the folder vendor/bin/ | ||
'junitdiff', | ||
Url::fromString( | ||
// replace this with the path to the phar file. Replacements are described in the | ||
// [README.md](https://) | ||
'https://github.com/heiglandreas/JUnitDiff/releases/download/%version%/junitdiff.phar' | ||
), | ||
Url::fromString( | ||
// replace this with the path to the signature-file for the phar. Replacements are described in the | ||
// [README.md](https://) | ||
'https://github.com/heiglandreas/JUnitDiff/releases/download/%version%/junitdiff.phar.asc' | ||
) | ||
) | ||
)); | ||
} | ||
public function getDistributorConfig(): string | ||
{ | ||
return __DIR__ . '/../mediator.xml'; | ||
} | ||
} |
Oops, something went wrong.