Skip to content

Commit a2f6374

Browse files
authored
Move some setup tasks from 'xb-dev-extras' to 'xb-site-install'. (#32)
1 parent e9f363a commit a2f6374

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

commands/web/xb-dev-extras

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ if [[ "$1" == "--dry-run" ]]; then
1414
- Admin Toolbar (admin_toolbar)
1515
- Admin Toolbar (admin_toolbar_tools)
1616
- Coffee (coffee)
17-
- \"All-Props\" Test SDC (sdc_test_all_props)
1817
2. Create a test page at '/test'."
1918
exit 0
2019
fi
@@ -30,30 +29,6 @@ composer require \
3029
drush en -y \
3130
admin_toolbar \
3231
admin_toolbar_tools \
33-
coffee \
34-
sdc_test_all_props
32+
coffee
3533

36-
# Create a test page. Note: If any more PHP code is added here, it should be
37-
# extracted to its own file. Writing it this way is clumsy, to say the least.
38-
drush php:eval "
39-
\$alias = '/test';
40-
\$path_alias_repository = \Drupal::service('path_alias.repository');
4134

42-
// See if the test page already exists and exit if so. (Just checking for
43-
// the path alias is naive, but it will suffice for our purposes.
44-
if (\$path_alias_repository->lookupByAlias(\$alias, 'en')) {
45-
echo 'The test page already exists.' . PHP_EOL;
46-
return;
47-
}
48-
49-
// Create the xb_page entity.
50-
\Drupal::service('entity_type.manager')
51-
->getStorage('xb_page')
52-
->create([
53-
'title' => 'XB 💫',
54-
'description' => 'This is an XB page.',
55-
'path' => ['alias' => \$alias],
56-
])->save();
57-
58-
echo 'The test page has been created.' . PHP_EOL;
59-
"

commands/web/xb-site-install

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,39 @@ drush site:install -y \
1414
# Enable the Experience Builder module.
1515
drush pm:install -y \
1616
experience_builder \
17-
xb_dev_standard
17+
xb_dev_standard \
18+
sdc_test_all_props
1819

1920
# Without a cache rebuild, Drupal can't find test modules, leading to a WSOD.
2021
drush cache:rebuild
2122

2223
# Create a default article.
2324
drush php:eval "(\Drupal\node\Entity\Node::create(['type' => 'article', 'title' => 'Test', 'uid' => 1]))->save();"
2425

26+
# Create a test page. Note: If any more PHP code is added here, it should be
27+
# extracted to its own file. Writing it this way is clumsy, to say the least.
28+
drush php:eval "
29+
\$alias = '/test';
30+
\$path_alias_repository = \Drupal::service('path_alias.repository');
31+
32+
// See if the test page already exists and exit if so. (Just checking for
33+
// the path alias is naive, but it will suffice for our purposes.
34+
if (\$path_alias_repository->lookupByAlias(\$alias, 'en')) {
35+
echo 'The test page already exists.' . PHP_EOL;
36+
return;
37+
}
38+
39+
// Create the xb_page entity.
40+
\Drupal::service('entity_type.manager')
41+
->getStorage('xb_page')
42+
->create([
43+
'title' => 'XB 💫',
44+
'description' => 'This is an XB page.',
45+
'path' => ['alias' => \$alias],
46+
])->save();
47+
48+
echo 'The test page has been created.' . PHP_EOL;
49+
"
50+
2551
# Display a one time login link for user ID 1.
2652
drush uli

0 commit comments

Comments
 (0)