Skip to content

Commit

Permalink
Merge pull request #37 from synchrone/master
Browse files Browse the repository at this point in the history
Checking if --template has a directory separator. Closes #7
  • Loading branch information
craig-davis committed Mar 16, 2015
2 parents 7da154b + 5736f43 commit 20dccd5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Resume/Command/HtmlCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected function configure()
'template',
't',
InputOption::VALUE_REQUIRED,
'Which of the templates to use'
'Which of the templates to use. Use an absolute path for a custom template.'
)
->addOption(
'refresh',
Expand Down Expand Up @@ -102,6 +102,10 @@ protected function generateContent($templatePath, $contentType)
array_push($assets, new FileAsset($fileInfo->getPathname()));
}

usort($assets, function(FileAsset $a, FileAsset $b){
return strcmp($a->getSourcePath(), $b->getSourcePath());
});

$collection = new AssetCollection(
$assets
);
Expand All @@ -126,7 +130,13 @@ protected function generateHtml($source, $template, $refresh)
if (!$template) {
$template = $this->app->defaultTemplate;
}
$templatePath = join(DIRECTORY_SEPARATOR, array($this->app->templatePath, basename($template)));

if (strpos($template, DIRECTORY_SEPARATOR) !== false) {
$templatePath = realpath($template);
} else {
$templatePath = join(DIRECTORY_SEPARATOR, array($this->app->templatePath, basename($template)));
}

$templateIndexPath = join(DIRECTORY_SEPARATOR, array($templatePath, 'index.html'));

if (!file_exists($templateIndexPath)) {
Expand Down

0 comments on commit 20dccd5

Please sign in to comment.