Skip to content

Commit dd26772

Browse files
[#167] Updated init script to handle more replacement cases. (#137)
Co-authored-by: Alex Skrypnyk <alex@drevops.com>
1 parent 0c95124 commit dd26772

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

.scaffold/tests/bats/_assert_init.bash

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,28 @@ assert_files_present_common() {
99

1010
pushd "${dir}" >/dev/null || exit 1
1111

12-
# Assert that some files must be exist.
13-
assert_file_exists "force_crystal.info.yml"
14-
assert_file_exists "phpcs.xml"
15-
assert_file_exists "phpmd.xml"
16-
assert_file_exists "phpstan.neon"
12+
# Assert that some files must exist.
13+
assert_file_exists ".ahoy.yml"
1714
assert_file_exists ".editorconfig"
1815
assert_file_exists ".gitattributes"
1916
assert_file_exists ".gitignore"
2017
assert_file_exists "README.md"
18+
assert_file_exists "composer.dev.json"
19+
assert_file_exists "composer.json"
20+
assert_file_exists "force_crystal.info.yml"
2121
assert_file_exists "logo.png"
22+
assert_file_exists "phpcs.xml"
23+
assert_file_exists "phpmd.xml"
24+
assert_file_exists "phpstan.neon"
25+
assert_file_exists "rector.php"
2226

23-
# Assert that some files must not be exist.
27+
# Assert that some files must not exist.
28+
assert_dir_not_exists ".scaffold"
29+
assert_file_not_exists ".github/workflows/scaffold-release.yml"
30+
assert_file_not_exists ".github/workflows/scaffold-test.yml"
31+
assert_file_not_exists "LICENSE"
2432
assert_file_not_exists "README.dist.md"
2533
assert_file_not_exists "logo.tmp.png"
26-
assert_file_not_exists "LICENSE"
27-
assert_file_not_exists ".github/workflows/test-scaffold.yml"
28-
29-
# Assert some dirs/files must not be exist.
30-
assert_dir_not_exists ".scaffold"
3134

3235
# Assert that .gitignore were processed correctly.
3336
assert_file_contains ".gitignore" "composer.lock"
@@ -56,14 +59,14 @@ assert_files_present_common() {
5659
assert_file_not_contains ".gitattributes" "# phpmd.xml"
5760
assert_file_not_contains ".gitattributes" "# phpstan.neon"
5861

59-
# Assert that composer.json were processed correctly.
62+
# Assert that composer.json was processed correctly.
6063
assert_file_contains "composer.json" '"name": "drupal/force_crystal"'
6164
assert_file_contains "composer.json" '"description": "Provides force_crystal functionality."'
6265
assert_file_contains "composer.json" '"homepage": "https://drupal.org/project/force_crystal"'
6366
assert_file_contains "composer.json" '"issues": "https://drupal.org/project/issues/force_crystal"'
6467
assert_file_contains "composer.json" '"source": "https://git.drupalcode.org/project/force_crystal"'
6568

66-
# Assert that extension info file were processed correctly.
69+
# Assert that extension info file was processed correctly.
6770
assert_file_contains "force_crystal.info.yml" 'name: Force Crystal'
6871

6972
# Assert other things.
@@ -83,10 +86,10 @@ assert_files_present_extension_type_module() {
8386
assert_file_not_contains "force_crystal.info.yml" 'type: theme'
8487
assert_file_not_contains "force_crystal.info.yml" 'base theme: false'
8588

86-
# Assert that composer.json file were processed correctly.
89+
# Assert that composer.json file was processed correctly.
8790
assert_file_contains "composer.json" '"type": "drupal-module"'
8891

89-
# Assert some dirs/files must be exist.
92+
# Assert some dirs/files must exist.
9093
assert_dir_exists "tests/src/Unit"
9194
assert_dir_exists "tests/src/Functional"
9295

@@ -106,7 +109,7 @@ assert_files_present_extension_type_theme() {
106109
# Assert that composer.json file were processed correctly.
107110
assert_file_contains "composer.json" '"type": "drupal-theme"'
108111

109-
# Assert some dirs/files must not be exist.
112+
# Assert some dirs/files must not exist.
110113
assert_dir_not_exists "tests/src/Unit"
111114
assert_dir_not_exists "tests/src/Functional"
112115

@@ -122,11 +125,13 @@ assert_workflow() {
122125

123126
# Lint.
124127
pushd "build" >/dev/null || exit 1
128+
125129
vendor/bin/phpcs
126130
vendor/bin/phpstan
127131
vendor/bin/rector --clear-cache --dry-run
128132
vendor/bin/phpmd . text phpmd.xml
129133
vendor/bin/twigcs
134+
130135
popd >/dev/null || exit 1
131136

132137
# Change mode to make bats have enough permission to clean tmp test directory.

init.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ process_internal() {
179179
replace_string_content "drupal_extension_scaffold" "${extension_machine_name}"
180180
replace_string_content "Drupal extension scaffold" "${extension_name}"
181181
replace_string_content "type: module" "type: ${extension_type}"
182+
replace_string_content "\[EXTENSION_NAME\]" "${extension_machine_name}"
182183

183184
remove_string_content "# Uncomment the lines below in your project."
184185
uncomment_line ".gitattributes" ".ahoy.yml"
@@ -204,7 +205,7 @@ process_internal() {
204205

205206
rm -f LICENSE >/dev/null || true
206207
rm -Rf "tests/scaffold" >/dev/null || true
207-
rm -f ".github/workflows/test-scaffold.yml" >/dev/null || true
208+
rm -f .github/workflows/scaffold*.yml >/dev/null || true
208209
rm -Rf .scaffold >/dev/null || true
209210

210211
remove_tokens_with_content "META"

0 commit comments

Comments
 (0)