Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix use of extension dir in subdirectory #79

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ However if you plan to use it for development, there are several utility scripts
tests.sh INSTALL_DIR EXTENSION_DIR

INSTALL_DIR: Installation dir (the same dir where you installed in step #4)
EXTENSION_DIR: Extension base dir (same as in 'extension.sh')
EXTENSION_DIR: Extension dir (where the extension is installed)
```

- `bin/clear-cache.sh`: Clears Drupal & CiviCRM caches.
Expand Down
11 changes: 6 additions & 5 deletions bin/extension.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,23 @@ extension_dir="${2?:Extension dir missing}"
extension_key="${3:-}"
install_dir=$(realpath "${install_dir}")
extension_target="${install_dir}/web/extensions"
extension_dir_basename=$(basename "${extension_dir}")

# Extension key not supplied --> it is the same as the dir
[[ -z "${extension_key}" ]] && extension_key=$(basename "${extension_dir}")
[[ -z "${extension_key}" ]] && extension_key="${extension_dir_basename}"

print-status Copy extension to CiviCRM "(${extension_key})..."
cp -a "${extension_dir}" "${extension_target}/"
cp -a --no-clobber "${extension_dir}" "${extension_target}/"
print-finish

if [[ -f "${extension_target}/${extension_dir}/composer.json" ]]; then
if [[ -f "${extension_target}/${extension_dir_basename}/composer.json" ]]; then
print-header Run composer install...
composer install --no-interaction --working-dir="${extension_target}/${extension_dir}"
composer install --no-interaction --working-dir="${extension_target}/${extension_dir_basename}"
print-finish
fi

print-status Set permissions...
sudo chgrp -R www-data "${extension_target}/${extension_dir}"
sudo chgrp -R www-data "${extension_target}/${extension_dir_basename}"
print-finish

print-header Enable extension "(${extension_key})..."
Expand Down
7 changes: 4 additions & 3 deletions bin/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ base_dir=$(builtin cd "$(dirname "${0}")/.." >/dev/null 2>&1 && pwd)

# Parse options
install_dir="${1?:Install dir missing}"
extension="${2?:Extension missing}"
extension_dir="${2?:Extension dir missing}"
shift 2
install_dir=$(realpath "${install_dir}")
extension_target="${install_dir}/web/extensions"
extension_dir_basename=$(basename "${extension_dir}")

print-header Run unit tests "(${extension})"
print-header Run unit tests "(${extension_dir_basename})"
sudo chown -R "${USER}" "${install_dir}/web/"
cd "${extension_target}/${extension}"
cd "${extension_target}/${extension_dir_basename}"
"${install_dir}/vendor/bin/phpunit" --verbose --coverage-text --colors=always "${@}"
print-finish

Expand Down
10 changes: 5 additions & 5 deletions cfg/install.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ php_xdebug_mode=coverage
########
# Downloaded binaries location
local_bin=/usr/local/bin
# Composer URL
# Composer
url_composer=https://getcomposer.org/download/2.7.6/composer.phar
sha_composer=29dc9a19ef33535db061b31180b2a833a7cf8d2cf4145b33a2f83504877bba08
# CV url
# CV
url_cv=https://download.civicrm.org/cv/cv.phar
# civix url
# civix
url_civix=https://download.civicrm.org/civix/civix.phar
# civistrings url
# civistrings
url_civistrings=https://download.civicrm.org/civistrings/civistrings.phar
# php-cs-fixer url
# php-cs-fixer
url_php_cs_fixer=https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.38.2/php-cs-fixer.phar
sha_php_cs_fixer=cb839aee98c0f8928a5449a921c3e70b5b3fea3f15cda5e8f736da32a6b99ddd

Expand Down