10 Commits
0.1.2 ... 0.2.0

Author SHA1 Message Date
027a81c170 Introduced toggable objects 2019-06-01 12:31:10 +02:00
c9ef6f1e72 Changed deprecated method call 2019-06-01 12:30:15 +02:00
3b24c5d9f4 Use git branch-name as document-name, use default if no git 2019-06-01 12:29:00 +02:00
49b5bcf9cd Introduced GitService 2019-06-01 12:27:27 +02:00
87b7835b56 make sure target directory exists 2019-06-01 12:22:47 +02:00
8779cdaafa update to symfony 4.2.8 et al. 2019-05-25 16:50:26 +02:00
e9d20bee4f unified project handling 2019-05-25 16:48:31 +02:00
665e9eedc3 template caching disabled in debug mode, cleanup projects page 2018-12-16 13:38:46 +01:00
a565438c8f fixed missing end-tag 2018-12-15 12:12:10 +01:00
efbf7e569a added repository link 2018-12-15 12:08:49 +01:00
19 changed files with 441 additions and 203 deletions

View File

@@ -1,5 +1,6 @@
### Settings file for magdev/dossier ### Settings file for magdev/dossier
charset: utf-8 charset: utf-8
docname: dossier
# Date formats # Date formats
date: date:

View File

@@ -19,6 +19,10 @@ services:
class: '\Magdev\Dossier\Service\MinifierService' class: '\Magdev\Dossier\Service\MinifierService'
arguments: ['@monolog'] arguments: ['@monolog']
git:
class: '\Magdev\Dossier\Service\GitService'
arguments: ['@config', '@monolog']
translator: translator:
class: '\Magdev\Dossier\Service\TranslatorService' class: '\Magdev\Dossier\Service\TranslatorService'
arguments: ['@config', '@monolog'] arguments: ['@config', '@monolog']

View File

