...
 
Commits (2)
......@@ -27,7 +27,7 @@
"ext-json": "*",
"php": ">=7.0",
"composer-plugin-api": "^1.0.0",
"lakedrops/composer-json-utils": "^1.3.3",
"lakedrops/composer-json-utils": "^1.4.0",
"lakedrops/docker-traefik": "^1.1.3",
"lakedrops/dotenv": "^1.1.3",
"twig/twig": "^1.23.1"
......
......@@ -87,7 +87,7 @@ class Handler extends BaseHandler {
$filename = $twig->render($template, $options);
$file = $def['dest'] . '/' . $filename;
if ($overwrite || !$fs->exists($file)) {
$twig_loader->setTemplate($filename, file_get_contents($pluginRoot . '/templates/' . $template . '.twig'));
$twig_loader->setTemplate($filename, file_get_contents($pluginRoot . '/templates/' . ($def['source'] ?? '') . $template . '.twig'));
$rendered = $twig->render($filename, $options);
if (!empty($def['add2yaml']) && isset($options[$filename])) {
$yaml = Yaml::parse($rendered);
......@@ -105,12 +105,12 @@ class Handler extends BaseHandler {
}
$fs->rename($file, $orig_file);
if (!$orig_ignored) {
$this->git('ignore *.orig');
$this->gitIgnore('*.orig');
$orig_ignored = TRUE;
}
}
else {
$this->git('ignore ' . $filename);
else if (empty($def['add2git'])) {
$this->gitIgnore($filename);
}
file_put_contents($file, $rendered);
}
......@@ -134,6 +134,11 @@ class Handler extends BaseHandler {
}
}
// Setup BackstopJS.
$this->gitIgnore('tests/backstop/backstop_data/bitmaps_test');
$this->gitIgnore('tests/backstop/backstop_data/html_report');
$this->git('lfs track tests/backstop/**/*.png');
$traefik = new Traefik($options['projectname']);
$traefik->update();
......@@ -181,6 +186,12 @@ class Handler extends BaseHandler {
],
'wkhtmltox.sh' => [
'dest' => $projectRoot . '/.docker-init',
],
'backstop.json' => [
'source' => 'tests/backstop/',
'dest' => $projectRoot . '/tests/backstop',
'add2yaml' => TRUE,
'add2git' => TRUE,
]
];
}
......
{
"id": "backstop_{{ projectname }}",
"viewports": [
{
"label": "phone",
"width": 320,
"height": 480
},
{
"label": "tablet",
"width": 768,
"height": 1024
},
{
"label": "desktop",
"width": 1960,
"height": 1280
}
],
"onBeforeScript": "puppet/onBefore.js",
"onReadyScript": "puppet/onReady.js",
"scenarios": [
{
"label": "{{ projectname }}",
"url": "http://{{ webserver.type }}"
}
],
"paths": {
"bitmaps_reference": "backstop_data/bitmaps_reference",
"bitmaps_test": "backstop_data/bitmaps_test",
"engine_scripts": "backstop_data/engine_scripts",
"html_report": "backstop_data/html_report",
"ci_report": "backstop_data/ci_report"
},
"report": ["browser"],
"engine": "puppeteer",
"engineOptions": {
"args": ["--no-sandbox"]
},
"asyncCaptureLimit": 5,
"asyncCompareLimit": 50,
"debug": false,
"debugWindow": false
}