Skip to content

Commit

Permalink
Merge pull request #30 from acquia/develop
Browse files Browse the repository at this point in the history
Merge `develop` into `main`
  • Loading branch information
vishalkhode1 authored Jan 18, 2024
2 parents dd7ba79 + 5c06103 commit 29c517d
Show file tree
Hide file tree
Showing 33 changed files with 1,094 additions and 6,778 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
# Use Indian Standard Time (UTC +05:30)
timezone: "Asia/Kolkata"
time: "09:00"
# Raise pull requests for version updates
# to pip against the `develop` branch
target-branch: "develop"
77 changes: 77 additions & 0 deletions .github/workflows/drs_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: drupal-recommended-settings CI
on:
# schedule:
# "At minute 0 past hour 4 and 8 UTC."
# - cron: '0 4,8 * * *'
push:
branches: [ develop, main, ACMS* ]
paths-ignore:
- README.md
pull_request:
branches: [ develop ]
paths-ignore:
- README.md
env:
ORCA_SUT_NAME: acquia/drupal-recommended-settings
ORCA_SUT_BRANCH: develop
ORCA_VERSION: ^4
ORCA_PACKAGES_CONFIG_ALTER: ../drupal-recommended-settings/tests/packages_alter.yml
ORCA_ENABLE_NIGHTWATCH: "FALSE"
ORCA_PHPCS_STANDARD: AcquiaPHP
COMPOSER_PROCESS_TIMEOUT: 1800
jobs:
STATIC_CODE_ANALYSIS:
name: "Static Code Analysis"
runs-on: ubuntu-latest
env:
ORCA_JOB: STATIC_CODE_ANALYSIS
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: xdebug
- name: Download ORCA
run: composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n
- name: Before Install
run: ../orca/bin/ci/before_install.sh
- name: Install
run: ../orca/bin/ci/install.sh
- name: Before script
run: ../orca/bin/ci/before_script.sh
- name: Script
run: ../orca/bin/ci/script.sh
- name: After script
run: |
../orca/bin/ci/after_success.sh
../orca/bin/ci/after_failure.sh
../orca/bin/ci/after_script.sh
PHPUNIT_TESTS:
name: "Execute PHPUnit tests"
runs-on: ubuntu-latest
env:
ORCA_FIXTURE_DIR: "/home/runner/work/drupal-recommended-settings/orca-build"
CI: TRUE
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: xdebug
- name: Download ORCA
run: composer create-project --no-dev --ignore-platform-req=php acquia/orca ../orca "$ORCA_VERSION" -n
- name: Before Install
run: ../orca/bin/ci/before_install.sh
- name: Install
run: ../orca/bin/ci/install.sh
- name: Before script
run: ../orca/bin/ci/before_script.sh
- name: Run PHPUnit tests
run: |
composer install
./vendor/bin/phpunit tests
- name: After script
run: |
../orca/bin/ci/after_success.sh
../orca/bin/ci/after_failure.sh
../orca/bin/ci/after_script.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
vendor
.idea/
.DS_Store
composer.lock
116 changes: 82 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,108 @@
# Acquia Drupal Recommended Settings
The Acquia Drupal Recommended Settings plugin adds the recommended settings to the Drupal project, so developers won't have to edit settings.php manually.
The Acquia Drupal Recommended Settings plugin adds the recommended settings to
the Drupal project, so developers won't have to edit settings.php manually.

