@@ -13,6 +13,8 @@ class FrontendCommand extends BltTasks {
13
13
* Runs all frontend targets.
14
14
*
15
15
* @command frontend
16
+ *
17
+ * @executeInDrupalVm
16
18
*/
17
19
public function frontend () {
18
20
$ status_code = $ this ->invokeCommands ([
@@ -23,65 +25,37 @@ public function frontend() {
23
25
return $ status_code ;
24
26
}
25
27
26
- /**
27
- * Indicates whether a frontend hook should be invoked inside of Drupal VM.
28
- *
29
- * @return bool
30
- * TRUE if it should be invoked inside of Drupal VM.
31
- */
32
- protected function shouldExecuteInDrupalVm () {
33
- return $ this ->getInspector ()->isDrupalVmLocallyInitialized ()
34
- && $ this ->getInspector ()->isDrupalVmBooted ()
35
- && !$ this ->getInspector ()->isVmCli ();
36
- }
37
-
38
- /**
39
- * Invokes a frontend hook.
40
- *
41
- * The hook will be invoked in Drupal VM if is initialized and booted.
42
- * Otherwise, it will be invoked on the host machine.
43
- *
44
- * @param string $hook
45
- * The hook to invoke. E.g., "build" would invoke "frontend-build" hook.
46
- *
47
- * @return int|\Robo\Result
48
- * The status code or result object.
49
- */
50
- protected function invokeFrontendHook ($ hook ) {
51
- if ($ this ->shouldExecuteInDrupalVm ()) {
52
- $ this ->say ("Executing $ hook target hook inside of Drupal VM... " );
53
- return $ this ->executeCommandInDrupalVm ("blt frontend: $ hook " );
54
- }
55
- else {
56
- return $ this ->invokeHook ("frontend- $ hook " );
57
- }
58
- }
59
-
60
28
/**
61
29
* Executes frontend-build target hook.
62
30
*
63
31
* @command frontend:build
32
+ *
33
+ * @executeInDrupalVm
64
34
*/
65
35
public function build () {
66
- return $ this ->invokeFrontendHook ( ' build ' );
36
+ return $ this ->invokeHook ( ' frontend- build ' );
67
37
}
68
38
69
39
/**
70
40
* Executes frontend-setup target hook.
71
41
*
72
42
* @command frontend:setup
43
+ *
44
+ * @executeInDrupalVm
73
45
*/
74
46
public function setup () {
75
- return $ this ->invokeFrontendHook ( ' setup ' );
47
+ return $ this ->invokeHook ( ' frontend- setup ' );
76
48
}
77
49
78
50
/**
79
51
* Executes frontend-test target hook.
80
52
*
81
53
* @command frontend:test
54
+ *
55
+ * @executeInDrupalVm
82
56
*/
83
57
public function test () {
84
- return $ this ->invokeFrontendHook ( ' test ' );
58
+ return $ this ->invokeHook ( ' frontend- test ' );
85
59
}
86
60
87
61
}
0 commit comments