, (*1)
Bene Project
New Projects
Create a Git Repository
Go to github https://github.com/new and create a new repository. The script expects an empty repository. Do not put anything in it or the script will fail., (*2)
Continuous Integration
See the instructions at .circleci/README.md
to configure CircleCI., (*3)
Initial Build
Create a local project (change 'my-bene-project' to the name of your project):, (*4)
composer create-project thinkshout/bene-project --stability dev --no-interaction ~/Sites/my-bene-project
, (*5)
Create an empty database in your environment to install into:, (*6)
mysql -uroot -p -e "create database benesite"
, (*7)
CD into the ~/Sites/my-bene-project
directory, and build your site into your new directory with this command:, (*8)
./scripts/install.sh
, (*9)
There are several prompts along the way with a few things to keep in mind:
- A prompt will ask for the database name later in the process. If the database does not exist, the script will fail. Use the database created above, but be aware that if you choose an existing one, the contents will be cleared out by the script., (*10)
Done! Your output script should verify with a message similar to:, (*11)
Finished installing Bene.
, (*12)
Change directory into ~/Sites/bene-new-project and run, (*13)
drush uli
Existing projects
Initial build (existing repo)
From within your ~/Sites directory run:, (*14)
git clone git@github.com:thinkshout/new-project-name.git
cd new-project-name
composer install
Testing
Test are run automatically on CircleCI, but can be run locally as well with:, (*15)
robo test
Updating the code
Updating the install profile
All work on the profile should occur in web/profiles/bene
. Commit and push changes to that repo. To update the profile
within your project run robo dev:update
from your project, (*16)
Updating contrib modules
With composer require drupal/{module_name}
you can download new dependencies to your
installation., (*17)
composer require drupal/devel:8.*
Applying patches to contrib modules
If you need to apply patches (depending on the project being modified, a pull
request is often a better solution), you can do so with the
composer-patches plugin., (*18)
To add a patch to drupal module "foobar" insert the patches section in the extra
section of composer.json:, (*19)
"extra": {
"patches": {
"drupal/foobar": {
"Patch description": "URL to patch"
}
}
}
Updating Drupal Core
This project will attempt to keep all of your Drupal Core files up-to-date; the
project drupal-composer/drupal-scaffold
is used to ensure that your scaffold files are updated every time drupal/core is
updated. If you customize any of the "scaffolding" files (commonly .htaccess),
you may need to merge conflicts if any of your modfied files are updated in a
new release of Drupal core., (*20)
Follow the steps below to update your core files., (*21)
- Run
composer update drupal/core --with-dependencies
to update Drupal Core and its dependencies.
- Run
git diff
to determine if any of the scaffolding files have changed.
Review the files for any changes and restore any customizations to
.htaccess
or robots.txt
.
- Commit everything all together in a single commit, so
web
will remain in
sync with the core
when checking out branches or running git bisect
.
- In the event that there are non-trivial conflicts in step 2, you may wish
to perform these steps on a branch, and use
git merge
to combine the
updated core files with your customized files. This facilitates the use
of a three-way merge tool such as kdiff3. This setup is not necessary if your changes are simple;
keeping all of your modifications at the beginning or end of the file is a
good strategy to keep merges easy.
Notes
Development set-up
This is a Drupal 8 site built using the robo taskrunner., (*22)
First you need to install composer., (*23)
brew install composer
, (*24)
Next add ./vendor/bin
to your PATH, at the beginning of your PATH variable, if it is not already there (only if not using a new Bene install), (*25)
Check with:
echo $PATH
, (*26)
Update with:
export PATH=./vendor/bin:$PATH
, (*27)
You can also make this change permanent by editing your ~/.zshrc
or ~/.bashrc
file:
export PATH="./vendor/bin:...
, (*28)
Building (automatically done for new repo)
Running the robo configure
command will read the .env.dist, cli arguments and
your local environment (DEFAULT_PRESSFLOW_SETTINGS
) to generate a .env file. This file will be used to set
the database and other standard configuration options. If no database name is provided, the project name and the git branch name will be used. If no profile name is provided, "standard" will be used. Note the argument to pass to robo configure can include: --db-pass; --db-user; --db-name; --db-host; --profile., (*29)
robo configure --profile=bene
# Use an alternate DB password
robo configure --profile=bene --db-pass=<YOUR LOCAL DATABASE PASSWORD>
# Use an alternate DB name
robo configure --profile=bene --db-name=<YOUR DATABASE NAME>
The structure of DEFAULT_PRESSFLOW_SETTINGS
if you want to set it locally is (set by default for new repos):, (*30)
DEFAULT_PRESSFLOW_SETTINGS_={"databases":{"default":{"default":{"driver":"mysql","prefix":"","database":"","username":"root","password":"root","host":"localhost","port":3306}}},"conf":{"pressflow_smart_start":true,"pantheon_binding":null,"pantheon_site_uuid":null,"pantheon_environment":"local","pantheon_tier":"local","pantheon_index_host":"localhost","pantheon_index_port":8983,"redis_client_host":"localhost","redis_client_port":6379,"redis_client_password":"","file_public_path":"sites\/default\/files","file_private_path":"sites\/default\/files\/private","file_directory_path":"site\/default\/files","file_temporary_path":"\/tmp","file_directory_temp":"\/tmp","css_gzip_compression":false,"js_gzip_compression":false,"page_compression":false},"hash_salt":"","config_directory_name":"sites\/default\/config","drupal_hash_salt":""}
Installing (automatically done for new repo)
Running the robo install command will run composer install to add all required
dependencies and then install the site and import the exported configuration., (*31)
robo install