Skip to content

Commit

Permalink
Minor refactoring, some docu, adjusted composer
Browse files Browse the repository at this point in the history
  • Loading branch information
mwitte committed Apr 19, 2017
1 parent 362fa98 commit dd62a9b
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 18 deletions.
10 changes: 5 additions & 5 deletions Classes/TechDivision/DocViewer/Controller/ModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
/*
* This file is part of the TechDivision.DocViewer package.
*/
use TechDivision\DocViewer\Exceptions\PackageNotAccessableException;
use TechDivision\DocViewer\Exceptions\PackageNotAccessibleException;
use TechDivision\DocViewer\Exceptions\ParsingNotAllowedException;
use TechDivision\DocViewer\File\Parser;
use TechDivision\DocViewer\File\Tree;

use TechDivision\DocViewer\Util;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Neos\Controller\Module\AbstractModuleController;

Expand Down Expand Up @@ -92,21 +90,22 @@ public function listAction() {

}

$this->view->assign('projectVersion', $this->packageManager->getPackage('TechDivision.DocViewer')->getInstalledVersion());
$this->view->assign('packageGroups', $packageGroups);
}

/**
* Shows documentation of given package
* @param string $package
* @param string $filePath
* @throws PackageNotAccessableException
* @throws PackageNotAccessibleException
* @return void
*/
public function showAction($package, $filePath = null) {
$baseUri = $this->controllerContext->getRequest()->getHttpRequest()->getBaseUri();

if (!$this->accessManager->isPackageAccessable($package)) {
throw new PackageNotAccessableException("You are not allowed to access the package " . $package);
throw new PackageNotAccessibleException("You are not allowed to access the package " . $package);
}
$package = $this->packageManager->getPackage($package);
$this->view->assign('packageKey', $package->getPackageKey());
Expand Down Expand Up @@ -134,5 +133,6 @@ public function showAction($package, $filePath = null) {
$this->addFlashMessage($e->getMessage());
}
}
$this->view->assign('projectVersion', $this->packageManager->getPackage('TechDivision.DocViewer')->getInstalledVersion());
}
}
11 changes: 8 additions & 3 deletions Classes/TechDivision/DocViewer/Controller/ResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
* This file is part of the TechDivision.DocViewer package.
*/
use TechDivision\DocViewer\Exceptions\FileNotInsideDocumentationException;
use TechDivision\DocViewer\Exceptions\PackageNotAccessableException;
use TechDivision\DocViewer\Exceptions\PackageNotAccessibleException;
use TechDivision\DocViewer\File\Parser;
use TechDivision\DocViewer\Util;
use TYPO3\Flow\Annotations as Flow;

/**
* Rudimentary service for resources
* Rudimentary service for resources. Flow does not allow serving static files which are not in the resource folder.
* This controller serves only static files which are inside the documentation folder of the installed packages which
* are not hidden by configuration.
*
* @Flow\Scope("singleton")
*/
Expand All @@ -31,14 +33,17 @@ class ResourceController extends \TYPO3\Flow\Mvc\Controller\ActionController
protected $packageManager;

/**
* Serves static files
*
* @param string $package
* @param string $filePath
* @return mixed
*/
public function rawAction($package, $filePath) {

// check if given package is valid
if (!$this->accessManager->isPackageAccessable($package)) {
throw new PackageNotAccessableException("You are not allowed to access the package " . $package);
throw new PackageNotAccessibleException("You are not allowed to access the package " . $package);
}

$docDir = Util::getDocumentPath($this->packageManager->getPackage($package));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace TechDivision\DocViewer\Exceptions;

/**
* Parsing is not allowed exception
* File is not inside documentation exception
*/
class FileNotInsideDocumentationException extends \TYPO3\Flow\Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
namespace TechDivision\DocViewer\Exceptions;

/**
* Parsing is not allowed exception
* Package is not accessible exception
*/
class PackageNotAccessableException extends \TYPO3\Flow\Exception
class PackageNotAccessibleException extends \TYPO3\Flow\Exception
{
}
1 change: 1 addition & 0 deletions Classes/TechDivision/DocViewer/File/Tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function findFileNodeByPath($path, $node = null) {
}
}
}
return null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Layouts/Default.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ <h1>{f:translate(id: 'module.label')}</h1>
</div>

<div class="footer">
DocViewer by <a href="https://www.techdivision.com/">TechDivision</a>. For support open an issue on <a href="https://github.com/techdivision/DocViewer"><i class="icon-github"></i> Github</a>
DocViewer {projectVersion} by <a href="https://www.techdivision.com/">TechDivision</a>. For support open an issue on <a href="https://github.com/techdivision/DocViewer"><i class="icon-github"></i> Github</a>
</div>
</div>
4 changes: 2 additions & 2 deletions Resources/Public/Styles/Style.css

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
{
"description": "This neos package enables you to read the docs of the installed packages",
"name": "techdivision/docviewer",
"keywords": ["neos", "backend", "module", "documentation"],
"type": "neos-package",
"authors": [
{
"name": "Matthias Witte",
"email": "[email protected]"
}
],
"license": "GPL-3.0+",
"require": {
"neos/neos": "2.3.*",
"erusev/parsedown": "*"
},
"name": "techdivision/docviewer",
"autoload": {
"psr-0": {
"TechDivision\\DocViewer": "Classes/"
Expand All @@ -15,6 +23,5 @@
"neos": {
"package-key": "TechDivision.DocViewer"
}
},
"license": "GPL-3.0+"
}
}
7 changes: 6 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ if(!process.env.DOCKER_CONTAINER_NAME) {
gutil.log("You have to provide the env var " + gutil.colors.red("DOCKER_CONTAINER_NAME"));
gutil.log("Example: " + gutil.colors.green("DOCKER_CONTAINER_NAME=my_container_name gulp deploy:docker"));
process.exit()
}
}

gulp.task('release', ['cms:build'], function() {
return gulp.src('dist/Resources/Public/Styles/*', { dot: true, followSymlinks: false })
.pipe(gulp.dest('./Resources/Public/Styles/'));
});

0 comments on commit dd62a9b

Please sign in to comment.