parent
a5d0d73e00
commit
58905ffe4e
|
@ -21,6 +21,7 @@ use Composer\Pcre\Preg;
|
||||||
use Composer\Repository\CompositeRepository;
|
use Composer\Repository\CompositeRepository;
|
||||||
use Composer\Repository\PlatformRepository;
|
use Composer\Repository\PlatformRepository;
|
||||||
use Composer\Repository\RepositoryFactory;
|
use Composer\Repository\RepositoryFactory;
|
||||||
|
use Composer\Spdx\SpdxLicenses;
|
||||||
use Composer\Util\Filesystem;
|
use Composer\Util\Filesystem;
|
||||||
use Composer\Util\Silencer;
|
use Composer\Util\Silencer;
|
||||||
use Symfony\Component\Console\Input\ArrayInput;
|
use Symfony\Component\Console\Input\ArrayInput;
|
||||||
|
@ -398,6 +399,10 @@ EOT
|
||||||
'License [<comment>'.$license.'</comment>]: ',
|
'License [<comment>'.$license.'</comment>]: ',
|
||||||
$license
|
$license
|
||||||
);
|
);
|
||||||
|
$spdx = new SpdxLicenses();
|
||||||
|
if (!$spdx->validate($license)) {
|
||||||
|
throw new \InvalidArgumentException('Invalid license provided: '.$license.'. Only SPDX license identifiers (https://spdx.org/licenses/) or "proprietary" are accepted.');
|
||||||
|
}
|
||||||
$input->setOption('license', $license);
|
$input->setOption('license', $license);
|
||||||
|
|
||||||
$io->writeError(['', 'Define your dependencies.', '']);
|
$io->writeError(['', 'Define your dependencies.', '']);
|
||||||
|
|
|
@ -711,7 +711,7 @@ class InitCommandTest extends TestCase
|
||||||
'Mr. Test <test@example.org>', // Author
|
'Mr. Test <test@example.org>', // Author
|
||||||
'stable', // Minimum stability
|
'stable', // Minimum stability
|
||||||
'library', // Type
|
'library', // Type
|
||||||
'Custom License', // License
|
'AGPL-3.0-only', // License
|
||||||
'no', // Define dependencies
|
'no', // Define dependencies
|
||||||
'no', // Define dev dependencies
|
'no', // Define dev dependencies
|
||||||
'n', // Add PSR-4 autoload mapping
|
'n', // Add PSR-4 autoload mapping
|
||||||
|
@ -726,7 +726,7 @@ class InitCommandTest extends TestCase
|
||||||
'name' => 'vendor/pkg',
|
'name' => 'vendor/pkg',
|
||||||
'description' => 'my desciption',
|
'description' => 'my desciption',
|
||||||
'type' => 'library',
|
'type' => 'library',
|
||||||
'license' => 'Custom License',
|
'license' => 'AGPL-3.0-only',
|
||||||
'authors' => [['name' => 'Mr. Test', 'email' => 'test@example.org']],
|
'authors' => [['name' => 'Mr. Test', 'email' => 'test@example.org']],
|
||||||
'minimum-stability' => 'stable',
|
'minimum-stability' => 'stable',
|
||||||
'require' => [],
|
'require' => [],
|
||||||
|
|
Loading…
Reference in New Issue