mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-07 15:33:56 +09:00
Add vendor and .env to make usable
This commit is contained in:
2
vendor/symfony/thanks/.gitignore
vendored
Normal file
2
vendor/symfony/thanks/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/vendor/
|
||||
composer.lock
|
||||
19
vendor/symfony/thanks/LICENSE
vendored
Normal file
19
vendor/symfony/thanks/LICENSE
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2017-2018 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
53
vendor/symfony/thanks/README.md
vendored
Normal file
53
vendor/symfony/thanks/README.md
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<p align="center"><a href="https://symfony.com" target="_blank">
|
||||
<img src="https://symfony.com/logos/symfony_black_02.svg">
|
||||
</a></p>
|
||||
|
||||
Give thanks (in the form of a [GitHub ★ ](https://help.github.com/articles/about-stars/)) to your fellow PHP package maintainers (not limited to Symfony components)!
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
Install this as any other (dev) Composer package:
|
||||
```sh
|
||||
$ composer require --dev symfony/thanks
|
||||
```
|
||||
|
||||
You can also install it once for all your local projects:
|
||||
```sh
|
||||
$ composer global require symfony/thanks
|
||||
```
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```sh
|
||||
$ composer thanks
|
||||
```
|
||||
|
||||
This will find all of your Composer dependencies, find their github.com repository, and star their GitHub repositories. This was inspired by `cargo thanks`, which was inspired in part by Medium's clapping button as a way to show thanks for someone elses work you've found enjoyment in.
|
||||
|
||||
If you're wondering why did some dependencies get thanked and not others, the answer is that this plugin only supports github.com at the moment. Pull requests are welcome to add support for thanking packages hosted on other services.
|
||||
|
||||
Original idea by Doug Tangren (softprops) 2017 for Rust (thanks!)
|
||||
|
||||
Implemented by Nicolas Grekas (SensioLabs & Blackfire.io) 2017 for PHP.
|
||||
|
||||
Forwarding stars
|
||||
----------------
|
||||
|
||||
Package authors can *send* a star to another package that they would like to thank.
|
||||
|
||||
If you are a package author and want to thank another repository, you can add a `thanks` entry in the `extra` section of your `composer.json` file.
|
||||
|
||||
For example, `symfony/webpack-encore-pack` sends a star to `symfony/webpack-encore`:
|
||||
|
||||
```json
|
||||
{
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"name": "symfony/webpack-encore",
|
||||
"url": "https://github.com/symfony/webpack-encore"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
27
vendor/symfony/thanks/composer.json
vendored
Normal file
27
vendor/symfony/thanks/composer.json
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "symfony/thanks",
|
||||
"description": "Give thanks (in the form of a GitHub ⭐) to your fellow PHP package maintainers (not limited to Symfony components)!",
|
||||
"type": "composer-plugin",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^5.5.9|^7.0.0",
|
||||
"composer-plugin-api": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Thanks\\": "src"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
},
|
||||
"class": "Symfony\\Thanks\\Thanks"
|
||||
}
|
||||
}
|
||||
233
vendor/symfony/thanks/src/Command/ThanksCommand.php
vendored
Normal file
233
vendor/symfony/thanks/src/Command/ThanksCommand.php
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Thanks\Command;
|
||||
|
||||
use Composer\Command\BaseCommand;
|
||||
use Composer\Composer;
|
||||
use Composer\Json\JsonFile;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use Composer\Factory;
|
||||
use Composer\Plugin\PluginEvents;
|
||||
use Composer\Plugin\PreFileDownloadEvent;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ThanksCommand extends BaseCommand
|
||||
{
|
||||
// This is a list of projects that should get a star on their main repository
|
||||
// (when there is one) whenever you use any of their other repositories.
|
||||
// When a project's main repo is also a dependency of their other repos (like amphp/amp),
|
||||
// there is no need to list it here, as starring will transitively happen anyway.
|
||||
private static $mainRepositories = [
|
||||
'api-platform' => [
|
||||
'name' => 'api-platform/api-platform',
|
||||
'url' => 'https://github.com/api-platform/api-platform',
|
||||
],
|
||||
'cakephp' => [
|
||||
'name' => 'cakephp/cakephp',
|
||||
'url' => 'https://github.com/cakephp/cakephp',
|
||||
],
|
||||
'drupal' => [
|
||||
'name' => 'drupal/drupal',
|
||||
'url' => 'https://github.com/drupal/drupal',
|
||||
],
|
||||
'laravel' => [
|
||||
'name' => 'laravel/laravel',
|
||||
'url' => 'https://github.com/laravel/laravel',
|
||||
],
|
||||
'illuminate' => [
|
||||
'name' => 'laravel/laravel',
|
||||
'url' => 'https://github.com/laravel/laravel',
|
||||
],
|
||||
'nette' => [
|
||||
'name' => 'nette/nette',
|
||||
'url' => 'https://github.com/nette/nette',
|
||||
],
|
||||
'phpDocumentor' => [
|
||||
'name' => 'phpDocumentor/phpDocumentor2',
|
||||
'url' => 'https://github.com/phpDocumentor/phpDocumentor2',
|
||||
],
|
||||
'piwik' => [
|
||||
'name' => 'piwik/piwik',
|
||||
'url' => 'https://github.com/piwik/piwik',
|
||||
],
|
||||
'reactphp' => [
|
||||
'name' => 'reactphp/react',
|
||||
'url' => 'https://github.com/reactphp/react',
|
||||
],
|
||||
'sebastianbergmann' => [
|
||||
'name' => 'phpunit/phpunit',
|
||||
'url' => 'https://github.com/sebastianbergmann/phpunit',
|
||||
],
|
||||
'slimphp' => [
|
||||
'name' => 'slimphp/Slim',
|
||||
'url' => 'https://github.com/slimphp/Slim',
|
||||
],
|
||||
'Sylius' => [
|
||||
'name' => 'Sylius/Sylius',
|
||||
'url' => 'https://github.com/Sylius/Sylius',
|
||||
],
|
||||
'symfony' => [
|
||||
'name' => 'symfony/symfony',
|
||||
'url' => 'https://github.com/symfony/symfony',
|
||||
],
|
||||
'yiisoft' => [
|
||||
'name' => 'yiisoft/yii2',
|
||||
'url' => 'https://github.com/yiisoft/yii2',
|
||||
],
|
||||
'zendframework' => [
|
||||
'name' => 'zendframework/zendframework',
|
||||
'url' => 'https://github.com/zendframework/zendframework',
|
||||
],
|
||||
];
|
||||
|
||||
private $star = '★ ';
|
||||
private $love = '💖 ';
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->star = '*';
|
||||
$this->love = '<3';
|
||||
}
|
||||
|
||||
$this->setName('thanks')
|
||||
->setDescription(sprintf('Give thanks (in the form of a GitHub %s) to your fellow PHP package maintainers.', $this->star))
|
||||
->setDefinition([
|
||||
new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Don\'t actually send the stars'),
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$composer = $this->getComposer();
|
||||
$repo = $composer->getRepositoryManager()->getLocalRepository();
|
||||
|
||||
$urls = [
|
||||
'composer/composer' => 'https://github.com/composer/composer',
|
||||
'php/php-src' => 'https://github.com/php/php-src',
|
||||
'symfony/thanks' => 'https://github.com/symfony/thanks',
|
||||
];
|
||||
|
||||
$directPackages = $this->getDirectlyRequiredPackageNames();
|
||||
// symfony/thanks shouldn't trigger thanking symfony/symfony
|
||||
unset($directPackages['symfony/thanks']);
|
||||
foreach ($repo->getPackages() as $package) {
|
||||
$extra = $package->getExtra();
|
||||
|
||||
if (isset($extra['thanks']['name'], $extra['thanks']['url'])) {
|
||||
$urls += [$extra['thanks']['name'] => $extra['thanks']['url']];
|
||||
}
|
||||
|
||||
if (!$url = $package->getSourceUrl()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$urls[$package->getName()] = $url;
|
||||
|
||||
if (!preg_match('#^https://github.com/([^/]++)#', $url, $url)) {
|
||||
continue;
|
||||
}
|
||||
$owner = $url[1];
|
||||
|
||||
// star the main repository, but only if this package is directly
|
||||
// being required by the user's composer.json
|
||||
if (isset(self::$mainRepositories[$owner], $directPackages[$package->getName()])) {
|
||||
$urls[self::$mainRepositories[$owner]['name']] = self::$mainRepositories[$owner]['url'];
|
||||
}
|
||||
}
|
||||
|
||||
ksort($urls);
|
||||
|
||||
$rfs = Factory::createRemoteFilesystem($this->getIo(), $composer->getConfig());
|
||||
|
||||
$i = 0;
|
||||
$template = '_%d: repository(owner:"%s",name:"%s"){id,viewerHasStarred}'."\n";
|
||||
$graphql = '';
|
||||
|
||||
foreach ($urls as $package => $url) {
|
||||
if (preg_match('#^https://github.com/([^/]++)/([^./]++)#', $url, $url)) {
|
||||
$graphql .= sprintf($template, ++$i, $url[1], $url[2]);
|
||||
$aliases['_'.$i] = [$package, $url[0]];
|
||||
}
|
||||
}
|
||||
|
||||
$repos = $this->callGitHub($rfs, sprintf("query{\n%s}", $graphql));
|
||||
|
||||
$template = '%1$s: addStar(input:{clientMutationId:"%s",starrableId:"%s"}){clientMutationId}'."\n";
|
||||
$graphql = '';
|
||||
$notStarred = [];
|
||||
|
||||
foreach ($repos as $alias => $repo) {
|
||||
if (!$repo['viewerHasStarred']) {
|
||||
$graphql .= sprintf($template, $alias, $repo['id']);
|
||||
$notStarred[$alias] = $repo;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$notStarred) {
|
||||
$output->writeln('You already starred all your GitHub dependencies.');
|
||||
} else {
|
||||
if (!$input->getOption('dry-run')) {
|
||||
$notStarred = $this->callGitHub($rfs, sprintf("mutation{\n%s}", $graphql));
|
||||
}
|
||||
|
||||
$output->writeln('Stars <comment>sent</> to:');
|
||||
foreach ($repos as $alias => $repo) {
|
||||
$output->writeln(sprintf(' %s %s - %s', $this->star, sprintf(isset($notStarred[$alias]) ? '<comment>%s</>' : '%s', $aliases[$alias][0]), $aliases[$alias][1]));
|
||||
}
|
||||
}
|
||||
|
||||
$output->writeln(sprintf("\nThanks to you! %s", $this->love));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function callGitHub(RemoteFilesystem $rfs, $graphql)
|
||||
{
|
||||
if ($eventDispatcher = $this->getComposer()->getEventDispatcher()) {
|
||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $rfs, 'https://api.github.com/graphql');
|
||||
$eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
||||
$rfs = $preFileDownloadEvent->getRemoteFilesystem();
|
||||
}
|
||||
|
||||
$result = $rfs->getContents('github.com', 'https://api.github.com/graphql', false, [
|
||||
'http' => [
|
||||
'method' => 'POST',
|
||||
'content' => json_encode(['query' => $graphql]),
|
||||
'header' => ['Content-Type: application/json'],
|
||||
],
|
||||
]);
|
||||
$result = json_decode($result, true);
|
||||
|
||||
return $result['data'];
|
||||
}
|
||||
|
||||
private function getDirectlyRequiredPackageNames()
|
||||
{
|
||||
$file = new JsonFile(Factory::getComposerFile(), null, $this->getIO());
|
||||
|
||||
if (!$file->exists()) {
|
||||
throw new \Exception('Could not find your composer.json file!');
|
||||
}
|
||||
|
||||
$data = $file->read() + ['require' => [], 'require-dev' => []];
|
||||
$data = array_keys($data['require'] + $data['require-dev']);
|
||||
|
||||
return array_combine($data, $data);
|
||||
}
|
||||
}
|
||||
92
vendor/symfony/thanks/src/Thanks.php
vendored
Normal file
92
vendor/symfony/thanks/src/Thanks.php
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Thanks;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\Console\Application;
|
||||
use Composer\EventDispatcher\EventSubscriberInterface;
|
||||
use Composer\Installer\PackageEvents;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\Plugin\PluginInterface;
|
||||
use Composer\Script\Event as ScriptEvent;
|
||||
use Composer\Script\ScriptEvents;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class Thanks implements EventSubscriberInterface, PluginInterface
|
||||
{
|
||||
private $io;
|
||||
private $displayReminder = 0;
|
||||
|
||||
public function activate(Composer $composer, IOInterface $io)
|
||||
{
|
||||
$this->io = $io;
|
||||
|
||||
foreach (debug_backtrace() as $trace) {
|
||||
if (!isset($trace['object']) || !isset($trace['args'][0])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$trace['object'] instanceof Application || !$trace['args'][0] instanceof ArgvInput) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$input = $trace['args'][0];
|
||||
$app = $trace['object'];
|
||||
|
||||
try {
|
||||
$command = $input->getFirstArgument();
|
||||
$command = $command ? $app->find($command)->getName() : null;
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
}
|
||||
|
||||
if ('update' === $command) {
|
||||
$this->displayReminder = 1;
|
||||
}
|
||||
|
||||
$app->add(new Command\ThanksCommand());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function enableReminder()
|
||||
{
|
||||
if (1 === $this->displayReminder) {
|
||||
$this->displayReminder = version_compare('1.1.0', PluginInterface::PLUGIN_API_VERSION, '<=') ? 2 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function displayReminder(ScriptEvent $event)
|
||||
{
|
||||
if (2 !== $this->displayReminder) {
|
||||
return;
|
||||
}
|
||||
|
||||
$love = '\\' === DIRECTORY_SEPARATOR ? 'love' : '💖 ';
|
||||
$star = '\\' === DIRECTORY_SEPARATOR ? 'star' : '★ ';
|
||||
|
||||
$this->io->writeError('');
|
||||
$this->io->writeError('What about running <comment>composer thanks</> now?');
|
||||
$this->io->writeError(sprintf('This will spread some %s by sending a %s to the GitHub repositories of your fellow package maintainers.', $love, $star));
|
||||
$this->io->writeError('');
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
PackageEvents::POST_PACKAGE_UPDATE => 'enableReminder',
|
||||
ScriptEvents::POST_UPDATE_CMD => 'displayReminder',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user