@@ -502,19 +502,6 @@ dl.horizontal {
font-weight: bold; font-weight: bold;
font-size: (@base-font-size + .5pt); font-size: (@base-font-size + .5pt);
} }
dl.horizontal {
display: none;
dt {
text-align: left;
width: 1cm;
}
dd {
padding-right: 1cm;
p {
margin: 0;
}
}
}
p, li { p, li {
line-height: @intro-paragraph-line-height; line-height: @intro-paragraph-line-height;
font-size: @intro-paragraph-size; font-size: @intro-paragraph-size;

View File

@@ -19,6 +19,14 @@
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
{% macro list_projects(projects, tag) %}
{% set tag = tag|default('li') %}
{% for project in projects %}
<{{ tag }}><em>{{ project.name }}:</em>
{{ project.shortDescription }}</{{ tag }}>
{% endfor %}
{% endmacro %}
{% macro list_link_array(entries, tag) %} {% macro list_link_array(entries, tag) %}
{% set tag = tag|default('li') %} {% set tag = tag|default('li') %}

View File

@@ -1,3 +1,5 @@
{% import "macros.html.twig" as macros %}
{% if projects|length > 0 %} {% if projects|length > 0 %}
<section class="projects"> <section class="projects">
<h2>{{ 'projects.header'|trans }}</h2> <h2>{{ 'projects.header'|trans }}</h2>
@@ -6,18 +8,13 @@
{% for project in projects %} {% for project in projects %}
<article class="project"> <article class="project">
<h3>{{ project.name }} {% if project.stack %}<small>({{ project.stack }})</small>{% endif %}</h3> <h3>{{ project.name }} {% if project.stack %}<small>({{ project.stack }})</small>{% endif %}</h3>
<dl class="horizontal">
<dt>{{ 'projects.fields.status'|trans }}</dt>
<dd>
<p class="badge badge-{{ project.status }}">{{ ('projects.status.' ~ project.status)|trans }}</p>
</dd>
{% if project.role %}
<dt>{{ 'projects.fields.role'|trans }}</dt>
<dd>{{ project.role }}</dd>
{% endif %}
</dl>
<p class="short-description">{{ project.shortDescription }}</p> <p class="short-description">{{ project.shortDescription }}</p>
{{ project.content|raw }} {{ project.content|raw }}
{% if project.hasUrls() %}
<ul>
{{ macros.list_link_array(project.urls) }}
</ul>
{% endif %}
</article> </article>
{% endfor %} {% endfor %}
</div> </div>

View File

@@ -115,11 +115,11 @@
{{ macros.list_references(person.references) }} {{ macros.list_references(person.references) }}
</ul> </ul>
{% endif %} {% endif %}
{% if person.projects|length > 0 %} {% if projects|length > 0 %}
<h3>{{ 'resume.headers.current_projects'|trans }}</h3> <h3>{{ 'resume.headers.current_projects'|trans }}</h3>
<ul> <ul>
{{ macros.list_simple_array(person.projects) }} {{ macros.list_projects(projects) }}
</ul> </ul>
{% endif %} {% endif %}

207
composer.lock generated
View File

@@ -8,19 +8,20 @@
"packages": [ "packages": [
{ {
"name": "adbario/php-dot-notation", "name": "adbario/php-dot-notation",
"version": "2.1.0", "version": "2.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/adbario/php-dot-notation.git", "url": "https://github.com/adbario/php-dot-notation.git",
"reference": "895fe4bb153ac875c61a6fba658ded45405e73a4" "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/adbario/php-dot-notation/zipball/895fe4bb153ac875c61a6fba658ded45405e73a4", "url": "https://api.github.com/repos/adbario/php-dot-notation/zipball/eee4fc81296531e6aafba4c2bbccfc5adab1676e",
"reference": "895fe4bb153ac875c61a6fba658ded45405e73a4", "reference": "eee4fc81296531e6aafba4c2bbccfc5adab1676e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*",
"php": ">=5.5" "php": ">=5.5"
}, },
"require-dev": { "require-dev": {
@@ -52,20 +53,20 @@
"ArrayAccess", "ArrayAccess",
"dotnotation" "dotnotation"
], ],
"time": "2018-07-22T12:33:53+00:00" "time": "2019-01-01T23:59:15+00:00"
}, },
{ {
"name": "erusev/parsedown", "name": "erusev/parsedown",
"version": "1.7.1", "version": "1.7.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/erusev/parsedown.git", "url": "https://github.com/erusev/parsedown.git",
"reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1" "reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/erusev/parsedown/zipball/92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", "url": "https://api.github.com/repos/erusev/parsedown/zipball/6d893938171a817f4e9bc9e86f2da1e370b7bcd7",
"reference": "92e9c27ba0e74b8b028b111d1b6f956a15c01fc1", "reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -98,7 +99,7 @@
"markdown", "markdown",
"parser" "parser"
], ],
"time": "2018-03-08T01:11:30+00:00" "time": "2019-03-17T18:48:37+00:00"
}, },
{ {
"name": "erusev/parsedown-extra", "name": "erusev/parsedown-extra",
@@ -146,16 +147,16 @@
}, },
{ {
"name": "leafo/scssphp", "name": "leafo/scssphp",
"version": "v0.7.7", "version": "v0.7.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/leafo/scssphp.git", "url": "https://github.com/leafo/scssphp.git",
"reference": "1d656f8c02a3a69404bba6b28ec4e06edddf0f49" "reference": "a384906af3d078e98b089d7d36f6ceab8703f7ff"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/leafo/scssphp/zipball/1d656f8c02a3a69404bba6b28ec4e06edddf0f49", "url": "https://api.github.com/repos/leafo/scssphp/zipball/a384906af3d078e98b089d7d36f6ceab8703f7ff",
"reference": "1d656f8c02a3a69404bba6b28ec4e06edddf0f49", "reference": "a384906af3d078e98b089d7d36f6ceab8703f7ff",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -194,7 +195,7 @@
"scss", "scss",
"stylesheet" "stylesheet"
], ],
"time": "2018-07-22T01:22:08+00:00" "time": "2019-04-24T18:10:10+00:00"
}, },
{ {
"name": "magdev/console-form", "name": "magdev/console-form",
@@ -611,16 +612,16 @@
}, },
{ {
"name": "symfony/config", "name": "symfony/config",
"version": "v4.2.1", "version": "v4.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/config.git", "url": "https://github.com/symfony/config.git",
"reference": "005d9a083d03f588677d15391a716b1ac9b887c0" "reference": "0e745ead307d5dcd4e163e94a47ec04b1428943f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/005d9a083d03f588677d15391a716b1ac9b887c0", "url": "https://api.github.com/repos/symfony/config/zipball/0e745ead307d5dcd4e163e94a47ec04b1428943f",
"reference": "005d9a083d03f588677d15391a716b1ac9b887c0", "reference": "0e745ead307d5dcd4e163e94a47ec04b1428943f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -670,20 +671,20 @@
], ],
"description": "Symfony Config Component", "description": "Symfony Config Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-11-30T22:21:14+00:00" "time": "2019-04-01T14:03:25+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v4.2.1", "version": "v4.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "4dff24e5d01e713818805c1862d2e3f901ee7dd0" "reference": "e2840bb38bddad7a0feaf85931e38fdcffdb2f81"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/4dff24e5d01e713818805c1862d2e3f901ee7dd0", "url": "https://api.github.com/repos/symfony/console/zipball/e2840bb38bddad7a0feaf85931e38fdcffdb2f81",
"reference": "4dff24e5d01e713818805c1862d2e3f901ee7dd0", "reference": "e2840bb38bddad7a0feaf85931e38fdcffdb2f81",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -695,6 +696,9 @@
"symfony/dependency-injection": "<3.4", "symfony/dependency-injection": "<3.4",
"symfony/process": "<3.3" "symfony/process": "<3.3"
}, },
"provide": {
"psr/log-implementation": "1.0"
},
"require-dev": { "require-dev": {
"psr/log": "~1.0", "psr/log": "~1.0",
"symfony/config": "~3.4|~4.0", "symfony/config": "~3.4|~4.0",
@@ -704,7 +708,7 @@
"symfony/process": "~3.4|~4.0" "symfony/process": "~3.4|~4.0"
}, },
"suggest": { "suggest": {
"psr/log-implementation": "For using the console logger", "psr/log": "For using the console logger",
"symfony/event-dispatcher": "", "symfony/event-dispatcher": "",
"symfony/lock": "", "symfony/lock": "",
"symfony/process": "" "symfony/process": ""
@@ -739,20 +743,20 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-11-27T07:40:44+00:00" "time": "2019-04-08T14:23:48+00:00"
}, },
{ {
"name": "symfony/contracts", "name": "symfony/contracts",
"version": "v1.0.2", "version": "v1.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/contracts.git", "url": "https://github.com/symfony/contracts.git",
"reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" "reference": "d3636025e8253c6144358ec0a62773cae588395b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", "url": "https://api.github.com/repos/symfony/contracts/zipball/d3636025e8253c6144358ec0a62773cae588395b",
"reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", "reference": "d3636025e8253c6144358ec0a62773cae588395b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -760,19 +764,22 @@
}, },
"require-dev": { "require-dev": {
"psr/cache": "^1.0", "psr/cache": "^1.0",
"psr/container": "^1.0" "psr/container": "^1.0",
"symfony/polyfill-intl-idn": "^1.10"
}, },
"suggest": { "suggest": {
"psr/cache": "When using the Cache contracts", "psr/cache": "When using the Cache contracts",
"psr/container": "When using the Service contracts", "psr/container": "When using the Service contracts",
"symfony/cache-contracts-implementation": "", "symfony/cache-contracts-implementation": "",
"symfony/event-dispatcher-implementation": "",
"symfony/http-client-contracts-implementation": "",
"symfony/service-contracts-implementation": "", "symfony/service-contracts-implementation": "",
"symfony/translation-contracts-implementation": "" "symfony/translation-contracts-implementation": ""
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.0-dev" "dev-master": "1.1-dev"
} }
}, },
"autoload": { "autoload": {
@@ -807,20 +814,20 @@
"interoperability", "interoperability",
"standards" "standards"
], ],
"time": "2018-12-05T08:06:11+00:00" "time": "2019-04-27T14:29:50+00:00"
}, },
{ {
"name": "symfony/dependency-injection", "name": "symfony/dependency-injection",
"version": "v4.2.1", "version": "v4.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/dependency-injection.git", "url": "https://github.com/symfony/dependency-injection.git",
"reference": "e4adc57a48d3fa7f394edfffa9e954086d7740e5" "reference": "d161c0c8bc77ad6fdb8f5083b9e34c3015d43eb1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/e4adc57a48d3fa7f394edfffa9e954086d7740e5", "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d161c0c8bc77ad6fdb8f5083b9e34c3015d43eb1",
"reference": "e4adc57a48d3fa7f394edfffa9e954086d7740e5", "reference": "d161c0c8bc77ad6fdb8f5083b9e34c3015d43eb1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -880,20 +887,20 @@
], ],
"description": "Symfony DependencyInjection Component", "description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-12-02T15:59:36+00:00" "time": "2019-04-27T11:48:17+00:00"
}, },
{ {
"name": "symfony/dotenv", "name": "symfony/dotenv",
"version": "v4.2.1", "version": "v4.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/dotenv.git", "url": "https://github.com/symfony/dotenv.git",
"reference": "97f135ab40f969cbeae27d482ff63acbc33dbe2a" "reference": "b541d63b83532be55a020db8ed2e50598385a583"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/dotenv/zipball/97f135ab40f969cbeae27d482ff63acbc33dbe2a", "url": "https://api.github.com/repos/symfony/dotenv/zipball/b541d63b83532be55a020db8ed2e50598385a583",
"reference": "97f135ab40f969cbeae27d482ff63acbc33dbe2a", "reference": "b541d63b83532be55a020db8ed2e50598385a583",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -937,20 +944,20 @@
"env", "env",
"environment" "environment"
], ],
"time": "2018-11-26T10:55:26+00:00" "time": "2019-04-01T07:32:59+00:00"
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v4.2.1", "version": "v4.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/event-dispatcher.git", "url": "https://github.com/symfony/event-dispatcher.git",
"reference": "921f49c3158a276d27c0d770a5a347a3b718b328" "reference": "fbce53cd74ac509cbe74b6f227622650ab759b02"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/921f49c3158a276d27c0d770a5a347a3b718b328", "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fbce53cd74ac509cbe74b6f227622650ab759b02",
"reference": "921f49c3158a276d27c0d770a5a347a3b718b328", "reference": "fbce53cd74ac509cbe74b6f227622650ab759b02",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1001,20 +1008,20 @@
], ],
"description": "Symfony EventDispatcher Component", "description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-12-01T08:52:38+00:00" "time": "2019-04-06T13:51:08+00:00"
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v4.2.1", "version": "v4.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "2f4c8b999b3b7cadb2a69390b01af70886753710" "reference": "e16b9e471703b2c60b95f14d31c1239f68f11601"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/2f4c8b999b3b7cadb2a69390b01af70886753710", "url": "https://api.github.com/repos/symfony/filesystem/zipball/e16b9e471703b2c60b95f14d31c1239f68f11601",
"reference": "2f4c8b999b3b7cadb2a69390b01af70886753710", "reference": "e16b9e471703b2c60b95f14d31c1239f68f11601",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1051,20 +1058,20 @@
], ],
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-11-11T19:52:12+00:00" "time": "2019-02-07T11:40:08+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v4.2.1", "version": "v4.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "e53d477d7b5c4982d0e1bfd2298dbee63d01441d" "reference": "e45135658bd6c14b61850bf131c4f09a55133f69"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/e53d477d7b5c4982d0e1bfd2298dbee63d01441d", "url": "https://api.github.com/repos/symfony/finder/zipball/e45135658bd6c14b61850bf131c4f09a55133f69",
"reference": "e53d477d7b5c4982d0e1bfd2298dbee63d01441d", "reference": "e45135658bd6c14b61850bf131c4f09a55133f69",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1100,20 +1107,20 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-11-11T19:52:12+00:00" "time": "2019-04-06T13:51:08+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.10.0", "version": "v1.11.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19" "reference": "82ebae02209c21113908c229e9883c419720738a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
"reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "reference": "82ebae02209c21113908c229e9883c419720738a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1125,7 +1132,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.9-dev" "dev-master": "1.11-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1147,7 +1154,7 @@
}, },
{ {
"name": "Gert de Pagter", "name": "Gert de Pagter",
"email": "BackEndTea@gmail.com" "email": "backendtea@gmail.com"
} }
], ],
"description": "Symfony polyfill for ctype functions", "description": "Symfony polyfill for ctype functions",
@@ -1158,20 +1165,20 @@
"polyfill", "polyfill",
"portable" "portable"
], ],
"time": "2018-08-06T14:22:27+00:00" "time": "2019-02-06T07:57:58+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.10.0", "version": "v1.11.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "c79c051f5b3a46be09205c73b80b346e4153e494" "reference": "fe5e94c604826c35a32fa832f35bd036b6799609"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609",
"reference": "c79c051f5b3a46be09205c73b80b346e4153e494", "reference": "fe5e94c604826c35a32fa832f35bd036b6799609",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1183,7 +1190,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.9-dev" "dev-master": "1.11-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1217,20 +1224,20 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2018-09-21T13:07:52+00:00" "time": "2019-02-06T07:57:58+00:00"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v4.2.1", "version": "v4.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "2b341009ccec76837a7f46f59641b431e4d4c2b0" "reference": "8cf39fb4ccff793340c258ee7760fd40bfe745fe"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/2b341009ccec76837a7f46f59641b431e4d4c2b0", "url": "https://api.github.com/repos/symfony/process/zipball/8cf39fb4ccff793340c258ee7760fd40bfe745fe",
"reference": "2b341009ccec76837a7f46f59641b431e4d4c2b0", "reference": "8cf39fb4ccff793340c258ee7760fd40bfe745fe",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1266,20 +1273,20 @@
], ],
"description": "Symfony Process Component", "description": "Symfony Process Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-11-20T16:22:05+00:00" "time": "2019-04-10T16:20:36+00:00"
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v4.2.1", "version": "v4.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
"reference": "c0e2191e9bed845946ab3d99767513b56ca7dcd6" "reference": "181a426dd129cb496f12d7e7555f6d0b37a7615b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/c0e2191e9bed845946ab3d99767513b56ca7dcd6", "url": "https://api.github.com/repos/symfony/translation/zipball/181a426dd129cb496f12d7e7555f6d0b37a7615b",
"reference": "c0e2191e9bed845946ab3d99767513b56ca7dcd6", "reference": "181a426dd129cb496f12d7e7555f6d0b37a7615b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1301,7 +1308,9 @@
"symfony/console": "~3.4|~4.0", "symfony/console": "~3.4|~4.0",
"symfony/dependency-injection": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0",
"symfony/finder": "~2.8|~3.0|~4.0", "symfony/finder": "~2.8|~3.0|~4.0",
"symfony/http-kernel": "~3.4|~4.0",
"symfony/intl": "~3.4|~4.0", "symfony/intl": "~3.4|~4.0",
"symfony/var-dumper": "~3.4|~4.0",
"symfony/yaml": "~3.4|~4.0" "symfony/yaml": "~3.4|~4.0"
}, },
"suggest": { "suggest": {
@@ -1339,20 +1348,20 @@
], ],
"description": "Symfony Translation Component", "description": "Symfony Translation Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-12-06T10:45:32+00:00" "time": "2019-05-01T12:55:36+00:00"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v4.2.1", "version": "v4.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "c41175c801e3edfda90f32e292619d10c27103d7" "reference": "6712daf03ee25b53abb14e7e8e0ede1a770efdb1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/c41175c801e3edfda90f32e292619d10c27103d7", "url": "https://api.github.com/repos/symfony/yaml/zipball/6712daf03ee25b53abb14e7e8e0ede1a770efdb1",
"reference": "c41175c801e3edfda90f32e292619d10c27103d7", "reference": "6712daf03ee25b53abb14e7e8e0ede1a770efdb1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1398,36 +1407,36 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-11-11T19:52:12+00:00" "time": "2019-03-30T15:58:42+00:00"
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v2.5.0", "version": "v2.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/twigphp/Twig.git",
"reference": "6a5f676b77a90823c2d4eaf76137b771adf31323" "reference": "5240e21982885b76629552d83b4ebb6d41ccde6b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/6a5f676b77a90823c2d4eaf76137b771adf31323", "url": "https://api.github.com/repos/twigphp/Twig/zipball/5240e21982885b76629552d83b4ebb6d41ccde6b",
"reference": "6a5f676b77a90823c2d4eaf76137b771adf31323", "reference": "5240e21982885b76629552d83b4ebb6d41ccde6b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.0", "php": "^7.0",
"symfony/polyfill-ctype": "^1.8", "symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-mbstring": "~1.0" "symfony/polyfill-mbstring": "^1.3"
}, },
"require-dev": { "require-dev": {
"psr/container": "^1.0", "psr/container": "^1.0",
"symfony/debug": "^2.7", "symfony/debug": "^2.7",
"symfony/phpunit-bridge": "^3.3" "symfony/phpunit-bridge": "^3.4.19|^4.1.8"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.5-dev" "dev-master": "2.10-dev"
} }
}, },
"autoload": { "autoload": {
@@ -1465,7 +1474,7 @@
"keywords": [ "keywords": [
"templating" "templating"
], ],
"time": "2018-07-13T07:18:09+00:00" "time": "2019-05-14T12:03:52+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
@@ -1517,16 +1526,16 @@
}, },
{ {
"name": "wapmorgan/php-code-analyzer", "name": "wapmorgan/php-code-analyzer",
"version": "1.0.5", "version": "1.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/wapmorgan/PhpCodeAnalyzer.git", "url": "https://github.com/wapmorgan/PhpCodeAnalyzer.git",
"reference": "98d33563218ad6757e34da8428fffec38fa6ad9f" "reference": "0efd0ab52cf15518a467f80158be20accc8e86d7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/wapmorgan/PhpCodeAnalyzer/zipball/98d33563218ad6757e34da8428fffec38fa6ad9f", "url": "https://api.github.com/repos/wapmorgan/PhpCodeAnalyzer/zipball/0efd0ab52cf15518a467f80158be20accc8e86d7",
"reference": "98d33563218ad6757e34da8428fffec38fa6ad9f", "reference": "0efd0ab52cf15518a467f80158be20accc8e86d7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1566,7 +1575,7 @@
"code analysis", "code analysis",
"command-line utility" "command-line utility"
], ],
"time": "2018-05-01T18:48:48+00:00" "time": "2019-05-09T15:24:55+00:00"
} }
], ],
"aliases": [], "aliases": [],

