Author: Victor Puertas (vpuertas@gmail.com)
Inheritance: extends Generator
Esempio n. 1
0
 /**
  * {@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);
 }
Esempio n. 2
0
 /**
  * @expectedException \RuntimeException
  */
 public function testNameEmpty()
 {
     $generator = new PluginGenerator($this->tmpDir, '');
     $generator->setSkeletonDirs($this->skeletonDir);
     $files = $generator->generate($this->tmpDir, '');
 }