-
Notifications
You must be signed in to change notification settings - Fork 39
/
RoboFile.php
74 lines (66 loc) · 1.81 KB
/
RoboFile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
declare(strict_types=1);
use Drupal\Core\DrupalKernel;
use Robo\Tasks;
use RoboComponents\BootstrapTrait;
use RoboComponents\DeploymentTrait;
use RoboComponents\PhpcsTrait;
use RoboComponents\ReleaseNotesTrait;
use RoboComponents\SecurityTrait;
use RoboComponents\ThemeTrait;
use RoboComponents\TranslationManagement\ExportFromConfig;
use RoboComponents\TranslationManagement\ImportToConfig;
use RoboComponents\TranslationManagement\ImportToUi;
use Symfony\Component\HttpFoundation\Request;
$GLOBALS['drupal_autoloader'] = require_once 'web/autoload.php';
/**
* Robo commands.
*/
class RoboFile extends Tasks {
use BootstrapTrait;
use DeploymentTrait;
use ExportFromConfig;
use ImportToConfig;
use ImportToUi;
use PhpcsTrait;
use ReleaseNotesTrait;
use ThemeTrait;
use SecurityTrait;
/**
* Defines a list of languages installed on the site.
*
* Edit as languages are installed/removed. This is used for translation
* management.
*
* Do not include 'en', 'und' or 'zxx'.
*
* @see \TranslationManagement\ExportFromConfig
* @see \TranslationManagement\ImportToConfig
*/
const INSTALLED_LANGUAGES = [
'ar',
'es',
];
/**
* Bootstraps Drupal 8 in addition to Robo.
*
* @throws \Exception
*/
public function __construct() {
if (!file_exists('web/sites/default/settings.php')) {
// Drupal is not yet initialized, do not attempt to boot.
return;
}
try {
chdir(__DIR__ . '/web');
$request = Request::createFromGlobals();
$kernel = DrupalKernel::createFromRequest($request, $GLOBALS['drupal_autoloader'], 'prod');
$kernel->handle($request);
chdir(__DIR__);
}
catch (\Exception $e) {
// Do not fail, there are several commands that do not need Drupal.
$this->yell($e->getMessage());
}
}
}