public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $templateDirectory = $this->getDestination(); $this->verifyPackageDoesntExist($templateDirectory); $templateName = $this->config->getTemplate($input->getArgument('template')); $this->initTemplate($templateDirectory, $templateName); $this->writeInfo('Template boilerplate recreated in ' . $templateDirectory); }
public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $name = $input->getArgument('name'); $packageDirectory = getcwd() . DIRECTORY_SEPARATOR . $name; $this->verifyPackageDoesntExist($packageDirectory); $this->initPackage($packageDirectory, $this->getPackageSource()); $this->writeInfo('Package initialized: ' . $name); }
/** * Execute the command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * * @throws \Exception * @return void */ public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); if (is_dir(config_path())) { throw new Exception("Packager has already been initialized."); } $this->writeComment('Initializing packager config...'); mkdir(config_path()); mkdir(cache_path()); copy(__DIR__ . '/stubs/Packager.json', config_path() . '/Packager.json'); $this->writeInfo('Packager config stub created at: ' . config_path()); $this->call('author'); }
public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $templates = $this->config->getTemplate(); if (empty($templates)) { $output->writeln("No templates has been configured"); return; } $table = $this->getHelper('table'); $table->setHeaders(["Name", "Source"]); foreach ($templates as $name => $source) { $table->addRow([$name, $source]); } $table->render($output); }
public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $name = $this->input->getArgument('name'); $source = $this->input->getArgument('source'); if ($this->config->hasTemplate($name) && !$input->getOption('force')) { throw new Exception('Template already exists!'); } $this->prepareConfig($this->getAbsolutePath($source)); $this->saveConfig(); $this->config->setTemplate($name, $this->getTemplatePath()); if ($input->getOption('default')) { $this->config->setDefaultTemplate($name); } $this->config->save(); $this->writeInfo("Template config generated as '{$name}'"); }
/** * Execute the command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * * @return void */ public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $name = $input->getArgument('name'); $email = $input->getArgument('email'); if (is_null($name)) { $name = $this->askAuthorName(); } if (is_null($email)) { $email = $this->askAuthorEmail(); } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $this->writeError('Author email must be valid email'); $email = $this->askAuthorEmail(); } $this->config->setAuthorName($name)->setAuthorEmail($email)->save(); $this->writeInfo('Default author set to ' . $name . ' with ' . $email . ' email'); }
public function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $name = $input->getArgument('name'); $source = $input->getArgument('source'); if ($this->config->hasTemplate($name) && !$input->getOption('force')) { throw new Exception('Template already exists!'); } $message = "New template '{$name}' with '{$source}' source added"; if ($this->config->hasTemplate($name)) { $message = "Template '{$name}' overwritten with new source '{$source}'"; } $source = $this->verifySource($source); $this->config->setTemplate($name, $source); if ($input->getOption('default')) { $this->config->setDefaultTemplate($name); } $this->config->save(); $this->writeInfo($message); }