Page MenuHomePhabricator

D8415.diff
No OneTemporary

D8415.diff

Index: src/applications/diviner/workflow/DivinerAtomizeWorkflow.php
===================================================================
--- src/applications/diviner/workflow/DivinerAtomizeWorkflow.php
+++ src/applications/diviner/workflow/DivinerAtomizeWorkflow.php
@@ -30,7 +30,7 @@
}
public function execute(PhutilArgumentParser $args) {
- $this->readBookConfiguration($args);
+ $this->readBookConfiguration($args->getArg('book'));
$console = PhutilConsole::getConsole();
Index: src/applications/diviner/workflow/DivinerGenerateWorkflow.php
===================================================================
--- src/applications/diviner/workflow/DivinerGenerateWorkflow.php
+++ src/applications/diviner/workflow/DivinerGenerateWorkflow.php
@@ -38,7 +38,41 @@
}
public function execute(PhutilArgumentParser $args) {
- $this->readBookConfiguration($args);
+ $book = $args->getArg('book');
+ if ($book) {
+ $books = array($book);
+ } else {
+ $cwd = getcwd();
+ $this->log(pht('FINDING DOCUMENTATION BOOKS'));
+ $books = id(new FileFinder($cwd))
+ ->withType('f')
+ ->withSuffix('book')
+ ->find();
+
+ if (!$books) {
+ throw new PhutilArgumentUsageException(
+ pht(
+ "There are no Diviner '.book' files anywhere beneath the ".
+ "current directory. Use '--book <book>' to specify a ".
+ "documentation book to generate."));
+ } else {
+ $this->log(pht('Found %s book(s).', new PhutilNumber(count($books))));
+ }
+ }
+
+ foreach ($books as $book) {
+ $short_name = basename($book);
+
+ $this->log(pht('Generating book "%s"...', $short_name));
+ $this->generateBook($book, $args);
+ $this->log(pht('Completed generation of "%s".', $short_name)."\n");
+ }
+ }
+
+ private function generateBook($book, PhutilArgumentParser $args) {
+ $this->atomCache = null;
+
+ $this->readBookConfiguration($book);
if ($args->getArg('clean')) {
$this->log(pht('CLEARING CACHES'));
Index: src/applications/diviner/workflow/DivinerWorkflow.php
===================================================================
--- src/applications/diviner/workflow/DivinerWorkflow.php
+++ src/applications/diviner/workflow/DivinerWorkflow.php
@@ -17,8 +17,7 @@
return $this->config;
}
- protected function readBookConfiguration(PhutilArgumentParser $args) {
- $book_path = $args->getArg('book');
+ protected function readBookConfiguration($book_path) {
if ($book_path === null) {
throw new PhutilArgumentUsageException(
"Specify a Diviner book configuration file with --book.");

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 6:55 PM (11 h, 27 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6927454
Default Alt Text
D8415.diff (2 KB)

Event Timeline