Example #1
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $project = new Project(getcwd());
     if ($project->isValid()) {
         $releases = $project->getReleases($input->getOption('locale'));
         if (count($releases)) {
             $table = new Table($output);
             $table->setHeaders(['Version']);
             foreach ($releases as $release) {
                 $table->addRow([$release->getVersionNumber()]);
             }
             $table->render();
             $output->writeln('');
             if (count($releases) === 1) {
                 $output->writeln('1 release found');
             } else {
                 $output->writeln(count($releases) . ' releases found');
             }
         } else {
             $output->writeln('0 releases found');
         }
     } else {
         $output->writeln('<error>This is not a valid Shade project</error>');
     }
 }
Example #2
0
 /**
  * @param Project $project
  * @param string|null $locale
  */
 private function renderEverything(Project &$project, $locale)
 {
     foreach ($project->getBooks($locale) as $book) {
         $book->renderBody();
         foreach ($book->getPages() as $page) {
             $page->renderBody();
         }
     }
     foreach ($project->getWhatsNewArticles($locale) as $article) {
         $article->renderBody();
     }
     foreach ($project->getReleases($locale) as $release) {
         $release->renderBody();
     }
     foreach ($project->getVideos($locale) as $video) {
         $video->renderBody();
     }
 }
Example #3
0
 /**
  * Build release notes
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  * @param Project         $project
  * @param string          $target_path
  * @param Theme           $theme
  * @param string          $locale
  * @return bool
  * @throws Exception
  * @throws \SmartyException
  */
 public function buildReleaseNotes(InputInterface $input, OutputInterface $output, Project $project, $target_path, Theme $theme, $locale)
 {
     $release_notes_path = $locale === $project->getDefaultLocale() ? "{$target_path}/release-notes" : "{$target_path}/{$locale}/release-notes";
     Shade::createDir($release_notes_path, function ($path) use(&$output) {
         $output->writeln("Directory '{$path}' created");
     });
     $releases = $project->getReleases($locale);
     $releases_by_major_version = $this->getReleasesByMajorVersion($releases);
     $this->smarty->assign(['releases_by_major_version' => $releases_by_major_version, 'current_release' => $this->getCurrentReleaseFromSortedReleases($releases_by_major_version), 'page_level' => 1, 'current_section' => 'releases']);
     Shade::writeFile("{$release_notes_path}/index.html", $this->smarty->fetch('release.tpl'), function ($path) use(&$output) {
         $output->writeln("File '{$path}' created");
     });
     foreach ($releases as $release) {
         $this->smarty->assign(['current_release' => $release]);
         Shade::writeFile("{$release_notes_path}/" . $release->getSlug() . ".html", $this->smarty->fetch('release.tpl'), function ($path) use(&$output) {
             $output->writeln("File '{$path}' created");
         });
     }
     return true;
 }