Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/workflow/DivinerWorkflow.php
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | protected function readBookConfiguration($book_path) { | ||||
// If the book specifies a "root", resolve it; otherwise, use the directory | // If the book specifies a "root", resolve it; otherwise, use the directory | ||||
// the book configuration file lives in. | // the book configuration file lives in. | ||||
$full_path = dirname(Filesystem::resolvePath($book_path)); | $full_path = dirname(Filesystem::resolvePath($book_path)); | ||||
if (empty($book['root'])) { | if (empty($book['root'])) { | ||||
$book['root'] = '.'; | $book['root'] = '.'; | ||||
} | } | ||||
$book['root'] = Filesystem::resolvePath($book['root'], $full_path); | $book['root'] = Filesystem::resolvePath($book['root'], $full_path); | ||||
if (!preg_match('/^[a-z][a-z-]*$/', $book['name'])) { | if (!preg_match('/^[a-z][a-z-]*\z/', $book['name'])) { | ||||
$name = $book['name']; | $name = $book['name']; | ||||
throw new PhutilArgumentUsageException( | throw new PhutilArgumentUsageException( | ||||
"Book configuration '{$book_path}' has name '{$name}', but book names ". | "Book configuration '{$book_path}' has name '{$name}', but book names ". | ||||
"must include only lowercase letters and hyphens."); | "must include only lowercase letters and hyphens."); | ||||
} | } | ||||
foreach (idx($book, 'groups', array()) as $group) { | foreach (idx($book, 'groups', array()) as $group) { | ||||
PhutilTypeSpec::checkmap( | PhutilTypeSpec::checkmap( | ||||
Show All 13 Lines |