$value) { if ($value === false) { continue; } switch ($opt) { case 'h': case 'hostname': $hostname = $value; break; case 'help': usage(); break; case 'o': case 'output': $output = $value; break; } } if (!$hostname || !$output) { usage(); } if (!is_dir($output)) { echo "Unable to locate specified output directory $output.\n\n"; exit(1); } if (!is_writable($output)) { echo "Output directory $output is not writable.\n\n"; exit(1); } $geminiOutput = "$output/gemini"; if (file_exists($geminiOutput)) { echo "Gemini build directory $geminiOutput already exists.\n\n"; exit(1); } $wwwOutput = "$output/www"; if (file_exists($wwwOutput)) { echo "WWW build directory $wwwOutput already exists.\n\n"; exit(1); } $src = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'; if (!is_dir($src)) { echo "Unable to locate src directory $src.\n\n"; exit(1); } if (!is_readable($src)) { echo "Src directory $src is not readable.\n\n"; exit(1); } $htmlTemplateDiretory = __DIR__.DIRECTORY_SEPARATOR.'../html_templates'; if (!is_dir($htmlTemplateDiretory)) { echo "Unable to locate html template directory $htmlTemplateDiretory.\n\n"; exit(1); } if (!is_readable($htmlTemplateDiretory)) { echo "Src directory $htmlTemplateDiretory is not readable.\n\n"; exit(1); } $assetsDiretory = __DIR__.DIRECTORY_SEPARATOR.'../www_assets'; if (!is_dir($assetsDiretory)) { echo "Unable to locate assets directory $assetsDiretory.\n\n"; exit(1); } if (!is_readable($assetsDiretory)) { echo "Src directory $assetsDiretorY is not readable.\n\n"; exit(1); } $siteMetaData = getSiteMetaData($src); buildGeminiSite($siteMetaData, $geminiOutput); buildWWWSite($siteMetaData, $wwwOutput, $htmlTemplateDiretory, $assetsDiretory);