View File

@@ -62,7 +62,7 @@ final class DossierBuildCommand extends BaseCommand
->addOption('locale', 'l', InputOption::VALUE_OPTIONAL, 'Set the locale', 'de') ->addOption('locale', 'l', InputOption::VALUE_OPTIONAL, 'Set the locale', 'de')
->addOption('sort', 's', InputOption::VALUE_OPTIONAL, 'Set the sort direction for the CV', CurriculumVitae::SORT_DESC) ->addOption('sort', 's', InputOption::VALUE_OPTIONAL, 'Set the sort direction for the CV', CurriculumVitae::SORT_DESC)
->addOption('theme', 't', InputOption::VALUE_OPTIONAL, 'Select the theme', 'print') ->addOption('theme', 't', InputOption::VALUE_OPTIONAL, 'Select the theme', 'print')
->addOption('docname', 'd', InputOption::VALUE_OPTIONAL, 'Set the name for the output document (w/o extension)', 'dossier') ->addOption('docname', 'd', InputOption::VALUE_OPTIONAL, 'Set the name for the output document (w/o extension)', '')
->addOption('no-cover', null, InputOption::VALUE_NONE, 'Suppress the cover') ->addOption('no-cover', null, InputOption::VALUE_NONE, 'Suppress the cover')
->addOption('no-intro', null, InputOption::VALUE_NONE, 'Suppress the introduction') ->addOption('no-intro', null, InputOption::VALUE_NONE, 'Suppress the introduction')
@@ -97,11 +97,12 @@ final class DossierBuildCommand extends BaseCommand
$cssproc = $this->getService('cssproc'); $cssproc = $this->getService('cssproc');
/* @var $cssroc \Magdev\Dossier\Service\StylesheetProcessorService */ /* @var $cssroc \Magdev\Dossier\Service\StylesheetProcessorService */
$name = $input->getOption('docname') ?: $this->getService('git')->getCurrentBranchName();
try { try {
$data = new DataCollector(array( $data = new DataCollector(array(
'disabled' => $this->getHelper('section_manager')->getDisabledSections($input), 'disabled' => $this->getHelper('section_manager')->getDisabledSections($input),
'theme' => $input->getOption('theme'), 'theme' => $input->getOption('theme'),
'name' => $input->getOption('docname'), 'name' => ($name ?: 'dossier'),
'tags' => $this->config->get('cv.tags'), 'tags' => $this->config->get('cv.tags'),
'locale' => $this->translator->getTranslator()->getLocale(), 'locale' => $this->translator->getTranslator()->getLocale(),
'stylesheet' => $cssproc->parseThemeStyles(), 'stylesheet' => $cssproc->parseThemeStyles(),

View File

@@ -198,7 +198,7 @@ class CurriculumVitae extends BaseCollection
$formatter = $this->formatter; $formatter = $this->formatter;
array_walk($result, function(int &$seconds, string $key) use ($formatter) { array_walk($result, function(int &$seconds, string $key) use ($formatter) {
$seconds = $formatter->formatExperience($seconds); $seconds = $formatter->formatYearMonthDuration($seconds);
}); });
return $result; return $result;
} }

View File

@@ -32,6 +32,7 @@ namespace Magdev\Dossier\Model\CurriculumVitae;
use Magdev\Dossier\Model\AbstractModel; use Magdev\Dossier\Model\AbstractModel;
use Magdev\Dossier\Model\Traits\PhotoTrait; use Magdev\Dossier\Model\Traits\PhotoTrait;
use Magdev\Dossier\Model\Traits\ToggableTrait;
use Mni\FrontYAML\Document; use Mni\FrontYAML\Document;
use Magdev\Dossier\Model\Base\BaseModel; use Magdev\Dossier\Model\Base\BaseModel;
use Magdev\Dossier\Analyzer\Base\AnalyzableInterface; use Magdev\Dossier\Analyzer\Base\AnalyzableInterface;
@@ -46,6 +47,7 @@ use Magdev\Dossier\Model\Base\PhotoInterface;
final class Entry extends BaseModel implements PhotoInterface, AnalyzableInterface final class Entry extends BaseModel implements PhotoInterface, AnalyzableInterface
{ {
use PhotoTrait; use PhotoTrait;
use ToggableTrait;
/** /**
* Start date * Start date

View File

@@ -69,16 +69,6 @@ class Intro extends BaseModel implements PhotoInterface, AnalyzableInterface
protected $showQuotes = self::SHOW_TOP; protected $showQuotes = self::SHOW_TOP;
/**
* Get the headline
*
* @return string
*/
public function getHeadline(): string
{
return $this->headline;
}
/** /**
@@ -93,6 +83,17 @@ class Intro extends BaseModel implements PhotoInterface, AnalyzableInterface
} }
/**
* Get the headline
*
* @return string
*/
public function getHeadline(): string
{
return $this->headline;
}
/** /**
* Get the quotes * Get the quotes
* *

View File

@@ -132,12 +132,6 @@ final class Person extends BaseModel implements PhotoInterface, AnalyzableInterf
*/ */
protected $interests = array(); protected $interests = array();
/**
* Current Projects
* @var array
*/
protected $projects = array();
/** /**
* Constructor * Constructor
@@ -312,17 +306,6 @@ final class Person extends BaseModel implements PhotoInterface, AnalyzableInterf
} }
/**
* Get current projects
*
* @return array
*/
public function getProjects(): array
{
return $this->projects;
}
/** /**
* Get the work license * Get the work license
* *
@@ -388,7 +371,10 @@ final class Person extends BaseModel implements PhotoInterface, AnalyzableInterf
foreach ($value as $type => $address) { foreach ($value as $type => $address) {
if ($type == 'accounts' && is_array($address)) { if ($type == 'accounts' && is_array($address)) {
foreach ($address as $a) { foreach ($address as $a) {
$this->contacts->append(new Contact($a['address'], $a['type'])); $contact = new Contact($a['address'], $a['type'], $a['active']);
if ($contact->isActive()) {
$this->contacts->append($contact);
}
} }
} else { } else {
$this->contacts->append(new Contact($address, $type)); $this->contacts->append(new Contact($address, $type));
@@ -396,7 +382,10 @@ final class Person extends BaseModel implements PhotoInterface, AnalyzableInterf
} }
} else if ($key == 'references') { } else if ($key == 'references') {
foreach ($value as $reference) { foreach ($value as $reference) {
$this->references->append(new Reference($reference)); $ref = new Reference($reference);
if ($ref->isActive()) {
$this->references->append($ref);
}
} }
} else { } else {
$this->setProperty($key, $value); $this->setProperty($key, $value);

View File

@@ -30,6 +30,8 @@
namespace Magdev\Dossier\Model\Person; namespace Magdev\Dossier\Model\Person;
use Magdev\Dossier\Model\Traits\ToggableTrait;
/** /**
* Contact model * Contact model
* *
@@ -37,6 +39,8 @@ namespace Magdev\Dossier\Model\Person;
*/ */
class Contact class Contact
{ {
use ToggableTrait;
/** /**
* Contact address * Contact address
* @var string * @var string
@@ -55,11 +59,13 @@ class Contact
* *
* @param string $address * @param string $address
* @param string $type * @param string $type
* @param bool $active
*/ */
public function __construct(string $address, string $type) public function __construct(string $address, string $type, ?bool $active = true)
{ {
$this->address = $address; $this->address = $address;
$this->type = $type; $this->type = $type;
$this->active = $active;
} }

View File

@@ -31,6 +31,7 @@
namespace Magdev\Dossier\Model\Person; namespace Magdev\Dossier\Model\Person;
use Magdev\Dossier\Model\Base\BaseModel; use Magdev\Dossier\Model\Base\BaseModel;
use Magdev\Dossier\Model\Traits\ToggableTrait;
/** /**
* Model for job references * Model for job references
@@ -39,6 +40,8 @@ use Magdev\Dossier\Model\Base\BaseModel;
*/ */
class Reference extends BaseModel class Reference extends BaseModel
{ {
use ToggableTrait;
/** /**
* Reference description * Reference description
* @var string * @var string

View File

@@ -30,26 +30,43 @@
namespace Magdev\Dossier\Model; namespace Magdev\Dossier\Model;
use Magdev\Dossier\Model\Base\BaseModel; use Magdev\Dossier\Model\Base\BaseModel;
use Magdev\Dossier\Model\Traits\ToggableTrait;
use Mni\FrontYAML\Document;
/**
* Model for projects page
*
* @author magdev
*/
class Project extends BaseModel class Project extends BaseModel
{ {
use ToggableTrait;
/**
* Project name
* @var string
*/
protected $name = ''; protected $name = '';
protected $status = '';
protected $url = ''; /**
* Public URLs
* @var array
*/
protected $urls = array();
/**
* Short Description
* @var string
*/
protected $shortDescription = ''; protected $shortDescription = '';
/**
* Project stack
* @var string
*/
protected $stack = ''; protected $stack = '';
protected $role = '';
public function getRole(): string
{
return $this->role;
}
public function getStack(): string public function getStack(): string
{ {
@@ -57,35 +74,26 @@ class Project extends BaseModel
} }
public function getName(): string public function getName(): string
{ {
return $this->name; return $this->name;
} }
public function hasUrls(): bool
public function getStatus(): string
{ {
return $this->status; return sizeof($this->urls) > 0;
} }
public function getUrls(): array
public function getUrl(): string
{ {
return $this->url; return $this->urls;
} }
public function getShortDescription(): string public function getShortDescription(): string
{ {
return $this->shortDescription; return $this->shortDescription;
} }
} }

View File

@@ -0,0 +1,91 @@
<?php
/**
* The MIT License (MIT)
*
* Copyright (c) 2019 magdev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author magdev
* @copyright 2019 Marco Grätsch
* @package magdev/dossier
* @license http://opensource.org/licenses/MIT MIT License
*/
namespace Magdev\Dossier\Model\Traits;
/**
* Trait for objects which can be de-/activated
*
* @author magdev
*/
trait ToggableTrait
{
/**
* @var bool
*/
protected $active = true;
/**
* Activate object
*
* @return self
*/
public function activate(): self
{
$this->active = true;
return self;
}
/**
* Deactivate object
*
* @return self
*/
public function deactivate(): self
{
$this->active = false;
return $this;
}
/**
* Toggle current activation status
*
* @return self
*/
public function toggle(): self
{
$this->active = !$this->active;
return $this;
}
/**
* Check if object is activated
*
* @return bool
*/
public function isActive(): bool
{
return $this->active;
}
}

115
src/Service/GitService.php Normal file
View File

@@ -0,0 +1,115 @@
<?php
/**
* The MIT License (MIT)
*
* Copyright (c) 2019 magdev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author magdev
* @copyright 2019 Marco Grätsch
* @package magdev/dossier
* @license http://opensource.org/licenses/MIT MIT License
*/
namespace Magdev\Dossier\Service;
// git branch | grep \* | cut -d ' ' -f2
class GitService
{
/**
* Configuration service
* @var \Magdev\Dossier\Service\ConfigService
*/
protected $config = null;
/**
* Monolog service
* @var \Magdev\Dossier\Service\MonologService
*/
protected $logger = null;
/**
* Constructor
*
* @param \Magdev\Dossier\Service\ConfigService $config
* @param \Magdev\Dossier\Service\MonologService $logger
*/
public function __construct(ConfigService $config, MonologService $logger)
{
$this->config = $config;
$this->logger = $logger;
}
/**
* Initialize a new repository
*
* @return bool
*/
public function init(): bool
{
if (!$this->isGitRepository()) {
$this->exec('git init');
}
return $this->isGitRepository();
}
/**
* Get the current branch name
*
* @return string
*/
public function getCurrentBranchName(): string
{
if (!$this->isGitRepository()) {
return $this->config->get('docname');
}
$output = $this->exec('git branch | grep \\\* | cut -d \' \' -f2');
return $output[0];
}
/**
* Check if repository is initialized
*
* @return bool
*/
public function isGitRepository(): bool
{
return is_dir(PROJECT_ROOT.'/.git') && file_exists(PROJECT_ROOT.'/.git/config');
}
/**
* Execute a system command
*
* @param string $cmd
* @return array
*/
protected function exec(string $cmd): array
{
$output = array();
exec($cmd, $output);
return $output;
}
}

View File

@@ -108,7 +108,10 @@ class MarkdownService
foreach ($files as $file) { foreach ($files as $file) {
/* @var $file \SplFileInfo */ /* @var $file \SplFileInfo */
$document = $this->getDocument($file->getPathname()); $document = $this->getDocument($file->getPathname());
$cv->append(new CurriculumVitae\Entry($document)); $entry = new CurriculumVitae\Entry($document);
if ($entry->isActive()) {
$cv->append($entry);
}
} }
$cv->setSortDirection($sort)->sort(); $cv->setSortDirection($sort)->sort();
@@ -117,7 +120,10 @@ class MarkdownService
foreach ($files as $file) { foreach ($files as $file) {
/* @var $file \SplFileInfo */ /* @var $file \SplFileInfo */
$document = $this->getDocument($file->getPathname()); $document = $this->getDocument($file->getPathname());
$projects->append(new Project($document)); $project = new Project($document);
if ($project->isActive()) {
$projects->append($project);
}
} }

View File

@@ -120,13 +120,15 @@ class TemplateService
{ {
$theme = !$theme ? $this->theme : $theme; $theme = !$theme ? $this->theme : $theme;
if (getenv('DOSSIER_THEME_DIR')) { if (getenv('APP_ENV') == 'prod') {
if (is_dir(getenv('DOSSIER_THEME_DIR').'/'.$theme) && file_exists(getenv('DOSSIER_THEME_DIR').'/'.$theme.'/'.$file)) { if (getenv('DOSSIER_THEME_DIR')) {
return getenv('DOSSIER_THEME_DIR').'/'.$theme.'/'.$file; if (is_dir(getenv('DOSSIER_THEME_DIR').'/'.$theme) && file_exists(getenv('DOSSIER_THEME_DIR').'/'.$theme.'/'.$file)) {
return getenv('DOSSIER_THEME_DIR').'/'.$theme.'/'.$file;
}
}
if (is_dir(getenv('HOME').'/.dossier/tpl/'.$theme) && file_exists(getenv('HOME').'/.dossier/tpl/'.$theme.'/'.$file)) {
return getenv('HOME').'/.dossier/tpl/'.$theme.'/'.$file;
} }
}
if (is_dir(getenv('HOME').'/.dossier/tpl/'.$theme) && file_exists(getenv('HOME').'/.dossier/tpl/'.$theme.'/'.$file)) {
return getenv('HOME').'/.dossier/tpl/'.$theme.'/'.$file;
} }
return DOSSIER_ROOT.'/app/tpl/'.$theme.'/'.$file; return DOSSIER_ROOT.'/app/tpl/'.$theme.'/'.$file;
} }
@@ -143,16 +145,23 @@ class TemplateService
$this->theme = $theme; $this->theme = $theme;
$loaders = array(); $loaders = array();
if (getenv('DOSSIER_THEME_DIR') && is_dir(getenv('DOSSIER_THEME_DIR').'/'.$theme)) { if (getenv('APP_ENV') == 'prod') {
$loaders[] = new \Twig_Loader_Filesystem(getenv('DOSSIER_THEME_DIR').'/'.$theme); if (getenv('DOSSIER_THEME_DIR') && is_dir(getenv('DOSSIER_THEME_DIR').'/'.$theme)) {
} $loaders[] = new \Twig_Loader_Filesystem(getenv('DOSSIER_THEME_DIR').'/'.$theme);
if (is_dir(getenv('HOME').'/.dossier/tpl/'.$theme)) { }
$loaders[] = new \Twig_Loader_Filesystem(getenv('HOME').'/.dossier/tpl/'.$theme); if (is_dir(getenv('HOME').'/.dossier/tpl/'.$theme)) {
$loaders[] = new \Twig_Loader_Filesystem(getenv('HOME').'/.dossier/tpl/'.$theme);
}
} }
$loaders[] = new \Twig_Loader_Filesystem(DOSSIER_ROOT.'/app/tpl/'.$theme); $loaders[] = new \Twig_Loader_Filesystem(DOSSIER_ROOT.'/app/tpl/'.$theme);
$cache = false;
if (getenv('APP_ENV') == 'prod') {
$cache = new \Twig_Cache_Filesystem(DOSSIER_CACHE, \Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION);
}
$this->twig = new \Twig_Environment(new \Twig_Loader_Chain($loaders), array( $this->twig = new \Twig_Environment(new \Twig_Loader_Chain($loaders), array(
'cache' => new \Twig_Cache_Filesystem(DOSSIER_CACHE, \Twig_Cache_Filesystem::FORCE_BYTECODE_INVALIDATION), 'cache' => $cache,
'debug' => getenv('APP_DEBUG'), 'debug' => getenv('APP_DEBUG'),
)); ));
$this->addTwigExtensions($this->translator->getTranslator(), $this->config); $this->addTwigExtensions($this->translator->getTranslator(), $this->config);
@@ -205,9 +214,6 @@ class TemplateService
*/ */
public function render(string $template, DataCollectorInterface $data, string $destDir): string public function render(string $template, DataCollectorInterface $data, string $destDir): string
{ {
if (!is_dir($destDir)) {
mkdir($destDir, 0755, true);
}
$vars = $data->getData(); $vars = $data->getData();
$name = isset($vars['name']) ? $vars['name'] : $this->docname; $name = isset($vars['name']) ? $vars['name'] : $this->docname;
$name .= isset($vars['theme']) ? '.'.$vars['theme'] : ''; $name .= isset($vars['theme']) ? '.'.$vars['theme'] : '';
@@ -215,6 +221,10 @@ class TemplateService
$html = $this->twig->render($template, $vars); $html = $this->twig->render($template, $vars);
$html = $this->minifier->minify($html); $html = $this->minifier->minify($html);
if (!is_dir(dirname($path))) {
mkdir(dirname($path), 0755, true);
}
if (!file_put_contents($path, $html)) { if (!file_put_contents($path, $html)) {
throw new \RuntimeException('Error writing output file: '.$path); throw new \RuntimeException('Error writing output file: '.$path);
} }
@@ -290,7 +300,7 @@ class TemplateService
}, array('is_safe' => array('html')))); }, array('is_safe' => array('html'))));
$this->twig->addFilter(new \Twig_Filter('debug', function ($var) { $this->twig->addFilter(new \Twig_Filter('debug', function ($var) {
return getenv('APP_DEBUG') == true ? '<code>'.print_r($var, true).'</code>' : ''; return getenv('APP_DEBUG') == true || getenv('APP_ENV') == 'dev' ? '<code>'.print_r($var, true).'</code>' : '';
}, array('is_safe' => array('html')))); }, array('is_safe' => array('html'))));
$this->twig->addFunction(new \Twig_Function('is_today', function (\DateTime $checkDate) { $this->twig->addFunction(new \Twig_Function('is_today', function (\DateTime $checkDate) {