setLicense() public method

Sets the license of the plugin. MIT by default.
public setLicense ( $name )
コード例 #1
0
ファイル: NewPluginCommand.php プロジェクト: spress/spress
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new ConsoleIO($input, $output);
     $name = Validators::validatePluginName($input->getOption('name'));
     $commandName = $input->getOption('command-name');
     if (empty($commandName) === false) {
         $commandName = Validators::validateCommandName($commandName);
     }
     $commandDescription = $input->getOption('command-description');
     $commandHelp = $input->getOption('command-help');
     $author = $input->getOption('author');
     $email = $input->getOption('email');
     if (empty($email) === false) {
         $email = Validators::validateEmail($email);
     }
     $description = $input->getOption('description');
     $license = $input->getOption('license') ?: 'MIT';
     $generator = new PluginGenerator('./src/plugins', $name);
     $generator->setSkeletonDirs([__DIR__ . '/../../app/skeletons']);
     $generator->setCommandData($commandName, $commandDescription, $commandHelp);
     $generator->setAuthor($author, $email);
     $generator->setDescription($description);
     $generator->setLicense($license);
     $files = $generator->generate();
     $this->resultMessage($io, $files);
 }
コード例 #2
0
 public function testLicenseNotExists()
 {
     $generator = new PluginGenerator($this->tmpDir, 'yo-symfony/my-plugin');
     $generator->setSkeletonDirs($this->skeletonDir);
     $generator->setLicense('My-license');
     $files = $generator->generate();
     $this->assertCount(2, $files);
     $this->assertFileExists($files[0]);
     $this->assertFileExists($files[1]);
     $this->assertRegExp('/YoSymfonyMyPlugin.php/', $files[0]);
     $this->assertRegExp('/composer.json/', $files[1]);
 }