mirror of
https://github.com/there4/markdown-resume.git
synced 2024-12-03 08:59:35 -05:00
Update phar file with latest build
* Update `ouput` to be a folder instead of a filename
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace Resume\Cli;
|
||||
|
||||
|
||||
class Converter
|
||||
{
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Resume\Cli;
|
||||
|
||||
@@ -7,7 +7,6 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Assetic\Asset\AssetCollection;
|
||||
use Assetic\Asset\FileAsset;
|
||||
use Assetic\Asset\GlobAsset;
|
||||
use Assetic\Filter;
|
||||
use Michelf\MarkdownExtra;
|
||||
@@ -29,7 +28,7 @@ class HtmlCommand extends Command
|
||||
->addArgument(
|
||||
'destination',
|
||||
InputArgument::REQUIRED,
|
||||
'Output html document'
|
||||
'Output destination folder'
|
||||
)
|
||||
->addOption(
|
||||
'template',
|
||||
@@ -48,26 +47,28 @@ class HtmlCommand extends Command
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->app = $this->getApplication();
|
||||
$source = $input->getArgument('source');
|
||||
$destination = $input->getArgument('destination');
|
||||
$template = $input->getOption('template');
|
||||
$refresh = $input->getOption('refresh');
|
||||
$this->app = $this->getApplication();
|
||||
$source = $input->getArgument('source');
|
||||
$destination = trim($input->getArgument('destination'), DIRECTORY_SEPARATOR);
|
||||
$template = $input->getOption('template');
|
||||
$refresh = $input->getOption('refresh');
|
||||
$destFilename = join(DIRECTORY_SEPARATOR, array($destination, pathinfo($source, PATHINFO_FILENAME) . '.html'));
|
||||
|
||||
$rendered = $this->generateHtml($source, $template, $refesh);
|
||||
file_put_contents($destination, $rendered);
|
||||
$rendered = $this->generateHtml($source, $template, $refresh);
|
||||
file_put_contents($destFilename, $rendered);
|
||||
$output->writeln(
|
||||
sprintf(
|
||||
"Wrote resume to: <info>%s</info>",
|
||||
$destination
|
||||
$destFilename
|
||||
),
|
||||
$this->app->outputFormat
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function generateHtml($source, $template, $refresh) {
|
||||
|
||||
protected function generateHtml($source, $template, $refresh)
|
||||
{
|
||||
// Check that the source file is sane
|
||||
if (!file_exists($source)) {
|
||||
$output->writeln(
|
||||
@@ -77,6 +78,7 @@ class HtmlCommand extends Command
|
||||
),
|
||||
$this->app->outputFormat
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -98,6 +100,7 @@ class HtmlCommand extends Command
|
||||
),
|
||||
$this->app->outputFormat
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PdfCommand extends HtmlCommand
|
||||
->addArgument(
|
||||
'destination',
|
||||
InputArgument::REQUIRED,
|
||||
'Output pdf document'
|
||||
'Output destination folder'
|
||||
)
|
||||
->addOption(
|
||||
'template',
|
||||
@@ -35,11 +35,12 @@ class PdfCommand extends HtmlCommand
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->app = $this->getApplication();
|
||||
$source = $input->getArgument('source');
|
||||
$destination = $input->getArgument('destination');
|
||||
$template = $input->getOption('template');
|
||||
$pdfSource = join(DIRECTORY_SEPARATOR, array(dirname($destination), '.tmp_pdf_source.html'));
|
||||
$this->app = $this->getApplication();
|
||||
$source = $input->getArgument('source');
|
||||
$destination = trim($input->getArgument('destination'), DIRECTORY_SEPARATOR);
|
||||
$template = $input->getOption('template');
|
||||
$pdfSource = join(DIRECTORY_SEPARATOR, array($destination, '.tmp_pdf_source.html'));
|
||||
$destFilename = join(DIRECTORY_SEPARATOR, array($destination, pathinfo($source, PATHINFO_FILENAME) . '.pdf'));
|
||||
|
||||
// Make sure we've got out converter available
|
||||
exec('wkhtmltopdf -V', $results, $returnVal);
|
||||
@@ -54,6 +55,7 @@ class PdfCommand extends HtmlCommand
|
||||
),
|
||||
$this->app->outputFormat
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -68,7 +70,7 @@ class PdfCommand extends HtmlCommand
|
||||
file_put_contents($pdfSource, $rendered);
|
||||
|
||||
// Process the document with wkhtmltopdf
|
||||
exec('wkhtmltopdf ' . $pdfSource .' ' . $destination);
|
||||
exec('wkhtmltopdf ' . $pdfSource .' ' . $destFilename);
|
||||
|
||||
// Unlink the temporary file
|
||||
unlink($pdfSource);
|
||||
|
||||
@@ -18,7 +18,7 @@ class TemplatesCommand extends Command
|
||||
{
|
||||
$this->app = $this->getApplication();
|
||||
$tplData = array('templates' => array());
|
||||
foreach(glob($this->app->templatePath . '/*', GLOB_ONLYDIR) as $dir) {
|
||||
foreach (glob($this->app->templatePath . '/*', GLOB_ONLYDIR) as $dir) {
|
||||
$tplData['templates'][] = (object) array(
|
||||
'name' => basename($dir),
|
||||
'description' => file_exists($dir . '/description.txt')
|
||||
|
||||
Reference in New Issue
Block a user