Commit 10ec72d5 authored by Sean Madsen's avatar Sean Madsen

better handling of repos root directory

parent 038480b2
......@@ -50,12 +50,6 @@ class AppKernel extends Kernel {
. PATH_SEPARATOR . getenv('PATH');
putenv("PATH=" . $_ENV['PATH']);
}
if (!$container->hasParameter('publisher_repos_dir')) {
// This isn't really a good place to put it because it gets deleted
// whenever you clear the cache.
$container->setParameter('publisher_repos_dir', $container->getParameter('kernel.cache_dir') . '/repos'
);
}
return $container;
}
......
......@@ -3,6 +3,7 @@
parameters:
books_dir: %kernel.root_dir%/../books
publish_path_root: %kernel.root_dir%/../web
repos_path_root: %kernel.root_dir%/../var/repos
services:
......@@ -27,7 +28,7 @@ services:
- '@publish.logger'
- '@filesystem'
- '@library'
- %publisher_repos_dir%
- %repos_path_root%
- %publish_path_root%
- '@mkdocs'
......
......@@ -128,8 +128,14 @@ class Publisher {
$this->logger = $logger;
$this->fs = $fs;
$this->library = $library;
$this->repoPathRoot = realpath($reposPathRoot);
$this->publishPathRoot = realpath($publishPathRoot);
if (empty($reposPathRoot)) {
throw new \Exception("Unable to determine root path to all repositories");
}
$this->repoPathRoot = $reposPathRoot;
if (empty($publishPathRoot)) {
throw new \Exception("Unable to determine root path for publishing all books");
}
$this->publishPathRoot = $publishPathRoot;
$this->mkDocs = $mkDocs;
if ($requestStack->getCurrentRequest()) {
$this->publishURLBase
......@@ -152,10 +158,17 @@ class Publisher {
$this->fullIdentifier = "{$this->book->slug}/{$this->language->code}/"
. "{$this->version->branch}";
$this->publishURLFull = "{$this->publishURLBase}/{$this->fullIdentifier}";
$this->publishPath = "{$this->publishPathRoot}/{$this->fullIdentifier}";
$this->repoURL = $this->language->repo;
$this->publishPath = "{$this->publishPathRoot}/{$this->fullIdentifier}";
$this->fs->mkdir($this->publishPath);
$this->publishPath = realpath($this->publishPath);
$this->repoPath = $this->repoPathRoot . "/{$this->book->slug}/"
. "{$this->language->code}";
$this->fs->mkdir($this->repoPath);
$this->repoPath = realpath($this->repoPath);
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment