Пример #1
0
 /**
  * Execute command.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $projectName = $input->getArgument('name');
     $testFramework = $input->getOption('test');
     $license = $input->getOption('license');
     $namespace = $input->getOption('namespace');
     $git = $input->getOption('git');
     $phpcs = $input->getOption('phpcs');
     $keywords = $input->getOption('keywords');
     $vagrant = $input->getOption('vagrant');
     $editorConfig = $input->getOption('editor-config');
     $phpVersion = $input->getOption('php');
     $environment = $input->getOption('env');
     if (!$this->str->isValid($projectName)) {
         $output->writeln('<error>Warning: "' . $projectName . '" is not a valid project name, please use "vendor/project"</error>');
         return false;
     }
     $this->containsPhpWarning($projectName, $output);
     $license = $this->supportedLicenseWarning($license, $output);
     $testFramework = $this->testFrameworkWarning($testFramework, $output);
     $phpVersion = $this->phpVersionWarning($phpVersion, $output);
     $this->settings = new Settings($projectName, $testFramework, $license, $namespace, $git, $phpcs, $keywords, $vagrant, $editorConfig, $phpVersion, $environment);
     $this->construct->generate($this->settings, new Git(), new Script());
     $this->initializedGitMessage($output);
     $this->bootstrappedCodeceptionMessage($testFramework, $output);
     $this->initializedBehatMessage($testFramework, $output);
     $output->writeln('<info>Project "' . $projectName . '" constructed.</info>');
 }
Пример #2
0
 /**
  * Execute command.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $projectName = $input->getArgument('name');
     $testFramework = $input->getOption('test');
     $license = $input->getOption('license');
     $namespace = $input->getOption('namespace');
     $git = $input->getOption('git');
     $phpcs = $input->getOption('phpcs');
     $keywords = $input->getOption('keywords');
     $vagrant = $input->getOption('vagrant');
     $editorConfig = $input->getOption('editor-config');
     if (!$this->str->isValid($projectName)) {
         $output->writeln('<error>Warning: "' . $projectName . '" is not a valid project name, please use "vendor/project"</error>');
         return false;
     }
     if ($this->str->contains($projectName, 'php')) {
         $containsPhpWarning = 'Warning: If you are about to create a micro-package "' . $projectName . '" should optimally not contain a "php" notation in the project name.';
         $output->writeln('<error>' . $containsPhpWarning . '</error>');
     }
     if (!in_array($license, $this->licenses)) {
         $output->writeln('<error>Warning: "' . $license . '" is not a supported license. Using MIT.</error>');
         $license = 'MIT';
     }
     if (!in_array($testFramework, $this->testingFrameworks)) {
         $output->writeln('<error>Warning: "' . $testFramework . '" is not a supported testing framework. Using phpunit.</error>');
         $testFramework = 'phpunit';
     }
     $settings = new Settings($projectName, $testFramework, $license, $namespace, $git, $phpcs, $keywords, $vagrant, $editorConfig);
     $gitHelper = new Git();
     $composerHelper = new Composer();
     $this->construct->generate($settings, $gitHelper, $composerHelper);
     $output->writeln('<info>Project "' . $projectName . '" constructed.</info>');
 }
Пример #3
0
 /**
  * Execute command.
  *
  * @param \Symfony\Component\Console\Input\InputInterface   $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $projectName = $input->getArgument('name');
     $testFramework = $input->getOption('test');
     $testingFramework = $input->getOption('test-framework');
     if ($testingFramework !== Defaults::TEST_FRAMEWORK) {
         $testFramework = $testingFramework;
     }
     $license = $input->getOption('license');
     $namespace = $input->getOption('namespace');
     $git = $input->getOption('git');
     $phpcs = $input->getOption('phpcs');
     $keywords = $input->getOption('keywords');
     $vagrant = $input->getOption('vagrant');
     $editorConfig = $input->getOption('editor-config');
     $phpVersion = $input->getOption('php');
     $environment = $input->getOption('env');
     $lgtm = $input->getOption('lgtm');
     $githubTemplates = $input->getOption('github-templates');
     $githubDocs = $input->getOption('github-docs');
     $github = $input->getOption('github');
     $codeOfConduct = $input->getOption('code-of-conduct');
     $ignoreDefaultConfiguration = $input->getOption('ignore-default-config');
     $configuration = $input->getOption('config');
     if ($this->isConfigurationApplicable($configuration) && $ignoreDefaultConfiguration === false) {
         $this->settings = Configuration::getSettings($configuration, $projectName, $keywords, $this->filesystem);
     } else {
         if ($github) {
             $githubTemplates = $githubDocs = true;
         }
         $this->settings = new Settings($projectName, $testFramework, $license, $namespace, $git, $phpcs, $keywords, $vagrant, $editorConfig, $phpVersion, $environment, $lgtm, $githubTemplates, $codeOfConduct, $githubDocs);
     }
     if (!$this->str->isValid($projectName)) {
         $warningMessage = '<error>Warning: "' . $projectName . '" is not ' . 'a valid project name, please use "vendor/project"</error>';
         $output->writeln($warningMessage);
         return false;
     }
     $this->warnAndOverwriteInvalidSettingsWithDefaults($output);
     $this->construct->generate($this->settings, new Git(), new Script());
     $this->initializedGitMessage($output);
     $this->bootstrappedCodeceptionMessage($testFramework, $output);
     $this->initializedBehatMessage($testFramework, $output);
     $output->writeln('<info>Project "' . $projectName . '" constructed.</info>');
 }