Subiendo proyecto completo sin restricciones de git ignore

This commit is contained in:
Jose Sanchez
2023-08-17 11:44:02 -04:00
parent a0d4f5ba3b
commit 20f1c60600
19921 changed files with 2509159 additions and 45 deletions

View 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\Command;
use Composer\Command\BaseCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Thanks\GitHubClient;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class FundCommand extends BaseCommand
{
private $star = '★ ';
private $love = '💖 ';
private $cash = '💵 ';
protected function configure()
{
if ('Hyper' === getenv('TERM_PROGRAM')) {
$this->star = '⭐ ';
} elseif ('\\' === \DIRECTORY_SEPARATOR) {
$this->star = '*';
$this->love = '<3';
$this->cash = '$$$';
}
$this->setName('fund')
->setDescription(sprintf('Discover the funding links that fellow PHP package maintainers publish %s.', $this->cash))
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$composer = $this->getComposer();
$gitHub = new GitHubClient($composer, $this->getIO());
$repos = $gitHub->getRepositories($failures, true);
$fundings = [];
$notStarred = 0;
foreach ($repos as $alias => $repo) {
$notStarred += (int) !$repo['viewerHasStarred'];
foreach ($repo['fundingLinks'] as $link) {
list($owner, $package) = explode('/', $repo['package'], 2);
$fundings[$owner][$link['url']][] = $package;
}
}
if ($fundings) {
$prev = null;
$output->writeln('The following packages were found in your dependencies and publish sponsoring links on their GitHub page:');
foreach ($fundings as $owner => $links) {
$output->writeln(sprintf("\n<comment>%s</comment>", $owner));
foreach ($links as $url => $packages) {
$line = sprintf(' <info>%s/%s</>', $owner, implode(', ', $packages));
if ($prev !== $line) {
$output->writeln($line);
$prev = $line;
}
$output->writeln(sprintf(' %s %s', $this->cash, $url));
}
}
$output->writeln("\nPlease consider following these links and sponsoring the work of package authors!");
$output->writeln(sprintf("\nThank you! %s", $this->love));
} else {
$output->writeln("No funding links were found in your package dependencies. This doesn't mean they don't need your support!");
}
if ($notStarred) {
$output->writeln(sprintf("\nRun <comment>composer thanks</> to send a %s to <comment>%d</comment> GitHub repositor%s of your fellow package maintainers.", $this->star, $notStarred, 1 < $notStarred ? 'ies' : 'y'));
}
return 0;
}
}

View File

@@ -0,0 +1,95 @@
<?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 Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Thanks\GitHubClient;
/**
* @author Nicolas Grekas <p@tchwork.com>
*/
class ThanksCommand extends BaseCommand
{
private $star = '★ ';
private $love = '💖 ';
private $cash = '💵 ';
protected function configure()
{
if ('Hyper' === getenv('TERM_PROGRAM')) {
$this->star = '⭐ ';
} elseif ('\\' === \DIRECTORY_SEPARATOR) {
$this->star = '*';
$this->love = '<3';
$this->cash = '$$$';
}
$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();
$gitHub = new GitHubClient($composer, $this->getIO());
$repos = $gitHub->getRepositories($failures);
$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 = $gitHub->call(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', $repo['package']), $repo['url']));
}
}
if ($failures) {
$output->writeln('');
$output->writeln('Some repositories could not be starred, please run <info>composer update</info> and try again:');
foreach ($failures as $alias => $failure) {
foreach ((array) $failure['messages'] as $message) {
$output->writeln(sprintf(' * %s - %s', $failure['url'], $message));
}
}
}
$output->writeln("\nPlease consider contributing back in any way if you can!");
$output->writeln(sprintf("\nRun <comment>composer fund</> to discover how you can sponsor your fellow PHP package maintainers %s", $this->cash));
$output->writeln(sprintf("\nThank you! %s", $this->love));
return 0;
}
}