The recommended settings includes:
- the required database credentials
- configuration sync directory path.
- public/private etc. file directory path.
- The required database credentials.
- Configuration sync directory path.
- File directory path i.e public/private etc.
- Acquia site studio sync directory path.
- Includes Drupal module [Config sync without site uuid](https://www.drupal.org/project/config_sync_without_site_uuid) features.

It allows your websites to be easily installed in both Acquia Cloud IDE & local and deployable on Acquia Cloud.
It allows your websites to be easily installed in both Acquia Cloud IDE & local
and deployable on Acquia Cloud.

## Installation

You can also install this using Composer like so:
### Install using Composer

```
composer require acquia/drupal-recommended-settings
```

## Steps to switch from BLT to Acquia Drupal Recommended Settings
This plugin doesn't work with the acquia/blt plugin. If the plugin exists, it must be removed.

- Remove BLT plugin using below command
### Multi-site features with Acquia DRS
The Drupal Recommended Settings offer the multi-site feature out of the box.
To configure a multi-site, run the following command, and the plugin will
automatically generate the settings.php in the backend.
```
composer remove acquia/blt
drush site:install --uri site1
```

- Remove BLT reference from settings.php file located at
``/docroot/sites/default/settings.php``.
```php
require DRUPAL_ROOT . "/../vendor/acquia/blt/settings/blt.settings.php";
The plugin offers various events that allow you to implement custom logic based
on when these events are triggered. You can find the examples of such
implementations from [here](examples).

# Quick examples
## Generate settings for a given site
```
<?php
/**
* IMPORTANT.
*
* Do not include additional settings here. Instead, add them to settings
* included by `blt.settings.php`. See BLT's documentation for more detail.
*
* @link https://docs.acquia.com/blt/
* @file
* Include DRS settings.
*/
```
- Require Acquia Drupal Recommended Settings plugin using
use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
use Acquia\Drupal\RecommendedSettings\Settings;
// Create settings object.
$siteUri = "site1";
$settings = new Settings(DRUPAL_ROOT, $siteUri);
try {
// Call generate method.
$settings->generate();
}
catch (SettingsException $e) {
echo $e->getMessage();
}
```
composer require acquia/drupal-recommended-settings

## Generate settings for a given site passing database credentials

```

- Update `default.local.settings.php` and `local.settings.php` to use the Environment Detector provided by this plugin instead of BLT:
```diff
- use Acquia\Blt\Robo\Common\EnvironmentDetector;
+ use Acquia\Drupal\RecommendedSettings\Helpers\EnvironmentDetector;
<?php
/**
* @file
* Include DRS settings.
*/
use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
use Acquia\Drupal\RecommendedSettings\Settings;
// Create settings object.
$siteUri = "site1";
$settings = new Settings(DRUPAL_ROOT, $siteUri);
// Database details.
$dbSpec = [
'drupal' => [
'db' => [
'database' => 'drupal', // In case of multi-site database name is replaced with the site name.
'username' => 'drupal',
'password' => 'drupal',
'host' => 'localhost',
'port' => '3306',
],
],
];
try {
// Call generate method passing database details.
$settings->generate($dbSpec);
}
catch (SettingsException $e) {
echo $e->getMessage();
}
```

# License

Copyright (C) 2023 Acquia, Inc.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License version 2 as published by the
Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
57 changes: 28 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,50 @@
{
"name": "acquia/drupal-recommended-settings",
"type": "composer-plugin",
"description": "The composer plugin for adding drupal-recommended-settings for Acquia Cloud.",
"license": "GPL-2.0-only",
"type": "composer-plugin",
"keywords": [
"drupal",
"acquia",
"drupal-recommended-settings"
],
"license": "GPL-2.0-only",
"authors": [
{
"name": "Vishal Khode",
"email": "[email protected]"
}
],
"support": {
"issues": "https://github.com/acquia/drupal-recommended-settings/issues",
"docs": "https://docs.acquia.com/drupal-recommended-settings/"
},
"require": {
"php": ">=7.4",
"php": ">=8.1",
"composer-plugin-api": "^2",
"acquia/drupal-environment-detector": "^1.5.3",
"composer/composer": "^2.5",
"consolidation/config": "^1.0.0 || ^2.0.0",
"dflydev/dot-access-data": "^1.1.0 || ^2 || ^3",
"drupal/config_sync_without_site_uuid": "^1.0",
"grasmash/yaml-expander": "^3",
"loophp/phposinfo": "^1.7.1",
"symfony/filesystem": "^6.2",
"symfony/yaml": "^4.4 || ^5 || ^6"
},
"conflict": {
"acquia/blt": "*"
"consolidation/config": "^2.0.0",
"grasmash/yaml-expander": "^3.0",
"loophp/phposinfo": "^1.7.1"
},
"require-dev": {
"acquia/coding-standards": "^1.0",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
"ergebnis/composer-normalize": "~2.15.0",
"phpro/grumphp-shim": "^1.5"
"acquia/coding-standards": "^2.0",
"composer/composer": "^2.2",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"ergebnis/composer-normalize": "^2.30.2",
"phpro/grumphp-shim": "^2.2",
"phpunit/phpunit": "^9 || ^10"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Acquia\\Drupal\\RecommendedSettings\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Acquia\\Drupal\\RecommendedSettings\\Tests\\": "tests/src"
}
},
"config": {
"allow-plugins": {
Expand All @@ -45,16 +55,5 @@
},
"extra": {
"class": "Acquia\\Drupal\\RecommendedSettings\\Plugin"
},
"autoload": {
"psr-4": {
"Acquia\\Drupal\\RecommendedSettings\\": "src/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"support": {
"issues": "https://github.com/acquia/drupal-recommended-settings/issues",
"docs": "https://docs.acquia.com/drupal-recommended-settings/"
}
}
Loading

0 comments on commit 29c517d

Please sign in to comment.