diff --git a/README.md b/README.md
index ccc2c87..580089d 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ at the [blog post for the project][blog].
## Help
```
-Markdown Resume Generator version 2.0.1 by Craig Davis
+Markdown Resume Generator version 2.0.4 by Craig Davis
Usage:
[options] command [arguments]
@@ -85,10 +85,11 @@ The application is deployed as a compiled phar file. In order to add new
commands, you'll need to first install the dependencies:
* `composer install`
-* [install pake][pake]
After that, you can run the `md2resume_dev.php` file from the command line.
-Check out the pake tooling for more information about the build.
+Check out the pake tooling for more information about the build. Pake will be
+installed to `./vendor/bin/pake`. So for instance a complete phar file build
+looks like `./vendor/bin/pake build`.
## Acknowledgments
@@ -99,6 +100,9 @@ are a more comfortable with html than markdown, you should use it.
## Changelog
+* __2.0.4__ : Fix path resolution problem with absolute paths to close #16
+* __2.0.3__ : Add optional duration to the `--refresh` option to close #15
+* __2.0.2__ : Add new dependency check for `mbstring` to close #20
* __2.0.1__ : Add new `swissen` template with Helvetica styling (@beautifulcode)
* __2.0.0__ : Complete rewrite with the [symfony console component][console].
Deployment is now done with a compiled phar file, and development dependencies
diff --git a/bin/md2resume b/bin/md2resume
index 35e49ae..c2ddb11 100755
Binary files a/bin/md2resume and b/bin/md2resume differ
diff --git a/composer.json b/composer.json
index 63c9ca8..85a3191 100644
--- a/composer.json
+++ b/composer.json
@@ -8,7 +8,7 @@
"html5"
],
"license": "MIT",
- "version": "2.0.1",
+ "version": "2.0.4",
"selfupdatepath": "://github.com/there4/markdown-resume/raw/master/bin/md2resume",
"selfupdateversion": "://github.com/there4/markdown-resume/raw/master/version",
"authors": [
diff --git a/md2resume_dev.php b/md2resume_dev.php
index a0fbe94..b1e4d11 100755
--- a/md2resume_dev.php
+++ b/md2resume_dev.php
@@ -16,7 +16,7 @@ $app->add('Resume', __DIR__ . '/src');
$console = new Resume\Cli\Resume();
// If we're running from phar, we get these values from the stub
-if (!defined("IN_PHAR")) {
+if (!defined('IN_PHAR')) {
$project = json_decode(file_get_contents(__DIR__ . '/composer.json'));
}
diff --git a/src/Resume/Cli/Resume.php b/src/Resume/Cli/Resume.php
index dc025ce..394f4f4 100644
--- a/src/Resume/Cli/Resume.php
+++ b/src/Resume/Cli/Resume.php
@@ -30,6 +30,9 @@ class Resume extends Application
// the alternative is OutputInterface::OUTPUT_PLAIN;
$this->outputFormat = OutputInterface::OUTPUT_NORMAL;
+ // Exits on missing dependencies
+ $this->checkDependencies();
+
// We do this now because we've loaded the project info from the composer file
$this->setName($this->project->description);
$this->setVersion($this->project->version);
@@ -65,6 +68,19 @@ class Resume extends Application
return parent::getLongVersion().' by Craig Davis';
}
+ public function checkDependencies()
+ {
+ $output = new ConsoleOutput();
+ if (!extension_loaded('mbstring')) {
+ $output->writeln(
+ "\nMissing Dependency: Please install the Multibyte String Functions.\n" .
+ "More help: http://www.php.net/manual/en/mbstring.installation.php\n",
+ $this->outputFormat
+ );
+ exit(1);
+ }
+ }
+
public function registerStyles(&$output)
{
// https://github.com/symfony/Console/blob/master/Formatter/OutputFormatterStyle.php
diff --git a/src/Resume/Command/HtmlCommand.php b/src/Resume/Command/HtmlCommand.php
index a52e1c1..5aa0fa7 100644
--- a/src/Resume/Command/HtmlCommand.php
+++ b/src/Resume/Command/HtmlCommand.php
@@ -39,9 +39,11 @@ class HtmlCommand extends Command
->addOption(
'refresh',
'r',
- InputOption::VALUE_NONE,
- 'If set, the html will include a meta command to refresh the ' .
- 'document every 5 seconds.'
+ InputOption::VALUE_OPTIONAL,
+ 'Regenerate the html and include a meta command to refresh the ' .
+ 'document every periodically. Measured in seconds. Defaults to' .
+ '5 seconds',
+ 5
);
}
@@ -49,7 +51,7 @@ class HtmlCommand extends Command
{
$this->app = $this->getApplication();
$source = $input->getArgument('source');
- $destination = trim($input->getArgument('destination'), DIRECTORY_SEPARATOR);
+ $destination = rtrim($input->getArgument('destination'), DIRECTORY_SEPARATOR);
$template = $input->getOption('template');
$refresh = $input->getOption('refresh');
$destFilename = join(DIRECTORY_SEPARATOR, array($destination, pathinfo($source, PATHINFO_FILENAME) . '.html'));
@@ -58,7 +60,7 @@ class HtmlCommand extends Command
file_put_contents($destFilename, $rendered);
$output->writeln(
sprintf(
- "Wrote resume to: %s",
+ 'Wrote resume to: %s',
$destFilename
),
$this->app->outputFormat
@@ -71,15 +73,7 @@ class HtmlCommand extends Command
{
// Check that the source file is sane
if (!file_exists($source)) {
- $output->writeln(
- sprintf(
- "Unable to open source file: %s",
- $source
- ),
- $this->app->outputFormat
- );
-
- return false;
+ throw new \Exception("Unable to open source file: $source");
}
// Check that our template is sane, or set to the default one
@@ -88,16 +82,9 @@ class HtmlCommand extends Command
}
$templatePath = join(DIRECTORY_SEPARATOR, array($this->app->templatePath, basename($template)));
$templateIndexPath = join(DIRECTORY_SEPARATOR, array($templatePath, 'index.html'));
- if (!file_exists($templateIndexPath)) {
- $output->writeln(
- sprintf(
- "Unable to open template file: %s",
- $templateIndexPath
- ),
- $this->app->outputFormat
- );
- return false;
+ if (!file_exists($templateIndexPath)) {
+ throw new \Exception("Unable to open template file: $templateIndexPath");
}
// We build these into a single string so that we can deploy this resume as a
@@ -127,7 +114,7 @@ class HtmlCommand extends Command
$resumeHtml = MarkdownExtra::defaultTransform($resumeContent);
$resumeHtml = SmartyPants::defaultTransform($resumeHtml);
- // We'll construct the title for the html document from the h1 and h2 tags
+ // Construct the title for the html document from the h1 and h2 tags
$simpleDom = new \simple_html_dom();
$simpleDom->load($resumeHtml);
$title = sprintf(
@@ -136,17 +123,15 @@ class HtmlCommand extends Command
$simpleDom->find('h2', 0)->innertext
);
- // We'll now render the Markdown into an html file with Mustache Templates
+ // Render the Markdown into an html file with Mustache Templates
$m = new \Mustache_Engine;
- $rendered = $m->render(
- $templateContent,
- array(
- 'title' => $title,
- 'style' => $style,
- 'resume' => $resumeHtml,
- 'reload' => $refresh
- )
- );
+ $rendered = $m->render($templateContent, array(
+ 'title' => $title,
+ 'style' => $style,
+ 'resume' => $resumeHtml,
+ 'reload' => (bool) $refresh,
+ 'refresh_rate' => $refresh
+ ));
return $rendered;
}
diff --git a/src/Resume/Command/PdfCommand.php b/src/Resume/Command/PdfCommand.php
index 9f9778b..72211f7 100644
--- a/src/Resume/Command/PdfCommand.php
+++ b/src/Resume/Command/PdfCommand.php
@@ -36,7 +36,7 @@ class PdfCommand extends HtmlCommand
{
$this->app = $this->getApplication();
$source = $input->getArgument('source');
- $destination = trim($input->getArgument('destination'), DIRECTORY_SEPARATOR);
+ $destination = rtrim($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'));
diff --git a/templates/blockish/index.html b/templates/blockish/index.html
index 59eb35b..cea6ed4 100644
--- a/templates/blockish/index.html
+++ b/templates/blockish/index.html
@@ -3,7 +3,7 @@
{{#reload}}
-
+
{{/reload}}
{{title}}
diff --git a/templates/modern/index.html b/templates/modern/index.html
index 59eb35b..cea6ed4 100644
--- a/templates/modern/index.html
+++ b/templates/modern/index.html
@@ -3,7 +3,7 @@
{{#reload}}
-
+
{{/reload}}
{{title}}
diff --git a/templates/swissen/index.html b/templates/swissen/index.html
index 59eb35b..cea6ed4 100644
--- a/templates/swissen/index.html
+++ b/templates/swissen/index.html
@@ -3,7 +3,7 @@
{{#reload}}
-
+
{{/reload}}
{{title}}
diff --git a/templates/unstyled/index.html b/templates/unstyled/index.html
index 59eb35b..cea6ed4 100644
--- a/templates/unstyled/index.html
+++ b/templates/unstyled/index.html
@@ -3,7 +3,7 @@
{{#reload}}
-
+
{{/reload}}
{{title}}
diff --git a/version b/version
index 10bf840..26e3379 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-2.0.1
\ No newline at end of file
+2.0.4
\ No newline at end of file