├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── backup ├── build ├── coder ├── composer ├── docs ├── README.md ├── command-backup.md ├── command-build.md ├── command-coder.md ├── command-composer.md ├── command-drush.md ├── command-init.md ├── command-install.md ├── command-reset.md ├── command-restore.md ├── command-upgrade.md ├── config-bin.md ├── config-cleanup.md ├── config-config.md ├── config-drupal-coder.md ├── config-make.md ├── config-modules.md ├── config.md ├── editor.md ├── hooks-helpers.md ├── hooks-variables.md ├── hooks.md ├── img │ ├── hooks-helpers-color-bg-highlight.png │ ├── hooks-helpers-color-bg.png │ ├── hooks-helpers-color-fg-highlight.png │ ├── hooks-helpers-color-fg.png │ ├── hooks-helpers-color-restore.png │ ├── hooks-helpers-markup.png │ ├── hooks-helpers-markup_debug.png │ ├── hooks-helpers-markup_divider.png │ ├── hooks-helpers-markup_error.png │ ├── hooks-helpers-markup_h1.png │ ├── hooks-helpers-markup_h1_divider.png │ ├── hooks-helpers-markup_h1_li.png │ ├── hooks-helpers-markup_h2.png │ ├── hooks-helpers-markup_h3.png │ ├── hooks-helpers-markup_info.png │ ├── hooks-helpers-markup_li.png │ ├── hooks-helpers-markup_li_value.png │ ├── hooks-helpers-markup_success.png │ ├── hooks-helpers-markup_warning.png │ ├── hooks-helpers-message_error.png │ ├── hooks-helpers-message_info.png │ ├── hooks-helpers-message_success.png │ ├── hooks-helpers-message_warning.png │ ├── hooks-helpers-prompt.png │ ├── hooks-helpers-prompt_confirm.png │ ├── hooks-helpers-prompt_confirm_or_exit.png │ └── hooks-helpers-prompt_yn.png ├── project.md ├── quick-start.md └── requirements.md ├── drush ├── init ├── install ├── reset ├── restore ├── src ├── backup.sh ├── backup_sites_default.sh ├── bootstrap.sh ├── build.sh ├── cleanup.sh ├── drupal_coder.sh ├── drupal_install.sh ├── drupal_login.sh ├── drupal_make.sh ├── drupal_modules_disable.sh ├── drupal_modules_enable.sh ├── drupal_upgrade.sh ├── help │ ├── backup_arguments.txt │ ├── backup_description.txt │ ├── backup_examples.txt │ ├── backup_options.txt │ ├── build_arguments.txt │ ├── build_description.txt │ ├── build_examples.txt │ ├── build_options.txt │ ├── coder_arguments.txt │ ├── coder_description.txt │ ├── coder_examples.txt │ ├── coder_extra.sh │ ├── coder_options.txt │ ├── common_hook_info.txt │ ├── common_options.txt │ ├── composer_arguments.txt │ ├── composer_description.txt │ ├── composer_examples.txt │ ├── composer_extra.sh │ ├── composer_options.txt │ ├── drush_arguments.txt │ ├── drush_description.txt │ ├── drush_examples.txt │ ├── drush_extra.sh │ ├── drush_options.txt │ ├── init_arguments.txt │ ├── init_description.txt │ ├── init_examples.txt │ ├── init_options.txt │ ├── install_arguments.txt │ ├── install_description.txt │ ├── install_examples.txt │ ├── install_options.txt │ ├── reset_arguments.txt │ ├── reset_description.txt │ ├── reset_examples.txt │ ├── reset_options.txt │ ├── restore_arguments.txt │ ├── restore_description.txt │ ├── restore_examples.txt │ ├── restore_options.txt │ ├── upgrade_arguments.txt │ ├── upgrade_description.txt │ ├── upgrade_examples.txt │ └── upgrade_options.txt ├── hook_info │ ├── backup.sh │ ├── build.sh │ ├── coder.sh │ ├── composer.sh │ ├── drush.sh │ ├── hook │ │ ├── backup.sh │ │ ├── backup_sites_default.sh │ │ ├── build_package.sh │ │ ├── cleanup.sh │ │ ├── coder.sh │ │ ├── common.sh │ │ ├── composer.sh │ │ ├── drupal_install.sh │ │ ├── drupal_login.sh │ │ ├── drupal_make.sh │ │ ├── drupal_modules_disable.sh │ │ ├── drupal_modules_enable.sh │ │ ├── drupal_upgrade.sh │ │ ├── drush.sh │ │ ├── init_coder.sh │ │ ├── init_composer.sh │ │ ├── init_config.sh │ │ ├── init_custom_commands.sh │ │ ├── init_druleton.sh │ │ ├── init_drush.sh │ │ ├── init_structure.sh │ │ ├── restore.sh │ │ ├── restore_sites_default.sh │ │ ├── script_after.sh │ │ └── script_before.sh │ ├── init.sh │ ├── install.sh │ ├── reset.sh │ ├── restore.sh │ └── upgrade.sh ├── include │ ├── colors.sh │ ├── composer.sh │ ├── drupal.sh │ ├── file.sh │ ├── help.sh │ ├── hook.sh │ ├── markup.sh │ ├── message.sh │ ├── options.sh │ └── prompt.sh ├── init.sh ├── init_coder.sh ├── init_composer.sh ├── init_config.sh ├── init_custom_commands.sh ├── init_druleton.sh ├── init_drush.sh ├── init_structure.sh ├── install.sh ├── reset.sh ├── restore.sh ├── restore_sites_default.sh ├── script.sh ├── script_after.sh ├── script_before.sh └── upgrade.sh ├── templates ├── .editorconfig ├── .gitattributes ├── .gitignore ├── README.md ├── config │ ├── README.md │ ├── backup │ │ └── README.md │ ├── bin │ │ └── README.md │ ├── build │ │ ├── README.md │ │ └── drupal_make_after.sh │ ├── config_example.sh │ ├── drupal_coder.sh │ ├── drupal_make.sh │ ├── drupal_make_dev.sh │ ├── drupal_modules_disable.sh │ ├── drupal_modules_disable_prd.sh │ ├── drupal_modules_enable.sh │ ├── drupal_modules_enable_dev.sh │ ├── init │ │ ├── config_collect.sh │ │ ├── config_confirm.sh │ │ ├── config_load_current.sh │ │ └── config_save.sh │ ├── install │ │ ├── README.md │ │ ├── cleanup.sh │ │ ├── drupal_make_after.sh │ │ ├── drupal_modules_enable_after.sh │ │ └── drupal_modules_enable_after_dev.sh │ ├── make │ │ ├── README.md │ │ ├── _core.make │ │ ├── administration.make │ │ ├── development.make │ │ └── minimal.make │ ├── reset │ │ ├── README.md │ │ ├── cleanup.sh │ │ ├── drupal_modules_enable_after.sh │ │ └── drupal_modules_enable_after_dev.sh │ └── upgrade │ │ ├── README.md │ │ ├── cleanup.sh │ │ └── drupal_make_after.sh └── project │ ├── CHANGELOG.md │ ├── README.md │ ├── libraries │ └── README.md │ ├── modules │ └── README.md │ ├── profiles │ └── README.md │ └── themes │ └── README.md └── upgrade /.gitignore: -------------------------------------------------------------------------------- 1 | # Make sure that we are not versioning symlinked commands. 2 | /* 3 | !/.gitignore 4 | !/docs 5 | !/src 6 | !/templates 7 | !/CHANGELOG.md 8 | !/LICENSE.md 9 | !/README.md 10 | !/backup 11 | !/build 12 | !/coder 13 | !/composer 14 | !/drush 15 | !/init 16 | !/install 17 | !/reset 18 | !/restore 19 | !/upgrade 20 | 21 | # Global ignore patterns. 22 | .DS_Store 23 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 4 | ## [0.4.1] - 2016-01-23 5 | ### Fixed 6 | - #42 : Fixed error while saving a config variable with an /. 7 | 8 | 9 | 10 | ## [0.4.0] - 2016-01-22 11 | ### Changed 12 | - #27 : Moved repository to the druleton organisation and renamed the project. 13 | - #26 : Removed all project specific code from druleton and improve `bin/init`: 14 | - Move the bin directory to the root of the project so it can be included as a 15 | git submodule in druleton powered projects. 16 | - Extended the `bin/init` script so it creates the directory structure for a 17 | new project. 18 | - #25 : Extended the `bin/init` script so it asks for the configuration variables 19 | and writes them to the `config/config.sh` file. 20 | 21 | 22 | 23 | ## [0.3.0] - 2015-12-26 24 | ### Added 25 | - #19 : Added bin/drush command and its documentation. 26 | - #20 : Added bin/init command and its documentation. 27 | - #23 : Install composer locally by running the bin/init command. 28 | - #23 : Install drush locally by running the bin/init command. 29 | - #30 : Add the configuration option to use local or global composer binary. 30 | - #32 : Add support to use drush.phar. 31 | - #34 : Add bin/coder command as a wrapper around the phpcs binary using drupal 32 | coding standards. 33 | - #35 : Add option to force installing 3th party packages (composer, drush, 34 | coder, ...). 35 | 36 | ### Fixed 37 | - Error when there is no hook info available for a specific command. 38 | - Added missing documentation about extending the skeleton command help. 39 | - Added missing help information of wrapped commands like bin/drush and 40 | bin/composer. 41 | - #36 : Fixed missing support for quoted parameters. 42 | 43 | 44 | ## [0.2.0] - 2015-12-02 Documentation 45 | ### Added 46 | - #11 Add documentation : documented the drupal-skeleton, how everything works 47 | and how to extend it. 48 | - bin/build : Added example build hook to copy the project modules & themes. 49 | - bin/src/include : Added file helpers to make it easier to symlink and copy 50 | subdirectories. 51 | - config : Refactored the implemented hooks to symlink and copy project 52 | subdirectories during install, upgrade and build. 53 | - bin/restore : Make sure that the hooks are only called once a backup is 54 | selected to restore from. 55 | - changelog : Moved the skeleton changelog to the bin directory. Added a global 56 | changelog file to be used for the project. 57 | 58 | ### Fixed 59 | - #14 colored markup : each markup function should restore the default color. 60 | - bin/restore : Added the missing backup creation during executing the restore 61 | command. 62 | - bin/upgrade : Added the missing cleanup step to the upgrade command. 63 | 64 | 65 | 66 | ## [0.1.2] - 2015-10-30 67 | ### Fixed 68 | - #9 Added missing `bin/backup` and `bin/build` scripts. 69 | 70 | 71 | 72 | ## [0.1.1] - 2015-10-30 73 | ### Added 74 | - #6 drupal_install.sh : Add more verbose info about the install arguments. 75 | 76 | ### Fixed 77 | - #3 backup.sh : Wrong comparison in backup script 78 | 79 | 80 | 81 | ## [0.1.0] - 2015-10-30 Initial release 82 | ### Added 83 | - Working skeleton. 84 | - Basic documentation. 85 | 86 | 87 | 88 | [1.x.x]: https://github.com/zero2one/drupal-skeleton/compare/master...develop 89 | [0.4.1]: https://github.com/druleton/druleton/compare/0.4.0...0.4.1 90 | [0.4.0]: https://github.com/druleton/druleton/compare/0.3.0...0.4.0 91 | [0.3.0]: https://github.com/druleton/druleton/compare/0.2.0...0.3.0 92 | [0.2.0]: https://github.com/druleton/druleton/compare/0.1.1...0.2.0 93 | [0.1.2]: https://github.com/druleton/druleton/compare/0.1.1...0.1.2 94 | [0.1.1]: https://github.com/druleton/druleton/compare/0.1.0...0.1.1 95 | [0.1.0]: https://github.com/druleton/druleton/releases/tag/0.1.0 96 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Peter Decuyper 4 | 5 | > Permission is hereby granted, free of charge, to any person obtaining a copy 6 | > of this software and associated documentation files (the "Software"), to deal 7 | > in the Software without restriction, including without limitation the rights 8 | > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | > copies of the Software, and to permit persons to whom the Software is 10 | > furnished to do so, subject to the following conditions: 11 | > 12 | > The above copyright notice and this permission notice shall be included in 13 | > all copies or substantial portions of the Software. 14 | > 15 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | > THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /backup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script to backup a working Drupal installation. 5 | # 6 | # This will backup: 7 | # - The database. 8 | # - The /web directory. 9 | # 10 | # The code in /project will not be included in the backup. 11 | # 12 | # ! Do not change this file ! 13 | # All configuration is in the config directory 14 | ################################################################################ 15 | 16 | 17 | # Bootstrap the script. 18 | source $(dirname $0)/src/bootstrap.sh 19 | 20 | # Includes. 21 | source "$DIR_SRC/script.sh" 22 | source "$DIR_SRC/backup.sh" 23 | source "$DIR_SRC/script_after.sh" 24 | 25 | # Pre script. 26 | backup_init 27 | backup_info 28 | prompt_confirm_or_exit 29 | 30 | # START Script ----------------------------------------------------------------- 31 | script_before_run 32 | backup_run 33 | script_after_run 34 | # END Script ------------------------------------------------------------------- 35 | 36 | # Done. 37 | exit 0 38 | -------------------------------------------------------------------------------- /build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script to build the web directory ready for deployment. 5 | # 6 | # ! Do not change this file ! 7 | # All configuration is in the config directory 8 | ################################################################################ 9 | 10 | 11 | # Bootstrap the script. 12 | source $(dirname $0)/src/bootstrap.sh 13 | 14 | # Includes. 15 | source "$DIR_SRC/script.sh" 16 | source "$DIR_SRC/build.sh" 17 | source "$DIR_SRC/drupal_make.sh" 18 | 19 | # Pre script. 20 | build_info 21 | prompt_confirm_or_exit 22 | 23 | # START Script ----------------------------------------------------------------- 24 | script_before_run 25 | build_check_directory 26 | build_drupal_make 27 | build_package_run 28 | script_after_run 29 | # END Script ------------------------------------------------------------------- 30 | 31 | # Finish message. 32 | build_finished 33 | 34 | # End. 35 | exit 0 36 | -------------------------------------------------------------------------------- /coder: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script that is as a wrapper around the phpcs tool with drupal code standards. 5 | # 6 | # ! Do not change this file ! 7 | # All configuration is in the config directory 8 | ################################################################################ 9 | 10 | 11 | # Bootstrap the script. 12 | source $(dirname $0)/src/bootstrap.sh 13 | 14 | # Include resources. 15 | source "$DIR_SRC/drupal_coder.sh" 16 | 17 | # START Script ----------------------------------------------------------------- 18 | 19 | markup_debug 20 | markup_debug "Start : $(date '+%Y-%m-%d %H:%M:%S')" 21 | markup_debug 22 | 23 | # Create the global $CODER_OPTIONS array. 24 | drupal_coder_filter_options 25 | 26 | # By default run the code inspections on the directories in config file. 27 | if [ -z "$SCRIPT_ARGUMENT" ]; then 28 | drupal_coder_run_all "${CODER_OPTIONS[@]}" 29 | else 30 | drupal_coder_run "${CODER_OPTIONS[@]}" 31 | fi 32 | 33 | markup_debug 34 | markup_debug "Coder params : $coder_params" 35 | 36 | markup "${GREY}Finished : $(date '+%Y-%m-%d %H:%M:%S')" 37 | echo 38 | 39 | # END Script ------------------------------------------------------------------- 40 | 41 | # End. 42 | exit 0 43 | -------------------------------------------------------------------------------- /composer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script that acts as a wrapper around the composer cli tool. 5 | # 6 | # ! Do not change this file ! 7 | # All configuration is in the config directory 8 | ################################################################################ 9 | 10 | 11 | # Bootstrap the script. 12 | source $(dirname $0)/src/bootstrap.sh 13 | 14 | # START Script ----------------------------------------------------------------- 15 | 16 | markup_debug 17 | markup_debug "Start : $(date '+%Y-%m-%d %H:%M:%S')" 18 | markup_debug 19 | 20 | # Create the global $COMPOSER_OPTIONS array. 21 | composer_filter_options 22 | 23 | composer_run "${COMPOSER_OPTIONS[@]}" 24 | 25 | markup_debug 26 | composer_binary_in_use="local" 27 | 28 | if [ "$COMPOSER_USE_GLOBAL" = "1" ]; then 29 | composer_binary_in_use="global" 30 | fi 31 | markup_debug "Composer binary used : $composer_binary_in_use" 32 | markup_debug "Composer params : $composer_params" 33 | 34 | markup "${GREY}Finished : $(date '+%Y-%m-%d %H:%M:%S')" 35 | echo 36 | 37 | # END Script ------------------------------------------------------------------- 38 | 39 | # End. 40 | exit 0 41 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Druleton documentation 2 | 3 | Overview of all druleton documentation: 4 | 5 | 6 | ## Quick Start 7 | - [Quick start](quick-start.md) : Short guide to get you started within minutes. 8 | 9 | 10 | ## Requirements 11 | - [Requirements](requirements.md) : Minimal requirements to use druleton. 12 | 13 | 14 | ## Commands 15 | - [bin/init](command-init.md) : Setup the druleton environment. 16 | - [bin/install](command-install.md) : Install the project. 17 | - [bin/reset](command-reset.md) : Reset an existing project back to the 18 | fresh-installed state. 19 | - [bin/upgrade](command-upgrade.md) : Upgrade an existing project by downloading 20 | core & contributed as defined in the make files, and update drupal by running 21 | `drush updb` command afterwards. 22 | - [bin/build](command-build.md) : Create a package of the project ready to be 23 | deployed on production. 24 | - [bin/backup](command-backup.md) : Create a backup of the installed project. 25 | - [bin/restore](command-restore.md) : Restore one of the backups. 26 | - [bin/composer](command-composer.md) : A wrapper around a globally installed or 27 | local copy of the composer binary. 28 | - [bin/drush](command-drush.md) : Run a drush command within the `web` 29 | directory. 30 | - [bin/coder](command-coder.md) : Wrapper around the phpcs (PHP Code Sniffer) 31 | binary. It has the proper default settings for the Drupal standards. 32 | 33 | Commands installed during the init command: 34 | - [bin/...](config-bin.md) : Any custom command as defined in the `config/bin` 35 | directory. 36 | 37 | 38 | ## Configuration 39 | - [config](config.md) : The structure of the `config` directory. 40 | - [config.sh](config-config.md) : The global configuration file. 41 | - [make files](config-make.md) : How to add contrib modules, themes and 42 | libraries using the make file configuration. 43 | - [modules](config-modules.md) : Enable and Disable modules during install and 44 | reset. 45 | - [cleanup](config-cleanup.md) : Delete directories and files when the `web` 46 | directory is (re)built. 47 | - [custom commands](config-bin.md) : Add custom commands to the `config/bin` so 48 | `bin/init` command can detect them and add them to the `bin` directory. 49 | - [coder](config-drupal-coder.md) : Configuration for the `config/coder` 50 | command. 51 | 52 | 53 | ## Hooks 54 | - [hook system](hooks.md) : More information about the hook system: add 55 | your own script steps before and/or after the existing command steps. 56 | - [hook helpers](hooks-helpers.md) : Overview of all helper functions that can 57 | be used when writing hooks. 58 | - [predefined variables](hooks-variables.md) : Overview of all variables that 59 | can be accessed and used when writing hooks. 60 | 61 | 62 | ## Project 63 | - [project](project.md) : Add custom install profiles, modules, themes and 64 | libraries to the project. 65 | 66 | 67 | ## Editor (IDE) 68 | - [Editor setup](editor.md) : Info how to setup your editor (IDE). 69 | -------------------------------------------------------------------------------- /docs/command-backup.md: -------------------------------------------------------------------------------- 1 | # bin/backup command 2 | The `bin/backup` command will take a backup of the web directory and the 3 | database. The backup will be stored in the `backup` directory. 4 | 5 | You can limit the backup to only the `web` or `web/default/files` directory or 6 | only the database by passing them as arguments. 7 | 8 | ```bash 9 | $ bin/backup 10 | ``` 11 | 12 | 13 | 14 | ## What does this command do? 15 | This command has only one task: taking a backup of the currently installed 16 | platform. By default a backup of the full `web` directory and the database will 17 | be taken. 18 | 19 | You can limit what should be included in the backup by combining following 20 | command options: 21 | 22 | - --only-db : Backup only the database. 23 | - --only-files : Backup only the `web/sites/default/files` directory. 24 | - --only-web : Backup only the `web` directory. 25 | 26 | 27 | 28 | ## Command options 29 | Command options documentation can be viewed in the command line interface by 30 | running the command with the `-h` or `--help` option. 31 | 32 | ```bash 33 | $ bin/backup -h 34 | ``` 35 | 36 | #### Arguments 37 | There is only one argument for the backup script: the name of the directory 38 | within the backup directory where the backup files should be stored. The current 39 | timestamp will be used if no argument is passed. 40 | 41 | #### Options 42 | - --only-db : Backup only the database. 43 | - --only-files : Backup only the `web/sites/default/files` directory. 44 | - --only-web : Backup only the `web` directory. 45 | - --env=\ : The environment to run the script for (default : dev). 46 | - --help (-h) : Show the command help. 47 | - --hook-info : Show information about the available hooks. 48 | - --no-color : Disable all colored output. 49 | - --confirm (-y) : Skip the confirmation step when the script starts. 50 | - --verbose (-v) : Verbose, show extra information while running the command. 51 | 52 | 53 | ## Command hooks 54 | Each step in the scipt triggers "hooks". These hooks allow you to add extra 55 | steps in between the install script without having to alter (hack) the 56 | `bin/backup` script as defined in druleton. 57 | 58 | See [more info about the hook system][link-hooks]. 59 | 60 | The hooks for the `bin/backup` command should be located in the 61 | `config/backup` directory. 62 | 63 | The following hooks are supported (in the order as they will be included): 64 | 65 | 66 | #### config/backup/script_before(_\).sh 67 | This hook is included and run before the script will run its first step. 68 | 69 | #### config/backup/backup_before(_\).sh 70 | This hook is included and run before a backup is created. 71 | 72 | Warning: this script will be not included if no backup can be taken (e.g. 73 | when there is no working environment to backup from). 74 | 75 | #### config/backup/backup_after(_\).sh 76 | This hook is included and run after a backup is created. 77 | 78 | Warning: this script will be not included if no backup can be taken (e.g. 79 | when there is no working environment to backup from). 80 | 81 | #### config/backup/script_after(_\).sh 82 | This hook is included and run when the script is finished. 83 | 84 | 85 | 86 | [Back to overview][link-overview] 87 | 88 | 89 | 90 | [link-hooks]: hooks.md 91 | 92 | [link-overview]: README.md 93 | -------------------------------------------------------------------------------- /docs/command-build.md: -------------------------------------------------------------------------------- 1 | # bin/build command 2 | The `bin/build` command will create a deployment package (code) in the `/build` 3 | directory. 4 | 5 | ```bash 6 | $ bin/build 7 | ``` 8 | 9 | 10 | 11 | ## What does this command do? 12 | The command will perform following script steps: 13 | 14 | #### 1. Make 15 | Drupal core, contributed modules, themes and libraries will be downloaded and 16 | unpacked in the `build/web` directory as defined in the 17 | [make file(s)][link-config-make]. 18 | 19 | #### 2. Create package 20 | The build in the `build/web` directory will be packed in an archive file 21 | (tar.gz). 22 | 23 | If no package name is given, an unique name will be created using: 24 | 25 | - The site name (`$SITE_NAME`) as defined in the 26 | [config file][link-config-config]. 27 | - The date + time stamp when the package was build. 28 | 29 | Example: 30 | 31 | ``` 32 | druleton-20151107_110452.tar.gz 33 | ``` 34 | 35 | 36 | 37 | ## Command options 38 | Command options documentation can be viewed in the command line interface by 39 | running the command with the `-h` or `--help` option. 40 | 41 | ```bash 42 | $ bin/build -h 43 | ``` 44 | 45 | #### Arguments 46 | This script has only one (optional) argument: the name for the package without 47 | the extension. Example: "my_site_v1.0" will become "my_site_v1.0.tar.gz". 48 | If no package name is given, an unique name will be created using the site_name 49 | as defined in the config file and the date-time stamp when the package was 50 | created. 51 | 52 | #### Options 53 | - --no-package : Do not compress the package once build. 54 | - --env=\ : The environment to run the script for (default : dev). 55 | - --help (-h) : Show the command help. 56 | - --hook-info : Show information about the available hooks. 57 | - --no-color : Disable all colored output. 58 | - --confirm (-y) : Skip the confirmation step when the script starts. 59 | - --verbose (-v) : Verbose, show extra information while running the command. 60 | 61 | 62 | 63 | ## Command hooks 64 | Each step in the scipt triggers "hooks". These hooks allow you to add extra 65 | steps in between the build script without having to alter (hack) the 66 | `bin/build` script as defined in druleton. 67 | 68 | See [more info about the hook system][link-hooks]. 69 | 70 | The hooks for the `bin/build` command should be located in the 71 | `config/build` directory. 72 | 73 | The following hooks are supported (in the order as they will be included): 74 | 75 | 76 | #### config/build/script_before(_\).sh 77 | This hook is included and run before the script will run its first step. 78 | 79 | #### config/build/drupal_make_before(_\).sh 80 | This hook is included and run before the make files are processed, downloaded 81 | and unpacked. 82 | 83 | #### config/build/drupal_make_after(_\).sh 84 | This hook is included and run after the make files are processed, downloaded 85 | and unpacked. 86 | 87 | > **Tip**: This is the proper hook to copy the custom functionality from the 88 | > `project` directory into the build. Without this copy, the custom logic will 89 | > not be included in the package. 90 | 91 | #### config/build/build_package_before(_\).sh 92 | This hook is included and run before the package is created. 93 | 94 | #### config/build/build_package_after(_\).sh 95 | This hook is included and run after the package is created. 96 | 97 | #### config/build/script_after(_\).sh 98 | This hook is included and run when the script is finished. 99 | 100 | 101 | 102 | [Back to overview][link-overview] 103 | 104 | 105 | 106 | [link-config-config]: config-config.md 107 | [link-config-make]: config-make.md 108 | [link-hooks]: hooks.md 109 | 110 | [link-overview]: README.md 111 | -------------------------------------------------------------------------------- /docs/command-coder.md: -------------------------------------------------------------------------------- 1 | # bin/coder command 2 | The coder command is a wrapper around the [phpcs][link-phpcs] (PHP Code Sniffer) 3 | binary. 4 | 5 | ```bash 6 | $ bin/coder 7 | ``` 8 | 9 | 10 | 11 | ## What does this command do? 12 | This command uses [phpcs][link-phpcs] and the Drupal coding standards as 13 | provided by the [drupal/coder][link-drupal-coder] project to inspect files and 14 | directories if they don't contain code style violations. 15 | 16 | It will by default do a code inspection on all directories as defined in the 17 | [`$CODER_DIRECTORIES`][link-config-drupal-coder-directories] variable in the 18 | [`config/drupal_coder.sh`][link-config-drupal-coder] configuration file. 19 | 20 | It provides the option to configure 21 | [extensions to scan][link-config-drupal-coder-extensions] and 22 | [ignore patterns][link-config-drupal-coder-ignore] in the 23 | [`config/drupal_coder.sh`][link-config-drupal-coder] configuration file. 24 | 25 | 26 | 27 | ## Command options 28 | Command options documentation can be viewed in the command line interface by 29 | running the command with the `-h` or `--help` option. 30 | 31 | ```bash 32 | $ bin/coder -h 33 | ``` 34 | 35 | #### Arguments 36 | All arguments will be passed to the phpcs command. Use this as calling phpcs 37 | directly. See the [phpcs documentation][link-phpcs-doc]. 38 | 39 | #### Options 40 | - --help (-h) : Show the command help. 41 | - --hook-info : Show information about the available hooks. 42 | - --no-color : Disable all colored output. 43 | - --confirm (-y) : Skip the confirmation step when the script starts. 44 | - --verbose (-v) : Verbose, show extra information while running the command. 45 | 46 | 47 | ## Command hooks 48 | The `bin/coder` command does not support hooks. 49 | 50 | 51 | 52 | [Back to overview][link-overview] 53 | 54 | [link-config-drupal-coder]: config-drupal-coder.md 55 | [link-config-drupal-coder-directories]: config-drupal-coder.md#directories 56 | [link-config-drupal-coder-extensions]: config-drupal-coder.md#extensions 57 | [link-config-drupal-coder-ignore]: config-drupal-coder.md#ignore 58 | [link-drupal-coder]: https://www.drupal.org/project/coder 59 | [link-phpcs]: https://github.com/squizlabs/PHP_CodeSniffer 60 | [link-phpcs-doc]: https://github.com/squizlabs/PHP_CodeSniffer/wiki 61 | 62 | 63 | [link-overview]: README.md 64 | -------------------------------------------------------------------------------- /docs/command-composer.md: -------------------------------------------------------------------------------- 1 | # bin/composer command 2 | The `bin/composer` command is a wrapper around the 3 | [composer binary][link-composer]. It allows to use a globally installed composer 4 | or a locally copy. 5 | 6 | What composer binary to use is defined in the `config/config.sh` file using the 7 | [`$COMPOSER_USE_GLOBAL`][link-config-config-composer] variable. 8 | 9 | ```bash 10 | $ bin/composer 11 | ``` 12 | 13 | 14 | 15 | ## What does this command do? 16 | This command has only one task: running composer and pass all arguments as used 17 | when the `bin/composer` command is called. 18 | 19 | 20 | 21 | ## Command options 22 | Command options documentation can be viewed in the command line interface by 23 | running the command with the `-h` or `--help` option. 24 | 25 | ```bash 26 | $ bin/composer -h 27 | ``` 28 | 29 | #### Arguments 30 | All arguments will be passed to the composer command. Use this as calling 31 | composer directly. See the [composer documentation][link-composer]. 32 | 33 | #### Options 34 | - --help (-h) : Show the command help. 35 | - --hook-info : Show information about the available hooks. 36 | - --no-color : Disable all colored output. 37 | - --confirm (-y) : Skip the confirmation step when the script starts. 38 | - --verbose (-v) : Verbose, show extra information while running the command. 39 | 40 | 41 | 42 | ## Command hooks 43 | The `bin/composer` command does not support hooks. 44 | 45 | 46 | 47 | [Back to overview][link-overview] 48 | 49 | 50 | 51 | [link-composer]: https://getcomposer.org/ 52 | [link-config-config-composer]: config-config.md#composer 53 | 54 | [link-overview]: README.md 55 | -------------------------------------------------------------------------------- /docs/command-drush.md: -------------------------------------------------------------------------------- 1 | # bin/drush command 2 | The `bin/drush` command is a wrapper around the drush command. It allows to run 3 | drush commands from within the root of the project. 4 | 5 | ```bash 6 | $ bin/drush 7 | ``` 8 | 9 | 10 | 11 | ## What does this command do? 12 | This command has only one task: running drush within the `web` directory and 13 | pass all arguments as used when the `bin/drush` command is called. 14 | 15 | 16 | 17 | ## Command options 18 | Command options documentation can be viewed in the command line interface by 19 | running the command with the `-h` or `--help` option. 20 | 21 | ```bash 22 | $ bin/drush -h 23 | ``` 24 | 25 | #### Arguments 26 | All arguments will be passed to the drush command. Use this as calling drush 27 | directly. See the [drush documentation][link-drush]. 28 | 29 | #### Options 30 | - --help (-h) : Show the command help. 31 | - --hook-info : Show information about the available hooks. 32 | - --no-color : Disable all colored output. 33 | - --confirm (-y) : Skip the confirmation step when the script starts. 34 | - --verbose (-v) : Verbose, show extra information while running the command. 35 | 36 | 37 | ## Command hooks 38 | The `bin/drush` command does not support hooks. 39 | 40 | 41 | 42 | [Back to overview][link-overview] 43 | 44 | 45 | 46 | [link-drush]: https://github.com/drush-ops/drush 47 | 48 | [link-overview]: README.md 49 | -------------------------------------------------------------------------------- /docs/config-cleanup.md: -------------------------------------------------------------------------------- 1 | # Cleanup 2 | When a `bin/install` or `bin/upgrade` command is run, a cleanup step is 3 | included. 4 | 5 | This cleanup deletes the directories and/or files that will be recreated during 6 | the command run. Example: remove the `web` directory before the command 7 | recreates it by processing the make files. 8 | 9 | Define what directories and/or files by adding them to the `CLEANUP_DIRECTORIES` 10 | and/or `CLEANUP_FILES` arrays in the `config/install/cleanup.sh` and/or 11 | `config/upgrade/cleanup.sh` files. 12 | 13 | You can use the [path variables][link-hooks-variables] to prefix the paths. 14 | 15 | Example: 16 | ```bash 17 | # Files to be deleted before the script is run. 18 | CLEANUP_FILES=( 19 | "$DIR_WEB/sites/default/settings.php" 20 | ) 21 | 22 | # Directories to be deleted before the script is run. 23 | CLEANUP_DIRECTORIES=( 24 | "$DIR_WEB" 25 | ) 26 | ``` 27 | 28 | > **Note** : The files are deleted before the directories. 29 | 30 | It is possible to define another set per environment by implementing the config 31 | file with an environment suffix: 32 | 33 | - `config/install/cleanup.sh` : General cleanup configuration, will be processed 34 | for all environments. 35 | - `config/install/cleanup_dev.sh` : Will only be processed if the environment is 36 | *dev*. 37 | 38 | > **Note** : The general file will be processed before the environment specific 39 | one. 40 | 41 | 42 | 43 | [Back to overview][link-overview] 44 | 45 | 46 | 47 | [link-hooks-variables]: hooks-variables.md 48 | 49 | [link-overview]: README.md 50 | -------------------------------------------------------------------------------- /docs/config-config.md: -------------------------------------------------------------------------------- 1 | # config.sh 2 | The `config.sh` file contains the global configuration for the project. It is 3 | specific for the environment where the scripts are run (eg. local development, 4 | test, acceptance, production, ...). 5 | 6 | > **Warning** : Don't include this file in the versioning system as it is 7 | > environment specific! 8 | 9 | Use the `config_example.sh` script to give an example of the expected 10 | configuration variables. 11 | 12 | **This is the only required file within the `config` directory.** 13 | 14 | The config file contains by default a minimal set of configuration variables. 15 | Feel free to add your own extra variables as required by the implemented 16 | [command hooks][link-hooks]. 17 | 18 | 19 | 20 | ## Default configuration variables 21 | The default config file contains following variables: 22 | 23 | 24 | #### Site information 25 | Information about the platform: 26 | 27 | - **SITE_NAME** : The name of the site that will be installed. This name will be 28 | used in the output of the commands as well as settings the drupal site name 29 | when the platform is installed (`$SITE_NAME`). 30 | - **SITE_URL** : The URL where the platform can be accessed after installation. 31 | This is used by the login step in the commands to open a browser and login to 32 | the platform (`$SITE_URL`). 33 | - **SITE_PROFILE** : The drupal install profile to use when installing the 34 | platform. This is by default the *standard* profile (`$SITE_PROFILE`). 35 | 36 | 37 | #### Database specific variables 38 | A drupal installation requires a database, set the database connection 39 | parameters in the `config.sh` file. 40 | 41 | > **Noot** : the script will not create the database for you, add it manually 42 | > to the database server. 43 | 44 | - **DB_HOST** : The database hostname or IP address (`$DB_HOST`). 45 | - **DB_USER** : The database username (`$DB_USER`). 46 | - **DB_PASS** : The database password (`$DB_PASS`). 47 | - **DB_NAME** : The database name (`$DB_NAME`). 48 | 49 | 50 | #### The administration account 51 | When a new installation is run, an administration account is created using the 52 | credentials from the config file: 53 | 54 | - **ACCOUNT_NAME** : The administration account (login) name (`$ACCOUNT_NAME`). 55 | - **ACCOUNT_PASS** : Tha administration account password (`$ACCOUNT_PASS`). 56 | - **ACCOUNT_MAIL** : The email address of the administration account 57 | (`$ACCOUNT_MAIL`). This is by default created using the account name and the 58 | site url (`$ACCOUNT_NAME@$SITE_URL`). 59 | 60 | 61 | #### Composer 62 | Druleton will, by default, download and install composer locally. The 63 | `COMPOSER_USE_GLOBAL` variable allows forcing druleton to use the globally 64 | install composer instead. 65 | 66 | - **COMPOSER_USE_GLOBAL=0** : Download the composer binary locally and use that 67 | to run composer commands. 68 | - **COMPOSER_USE_GLOBAL=1** : Use the globally installed composer binary. 69 | 70 | > Note : The default is to download and install composer locally. 71 | 72 | 73 | #### Drush version 74 | Druleton provides the option to use a globally installed drush command or to 75 | install a local version. This is defined by the `$DRUSH_VERSION` variable. 76 | 77 | The options are: 78 | 79 | - **DRUSH_VERSION="phar"** : Download and use drush.phar as drush binary. 80 | - **DRUSH_VERSION="global"** : Use the globally installed drush command. 81 | - **DRUSH_VERSION="branch or tag name"** : Download a local drush command, use 82 | the [branch or tag][link-drush] to determine what version to download. 83 | 84 | > Note : The default is to download and use the drush.phar binary. 85 | 86 | 87 | #### Coder 88 | drupal/coder code standards and all its dependencies (eg. phpcs) are by default 89 | installed when the `bin/init` command is called. This is not required for every 90 | environment. The installation can be disabled: 91 | 92 | - **CODER_DISABLED=1** : Disable the installation of `drupal/coder`. 93 | 94 | 95 | 96 | ## Example config file 97 | 98 | ``` 99 | # The name of the site. 100 | SITE_NAME="Druleton" 101 | 102 | # URL where the site is hosted. 103 | SITE_URL="druleton.sg" 104 | 105 | # The install profile that shouls be installed. 106 | SITE_PROFILE="standard" 107 | 108 | # Database connection parameters. 109 | DB_USER="localuser" 110 | DB_PASS="localpass" 111 | DB_NAME="druleton" 112 | DB_HOST="localhost" 113 | 114 | # Administrator account (user 1). 115 | ACCOUNT_NAME="admin" 116 | ACCOUNT_PASS="drupal" 117 | ACCOUNT_MAIL="$ACCOUNT_NAME@$SITE_URL" 118 | 119 | # Use global composer 120 | COMPOSER_USE_GLOBAL=1 121 | 122 | # Drush version. 123 | DRUSH_VERSION="dev-master" 124 | 125 | # Disable installing drupal/coder 126 | CODER_DISABLED=1 127 | ``` 128 | 129 | 130 | 131 | [Back to overview][link-overview] 132 | 133 | 134 | 135 | [link-hooks]: hooks.md 136 | [link-drush]: https://github.com/drush-ops/drush 137 | 138 | [link-overview]: README.md 139 | -------------------------------------------------------------------------------- /docs/config-drupal-coder.md: -------------------------------------------------------------------------------- 1 | # Coder configuration 2 | When running code sniffer (phpcs) by using the bin/coder wrapper command default 3 | settings are passed to it to force Drupal standards. 4 | 5 | The `config/drupal_coder.sh` file contains the configuration for the command. 6 | 7 | 8 | 9 | ## Extensions 10 | By default, PHP_CodeSniffer will check any file it finds with a .inc, .php, .js 11 | or .css extension. Drupal (< v8) uses non-standard file extensions like .install 12 | and .module. 13 | 14 | Add an array of extensions to the `$CODER_EXTENSIONS` variable to set what 15 | drupal specific files should be scanned. 16 | 17 | Example: 18 | 19 | ```bash 20 | # File extensions to include in the code inspections. 21 | CODER_EXTENSIONS=( 22 | css 23 | inc 24 | info 25 | install 26 | js 27 | md 28 | module 29 | php 30 | profile 31 | test 32 | theme 33 | txt 34 | ) 35 | ``` 36 | 37 | > Note: these are fallback extensions in case no custom extensions are set when 38 | > running the `bin/coder` command. 39 | 40 | Example to run the command with custom extensions: 41 | 42 | ```bash 43 | $ bin/coder --extensions=php,install,module,inc 44 | ``` 45 | 46 | 47 | 48 | ## Ignore 49 | Some code can be generated (like features). That code is not always as defined 50 | in the Drupal code standards. 51 | 52 | Add an array of ignore patterns to the `$CODER_IGNORE` variable to exclude 53 | specific files. 54 | 55 | Example: 56 | 57 | ```bash 58 | # Ignore patterns to exclude specific files from the code inspections. 59 | CODER_IGNORE=( 60 | # Code generated by exporting features. 61 | "*.context.inc" 62 | "*.ds.inc" 63 | "*.facetapi_defaults.inc" 64 | "*.features.inc" 65 | "*.features.*.inc" 66 | "*.field_group.inc" 67 | "*.file_default_displays.inc" 68 | "*.pages.inc" 69 | "*.pages_default.inc" 70 | "*.strongarm.inc" 71 | "*.views_default.inc" 72 | # 3th party javascript libraries. 73 | "ckeditor-plugins" 74 | # Builders (npm, grunt, gulp, bower,... related files). 75 | "dist" 76 | "node_modules" 77 | "bower_components" 78 | ) 79 | ``` 80 | 81 | > Note: these are fallback patterns in case no custom patterns are set when 82 | > running the `bin/coder` command. 83 | 84 | Example to run the command with custom ignore patterns: 85 | 86 | ```bash 87 | $ bin/coder --ignore=*.context.inc,*.features.inc 88 | ``` 89 | 90 | 91 | 92 | ## Directories 93 | PHP_CodeSniffer runs by default recursive in all directories from the directory 94 | where the method is called. 95 | 96 | The `bin/coder` command will only run without a path if an array of directories 97 | and/or files is defined in the `$CODER_DIRECTORIES` variable. 98 | 99 | If the number of code (modules/themes) in a directory is to big, the PHP memory 100 | limit can be reached. A workaround is to specify the paths separately in the 101 | config array as each entry will be inspected in a separate code inspection 102 | call. 103 | 104 | Example: 105 | 106 | ```bash 107 | # Directories to scan and perform code inspections on. 108 | CODER_DIRECTORIES=( 109 | "$DIR_PROJECT/profiles" 110 | "$DIR_PROJECT/modules" 111 | "$DIR_PROJECT/themes" 112 | ) 113 | ``` 114 | 115 | > Note: These directories are only scanned as long as no argument is passed to 116 | > the command. 117 | 118 | This will run code sniffer on all directories and files as defined in the 119 | `$CODER_DIRECTORIES` variable: 120 | 121 | ```bash 122 | $ bin/coder 123 | ``` 124 | 125 | This will run code sniffer only on the provided path: 126 | 127 | ```bash 128 | $ bin/coder project/modules/module_name 129 | ``` 130 | 131 | 132 | 133 | [Back to overview][link-overview] 134 | 135 | 136 | 137 | [link-overview]: README.md 138 | -------------------------------------------------------------------------------- /docs/config-make.md: -------------------------------------------------------------------------------- 1 | # Make file(s) 2 | Druleton uses drush make files to download and extract the Drupal 3 | Core, contributed modules and themes as well as 3th party libraries. 4 | 5 | [Read more about drush make files][link-drush-make]. 6 | 7 | The make file configuration is build around 2 parts: 8 | 9 | 1. Make files in the `config/make` directory to group modules to download for 10 | specific functionality in make bundles. 11 | 2. Make configuration arrays (`config/drupal_make.sh`, 12 | `config/drupal_make_\`) defining what make files should be used to 13 | download the dependencies. 14 | 15 | Using make files gives us the advantage that we can: 16 | 17 | - Define what version of a module/theme we want to use. 18 | - Define what (optional) patches need to be applied to the downloaded module or 19 | theme. 20 | 21 | 22 | 23 | ## The `config/make` directory 24 | This directory contains multiple `.make` files. By bundeling modules that 25 | provide together required functionality makes it easier to reuse these files in 26 | multiple projects. 27 | 28 | Examples: 29 | - A make file containing all modules and 3th party libraries to add a WYSIWYG 30 | editor to the platform (ckeditor module, ckeditor javascript library). 31 | - A make file containing all modules and 3th party libraries to support media 32 | management (media, media_youtube, the dependencies for the media modules, 33 | the plupload javascript library, integration with the WYSIWYG editor, ...). 34 | 35 | 36 | #### Make file structure 37 | Each file should start by defining the Drupal version to download for followed 38 | with a short description what kind of functionality it will add. 39 | 40 | List then for each module and or theme the version you want followed with the 41 | directory (within the `sites/all` directory) where the module or theme should be 42 | saved. 43 | 44 | The path will be automatically prefixed with the type of download: 45 | - For a module with subdir = contrib set : the module will be extracted to 46 | `web/sites/all/modules/contrib/MODULE_NAME`. 47 | - For a theme with subdir = contrib set : the theme will be extracted to 48 | `web/sites/all/theme/contrib/THEME_NAME`. 49 | 50 | [See the make file syntax for further info][link-drush-make]. 51 | 52 | Example of a make file called `config/make/administration.make`. 53 | 54 | ```php 55 | core = 7.x 56 | api = 2 57 | 58 | ; Modules to make the life of a Drupal admin more pleasant. 59 | 60 | projects[admin_menu][subdir] = "contrib" 61 | projects[admin_menu][version] = "3.0-rc5" 62 | 63 | projects[admin_views][subdir] = "contrib" 64 | projects[admin_views][version] = "1.5" 65 | ... 66 | 67 | ... 68 | ; Themes to upgrade the admin backend. 69 | 70 | projects[adminimal_theme][subdir] = "contrib" 71 | projects[adminimal_theme][version] = "1.22" 72 | projects[adminimal_theme][type] = "theme" 73 | ``` 74 | 75 | 76 | #### _core.make 77 | There is one file that is required for the platform and that is the 78 | `config/make/_core.make` file. 79 | 80 | This one will be used to determine what Drupal core should be downloaded and 81 | what (optional) patches should be applied to it. 82 | 83 | > **Note** : do not add any modules to this make file, use the make bundle files 84 | for it. 85 | 86 | Example file: 87 | 88 | ```php 89 | core = 7.x 90 | api = 2 91 | 92 | projects[drupal][version] = "7.39" 93 | ``` 94 | 95 | 96 | #### Upgrade core and modules 97 | To upgrade a working platform: 98 | 99 | - Update the version number in the make file for the core, module or theme you 100 | want to upgrade or define what patches that should be applied to them. 101 | - Run the `bin/upgrade` command to download the versions as defined and apply 102 | the patches. 103 | 104 | 105 | 106 | ## The make configuration file(s) 107 | The `config` directory contains one `drupal_make.sh` config array and optionally 108 | environment specific config arrays (eg. `drupal_make_dev.sh`, 109 | `drupal_make_prod.sh`). 110 | 111 | These files list, in an array, what make file bundles from the `config/make` 112 | directory should be used during the make step in the install and upgrade 113 | commands. Do not include the `config/make/_core.make` file in these arrays as 114 | that make file will always be run first. 115 | 116 | The `drupal_make.sh` file will always be used to download and unpack the 117 | required core, modules, themes and libraries. The environment specific will only 118 | be used if they match the environment set when calling the commands who have 119 | make steps. 120 | 121 | Example: 122 | 123 | ``` 124 | MAKE_FILES=( 125 | "minimal.make" 126 | "administration.make" 127 | ) 128 | ``` 129 | 130 | 131 | 132 | [Back to overview][link-overview] 133 | 134 | 135 | 136 | [link-drush-make]: http://www.drush.org/en/master/make/#the-make-file-format 137 | 138 | [link-overview]: README.md 139 | -------------------------------------------------------------------------------- /docs/config-modules.md: -------------------------------------------------------------------------------- 1 | # Module configuration 2 | When installing a platform disabeling by-default installed modules and enabeling 3 | extra modules can be required. Druleton provides two optional configuration 4 | files to define what modules should be disabled and enabled. 5 | 6 | 7 | ## Disable modules 8 | The `config/drupal_modules_disable.sh` file contains an array of module names 9 | that should be disabled once the platform is installed. This list will be 10 | processed for all environments. 11 | 12 | Example: 13 | ```bash 14 | MODULES_DISABLE=( 15 | "color" 16 | "overlay" 17 | "search" 18 | "shortcut" 19 | "update" 20 | ) 21 | ``` 22 | 23 | There is the option to define a list for each environments (dev, tst, prod, ...) 24 | by adding a config file with an environment suffix. 25 | 26 | Example for the production environment (`config/drupal_modules_disable_prd.sh`): 27 | ```bash 28 | MODULES_DISABLE=( 29 | "field_ui" 30 | ) 31 | ``` 32 | 33 | 34 | 35 | ## Enable modules 36 | The `config/drupal_modules_enable.sh` file contains an array of module names 37 | that should be enabled once the platform is installed. This list will be 38 | processed for all environments. 39 | 40 | Example: 41 | ```bash 42 | MODULES_ENABLE=( 43 | # Administration. 44 | "admin_views" 45 | "adminimal" 46 | "adminimal_admin_menu" 47 | "module_filter" 48 | # Minimal. 49 | "ctools" 50 | "entity" 51 | "entityreference" 52 | "jquery_update" 53 | "libraries" 54 | "pathauto" 55 | "redirect" 56 | "token" 57 | "transliteration" 58 | "views" 59 | "views_bulk_operations" 60 | ) 61 | ``` 62 | 63 | There is the option to define a list for each environments (dev, tst, prod, ...) 64 | by adding a config file with an environment suffix. 65 | 66 | Example for the development environment (`config/drupal_modules_enable_dev.sh`): 67 | ```bash 68 | MODULES_ENABLE=( 69 | "devel" 70 | "devel_generate" 71 | "views_ui" 72 | ) 73 | ``` 74 | 75 | 76 | 77 | [Back to overview][link-overview] 78 | 79 | 80 | 81 | [link-overview]: README.md 82 | -------------------------------------------------------------------------------- /docs/config.md: -------------------------------------------------------------------------------- 1 | # Config directory 2 | The `config` directory contains the settings and configuration for the project. 3 | 4 | The config directory has following structure: 5 | 6 | 7 | ### config.sh 8 | The `config.sh` file contains the global configuration for the project. It is 9 | specific for the environment where the scripts are run (eg. local development, 10 | test, acceptance, production, ...). 11 | 12 | > **Warning** : Don't include this file in the versioning system as it is 13 | > environment specific! 14 | 15 | Use the config_example.sh script to give an example of the expected 16 | configuration variables. 17 | 18 | **This is the only required file within the `config` directory.** 19 | 20 | [Read more about the config.sh file][link-config-config]. 21 | 22 | 23 | ### config_example.sh 24 | This file is used to give an example and document the required and optional 25 | configuration variables. Copy this example file per environment where these 26 | scripts are deployed and fill in the actual values. 27 | 28 | > **Warning** : Don't store any real usernames and passwords in this file! 29 | 30 | 31 | ### drupal_make.sh 32 | The drupal make file contains an array of make files (from within the 33 | `config/make` directory) that should be included when the make step is run 34 | within a command. 35 | 36 | Use the `drupal_make.sh` file to set the global list of make files. These will 37 | be included in all environments. 38 | 39 | [Read more about the make files][link-config-make] 40 | 41 | 42 | ### drupal_make_\.sh 43 | On top of the global make files list, you can also define modules that should be 44 | included only for specific environment. 45 | 46 | Example: 47 | 48 | - devel module for the `dev` environment. 49 | - memcache module for the `prod` environment. 50 | 51 | 52 | ### drupal_modules_enable.sh 53 | An array of modules that should be enabled after an install or reset command is 54 | run. 55 | 56 | Use the `drupal_modules_enable.sh` file to set the global list of modules. These 57 | will be enabled for all environments. 58 | 59 | [Read more about the modules configuration][link-config-modules] 60 | 61 | 62 | ### drupal_modules_enable_\.sh 63 | Use this to enable environment specific modules. 64 | 65 | Example: 66 | 67 | - devel, field_ui and views_ui modules for the `dev` environment. 68 | - memcache and dfs modules for the `prod` environment. 69 | 70 | 71 | ### drupal_modules_disable.sh 72 | An array of modules that should be disabled after an install or reset command is 73 | run. 74 | 75 | Use the `drupal_modules_disable.sh` file to set the global list of modules. 76 | These will be disabled for all environments. 77 | 78 | [Read more about the modules configuration][link-config-modules] 79 | 80 | 81 | ### drupal_modules_disable_\.sh 82 | Use this to disable environment specific modules. 83 | 84 | 85 | ### Subdirectory for each command 86 | Each command has its own configuration subdirectory within the `config` 87 | directory with the same name as the command. These directories contain also 88 | the [implemented hooks][link-hooks] for that command. 89 | 90 | The directories are not mandatory, they only need to be created when a hook 91 | implementation or specific configuration file is needed. 92 | 93 | The possible command configuration directories are: 94 | 95 | - `config/install` : Configuration and hooks for the 96 | [`bin/install`][link-command-install] command. 97 | - `config/reset` : Configuration and hooks for the 98 | [`bin/reset`][link-command-reset] command. 99 | - `config/upgrade` : Configuration and hooks for the 100 | [`bin/upgrade`][link-command-upgrade] command. 101 | - `config/build` : Configuration and hooks for the 102 | [`bin/build`][link-command-build] command. 103 | - `config/backup` : Configuration and hooks for the 104 | [`bin/backup`][link-command-backup] command. 105 | - `config/restore` : Configuration and hooks for the 106 | [`bin/restore`][link-command-restore] command. 107 | 108 | 109 | 110 | [Back to overview][link-overview] 111 | 112 | 113 | 114 | [link-config-config]: config-config.md 115 | [link-config-make]: config-make.md 116 | [link-config-modules]: config-modules.md 117 | 118 | [link-command-install]: command-install.md 119 | [link-command-reset]: command-reset.md 120 | [link-command-upgrade]: command-upgrade.md 121 | [link-command-build]: command-build.md 122 | [link-command-backup]: command-backup.md 123 | [link-command-restore]: command-restore.md 124 | [link-hooks]: hooks.md 125 | 126 | [link-overview]: README.md 127 | 128 | -------------------------------------------------------------------------------- /docs/editor.md: -------------------------------------------------------------------------------- 1 | # Editor setup (IDE) 2 | 3 | Configure your IDE so that it has the druleton root directory as the root of the 4 | project. 5 | 6 | Exclude the following directories in your IDE: 7 | - `backup` 8 | - `bin` 9 | - `build` 10 | - All symlinked profiles within the `web/profiles` directory. 11 | - All symlinked libraries within the `web/sites/all/libraries` directory. 12 | - `web/sites/all/modules/custom` 13 | - `web/sites/all/themes/custom` 14 | 15 | Optional excludes (if you don't want to change the config in your IDE): 16 | - `config` 17 | 18 | This to avoid code being indexed by your IDE from 2 locations (the project 19 | directory and the symlinked directories within the `web` directory). 20 | 21 | 22 | 23 | [Back to overview][link-overview] 24 | 25 | 26 | 27 | [link-overview]: README.md 28 | -------------------------------------------------------------------------------- /docs/hooks-variables.md: -------------------------------------------------------------------------------- 1 | # Hook variables 2 | Druleton defines a set of variables when the command is run. These variables 3 | are global and can be used in the hooks. 4 | 5 | > **Tip** : Use variables always surrounded with "" to avoid breaking scripts 6 | > when a variable contains a string with spaces or special characters: 7 | > ```bash 8 | > DIR_SITES_DEFAULT="$DIR_WEB/sites/default 9 | > ``` 10 | 11 | ## Variables from the config file 12 | Each variable as defined in the config file is available in the hook scripts. 13 | You can add extra variables to the config file. 14 | 15 | [See documentation about the config file][link-config-config]. 16 | 17 | 18 | ## Variables created during the command bootstrap 19 | 20 | #### `$SCRIPT_NAME` 21 | This variable contains the name of the called command (install, reset, upgrade, 22 | build, backup and restore). 23 | 24 | #### `$ENVIRONMENT` 25 | The environment for who we are running this script as set using the 26 | `--env=\` option. 27 | 28 | #### `$DIR_CURRENT` 29 | The path from where the command is called. 30 | 31 | #### `$DIR_BIN` 32 | The `bin` directory where all the commands are located. 33 | 34 | #### `$DIR_SRC` 35 | The directory within the bin directory (`bin/src`) where all the command sources 36 | and helpers are located. Use this if you want to include a include script that 37 | is not loaded yet. 38 | 39 | #### `$DIR_ROOT` 40 | This is the full directory path to the root of druleton. This is where the 41 | `bin`, `config` and `project` directories are located. 42 | 43 | #### `$DIR_PROJECT` 44 | The full directory path where the custom projects profiles, modules and themes 45 | are located. Use this to symlink or copy these resources to the web directory: 46 | 47 | ```bash 48 | ln -s "$DIR_PROJECT/modules/custom" "$DIR_WEB/sites/all/modules/custom" 49 | ``` 50 | 51 | #### `$DIR_CONFIG` 52 | The full directory path where all the config files are located. 53 | 54 | #### `$DIR_CONFIG_BIN` 55 | The full directory path where all the custom commands are located. 56 | 57 | #### `$DIR_CONFIG_SRC` 58 | The full directory path where all shared custom scripts are stored. These are 59 | included within hooks and custom commands. 60 | 61 | #### `$DIR_WEB` 62 | The full directory path where Drupal will be installed (web root). 63 | 64 | #### `$DIR_BACKUP` 65 | The full directory path where backups will be stored. This is the root of the 66 | backups `backup`. Each backup will be stored in its own subdirectory. 67 | 68 | #### `$DIR_BUILD` 69 | The full directory path where the build will be stored. Each build will by 70 | default be compressed in a tar.gz file within this folder. The build itself 71 | will happen in the `build/web` directory. 72 | 73 | #### `$DRUPAL_INSTALLED` 74 | Is there a working Drupal installation 1/0. 75 | 76 | #### `$CONFIRMED` 77 | Is the --confirm or -y option passed to the script. 78 | 79 | #### `$COMPOSER_USE_GLOBAL` 80 | Should the globally (1) or locally (0) installed composer binary be used for the 81 | `bin/composer` command. 82 | 83 | [see configuration documentation][link-config-config-composer]. 84 | 85 | #### `$DRUSH_VERSION` 86 | What drush version to install and use. 87 | 88 | [see configuration documentation][link-config-config-drush-version]. 89 | 90 | 91 | 92 | ## Command argument 93 | Some commands have one argument (build, backup & restore). The value of that 94 | argument is accessible using the `$SCRIPT_ARGUMENT` variable. 95 | 96 | 97 | 98 | ## Variables from the command options 99 | The variables from the command line are accessible using the 100 | [option helpers][link-hooks-helpers]. 101 | 102 | 103 | 104 | [Back to overview][link-overview] 105 | 106 | 107 | 108 | [link-config-config]: config-config.md 109 | [link-config-config-composer]: config-config.md#composer 110 | [link-config-config-drush-version]: config-config.md#drush-version 111 | [link-hooks-helpers]: hooks-helpers.md 112 | 113 | [link-overview]: README.md 114 | -------------------------------------------------------------------------------- /docs/hooks.md: -------------------------------------------------------------------------------- 1 | # Hook system 2 | The hook system allows you to insert extra scripts in the commands without 3 | having to alter (hack) the command code. This makes it possible to update the 4 | `bin` directory without overriding the added code. 5 | 6 | - Running a command will trigger a hook when the command starts to run and when 7 | it is finished. 8 | - Each step in a command has a before and after hook. See the 9 | [commands documentation][link-commands] for an overview of all available 10 | hooks. 11 | 12 | All hooks are stored in the `config/` directory. See the 13 | [commands documentation][link-commands] for an overview of the hooks and their 14 | location. 15 | 16 | You can access this information also by running the command with the 17 | `--hook-info` option: 18 | 19 | ```bash 20 | $ bin/install --hook-info 21 | ``` 22 | 23 | Use the hook system to: 24 | - Set configuration for specific modules. 25 | - Symlink custom code from the `project` directory to the `web/sites/all/...` 26 | directories. 27 | - ... 28 | 29 | There is a general hook file (without an environment suffix), this one will be 30 | included for all environments. The environment specific hook will only be 31 | included when it matches the environment as set in the `--env=` 32 | option. 33 | 34 | If both are available: the general hook will always included and run first 35 | followed by the environment specific one. 36 | 37 | 38 | 39 | ## Writing hooks 40 | The hook code is run by including the hook file before or after a step as 41 | defined by the hook name. 42 | 43 | All hooks should be written in [bash][link-bash]. 44 | 45 | Druleton provides helper functions to format output, call drush commands, ... 46 | 47 | See the [helper functions][link-hooks-helpers] and 48 | [variables][link-hooks-variables] documentation. 49 | 50 | 51 | 52 | ## Documenting hooks 53 | A hook extends the functionality of a druleton command. Some hooks can support 54 | extra options or need extra description and examples. 55 | 56 | Druleton supports extending the documentation of the build-in commands by 57 | creating the proper help files within the `config/bin/src/help` directory: 58 | 59 | ### Command description 60 | Add the extra description to the file: 61 | `config/bin/help/COMMANDNAME_description.txt`. The content should explain what 62 | the hook(s) add to the command. 63 | 64 | Example: 65 | ``` 66 | All custom code from within the project directory will be symlinked to their 67 | proper locations within the web directory. 68 | ``` 69 | 70 | ### Command examples 71 | Add some usage examples to the `config/bin/help/COMMANDNAME_examples.txt` file. 72 | 73 | Example: 74 | ``` 75 | * bin/install --no-link 76 | The project code will not be symlinked to its proper 77 | location within the web directory. 78 | ``` 79 | 80 | ### Command arguments 81 | Explain what the argument is. If no argument is in use, explain it in this file 82 | `config/bin/help/COMMANDNAME_arguments.txt`. 83 | 84 | ### Command options 85 | List the extra command options and where they stand for in the 86 | `config/bin/help/COMMANDNAME_options.txt` file. 87 | 88 | Do not create this help file if no extra options are added. 89 | 90 | Example: 91 | ``` 92 | --no-link Don't create symlinks from within the web directory to 93 | the project files. 94 | ``` 95 | 96 | 97 | 98 | [Back to overview][link-overview] 99 | 100 | 101 | 102 | [link-commands]: README.md#commands 103 | [link-bash]: http://www.tldp.org/LDP/abs/html/ 104 | [link-hooks-helpers]: hooks-helpers.md 105 | [link-hooks-variables]: hooks-variables.md 106 | 107 | [link-overview]: README.md 108 | -------------------------------------------------------------------------------- /docs/img/hooks-helpers-color-bg-highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-color-bg-highlight.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-color-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-color-bg.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-color-fg-highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-color-fg-highlight.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-color-fg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-color-fg.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-color-restore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-color-restore.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_debug.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_divider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_divider.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_error.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_h1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_h1.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_h1_divider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_h1_divider.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_h1_li.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_h1_li.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_h2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_h2.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_h3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_h3.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_info.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_li.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_li.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_li_value.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_li_value.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_success.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-markup_warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-markup_warning.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-message_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-message_error.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-message_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-message_info.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-message_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-message_success.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-message_warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-message_warning.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-prompt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-prompt.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-prompt_confirm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-prompt_confirm.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-prompt_confirm_or_exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-prompt_confirm_or_exit.png -------------------------------------------------------------------------------- /docs/img/hooks-helpers-prompt_yn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/docs/img/hooks-helpers-prompt_yn.png -------------------------------------------------------------------------------- /docs/requirements.md: -------------------------------------------------------------------------------- 1 | # Requirements 2 | Druleton requires a working bash environment. This comes standard with 3 | Linux distributions and Mac OSX. 4 | 5 | On top of that it requires you to have a working Apache, Mysql & PHP 6 | environment, see [minimal requirements to run Drupal][link-drupal-requirements]. 7 | 8 | Druleton will download a local copy of composer and use it to install the 9 | latest [drush][link-drush] version locally for the project. There is the option 10 | to use a globally installed drush. 11 | [See configuration options][link-config-config]. 12 | 13 | There is no support for [drupalconsole][link-drupalconsole] for Drupal 8 (yet). 14 | 15 | 16 | 17 | [link-drupal-requirements]: https://www.drupal.org/requirements 18 | [link-drush]: https://github.com/drush-ops/drush 19 | [link-config-config]: config-config.md#drush-version 20 | [link-drupalconsole]: http://drupalconsole.com/ 21 | -------------------------------------------------------------------------------- /drush: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script that acts as a wrapper around the drush cli tool. 5 | # 6 | # The wrapper will always execute drush within the web directory. 7 | # 8 | # ! Do not change this file ! 9 | # All configuration is in the config directory 10 | ################################################################################ 11 | 12 | 13 | # Bootstrap the script. 14 | source $(dirname $0)/src/bootstrap.sh 15 | 16 | # START Script ----------------------------------------------------------------- 17 | 18 | markup_debug 19 | markup_debug "Start : $(date '+%Y-%m-%d %H:%M:%S')" 20 | markup_debug 21 | 22 | # Create the global $CODER_OPTIONS array. 23 | drupal_drush_filter_options 24 | 25 | drupal_drush "${DRUSH_OPTIONS[@]}" 26 | 27 | markup_debug 28 | markup_debug "Drush binary used : $DRUSH_VERSION" 29 | markup_debug "Drush params : $drush_params" 30 | 31 | markup "${GREY}Finished : $(date '+%Y-%m-%d %H:%M:%S')" 32 | echo 33 | 34 | # END Script ------------------------------------------------------------------- 35 | 36 | # End. 37 | exit 0 38 | -------------------------------------------------------------------------------- /init: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script to initiate or update the project environment. 5 | # 6 | # This will: 7 | # - Create a symlink to any config/bin/commandname from within the bin/ 8 | # directory. 9 | # 10 | # ! Do not change this file ! 11 | # All configuration is in the config directory 12 | ################################################################################ 13 | 14 | 15 | # Bootstrap the script. 16 | source $(dirname $0)/src/bootstrap.sh 17 | 18 | # Includes. 19 | source "$DIR_SRC/script.sh" 20 | source "$DIR_SRC/init.sh" 21 | source "$DIR_SRC/init_coder.sh" 22 | source "$DIR_SRC/init_config.sh" 23 | source "$DIR_SRC/init_composer.sh" 24 | source "$DIR_SRC/init_custom_commands.sh" 25 | source "$DIR_SRC/init_druleton.sh" 26 | source "$DIR_SRC/init_drush.sh" 27 | source "$DIR_SRC/init_structure.sh" 28 | 29 | # Pre command. 30 | init_init 31 | init_info 32 | prompt_confirm_or_exit 33 | 34 | # START Script ----------------------------------------------------------------- 35 | script_before_run 36 | init_structure_run 37 | init_druleton_run 38 | init_config_run 39 | init_composer_run 40 | init_drush_run 41 | init_coder_run 42 | init_custom_commands_run 43 | script_after_run 44 | # END Script ------------------------------------------------------------------- 45 | 46 | # Finish message. 47 | init_finished 48 | 49 | # End. 50 | exit 0 51 | -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script to install a new site based on the configuration. 5 | # 6 | # ! Do not change this file ! 7 | # All configuration is in the config directory 8 | ################################################################################ 9 | 10 | 11 | # Bootstrap the script. 12 | source $(dirname $0)/src/bootstrap.sh 13 | 14 | # Includes. 15 | source "$DIR_SRC/script.sh" 16 | source "$DIR_SRC/backup.sh" 17 | source "$DIR_SRC/install.sh" 18 | source "$DIR_SRC/cleanup.sh" 19 | source "$DIR_SRC/drupal_make.sh" 20 | source "$DIR_SRC/drupal_install.sh" 21 | source "$DIR_SRC/drupal_modules_disable.sh" 22 | source "$DIR_SRC/drupal_modules_enable.sh" 23 | source "$DIR_SRC/drupal_login.sh" 24 | 25 | # Pre script. 26 | install_info 27 | prompt_confirm_or_exit "Are you sure" "Installation aborted" 28 | 29 | # START Script ----------------------------------------------------------------- 30 | script_before_run 31 | backup_run 32 | cleanup_run 33 | drupal_make_run 34 | drupal_install_run 35 | drupal_modules_disable_run 36 | drupal_modules_enable_run 37 | drupal_login_run 38 | script_after_run 39 | # END Script ------------------------------------------------------------------- 40 | 41 | # Finish message. 42 | install_finished 43 | 44 | # End. 45 | exit 0 46 | -------------------------------------------------------------------------------- /reset: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script to reset the environment by deleting the DB & Files directory and 5 | # reinstall Drupal. 6 | # 7 | # ! Do not change this file ! 8 | # All configuration is in the config directory 9 | ################################################################################ 10 | 11 | 12 | # Bootstrap the script. 13 | source $(dirname $0)/src/bootstrap.sh 14 | 15 | # Includes. 16 | source "$DIR_SRC/script.sh" 17 | source "$DIR_SRC/reset.sh" 18 | source "$DIR_SRC/backup.sh" 19 | source "$DIR_SRC/cleanup.sh" 20 | source "$DIR_SRC/drupal_install.sh" 21 | source "$DIR_SRC/drupal_modules_disable.sh" 22 | source "$DIR_SRC/drupal_modules_enable.sh" 23 | source "$DIR_SRC/drupal_login.sh" 24 | 25 | # Pre script. 26 | reset_init 27 | reset_info 28 | prompt_confirm_or_exit 29 | 30 | # START Script ----------------------------------------------------------------- 31 | script_before_run 32 | backup_run 33 | cleanup_run 34 | drupal_install_run 35 | drupal_modules_disable_run 36 | drupal_modules_enable_run 37 | drupal_login_run 38 | script_after_run 39 | # END Script ------------------------------------------------------------------- 40 | 41 | # Finish message. 42 | reset_finished 43 | 44 | # End. 45 | exit 0 46 | -------------------------------------------------------------------------------- /restore: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script to restore a local environment from a backup. 5 | # 6 | # This will list all available backups and ask you what backup to restore from. 7 | # 8 | # This will restore: 9 | # - The database. 10 | # - The /web directory. 11 | # 12 | # ! Do not change this file ! 13 | # All configuration is in the config directory 14 | ################################################################################ 15 | 16 | 17 | # Bootstrap the script. 18 | source $(dirname $0)/src/bootstrap.sh 19 | 20 | # Includes. 21 | source "$DIR_SRC/script.sh" 22 | source "$DIR_SRC/restore.sh" 23 | source "$DIR_SRC/drupal_login.sh" 24 | 25 | # Pre script. 26 | restore_init 27 | restore_info 28 | prompt_confirm_or_exit 29 | 30 | # START Script ----------------------------------------------------------------- 31 | script_before_run 32 | restore_run 33 | drupal_login_run 34 | script_after_run 35 | # END Script ------------------------------------------------------------------- 36 | 37 | # Finish message. 38 | restore_finished 39 | 40 | # End. 41 | exit 0 42 | -------------------------------------------------------------------------------- /src/backup_sites_default.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that backups the neccesary files before performing an upgrade. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Script to take the actual backup before the upgrade. 8 | # 9 | # This script will trigger 2 "hooks" in the config// directory: 10 | # - backup_sites_default_before : Scripts that should run before the backup is 11 | # taken. 12 | # - backup_sites_default_after : Scripts that should run after the backup is 13 | # taken. 14 | # 15 | # The hooks will be called without and with environment suffix. 16 | ## 17 | function _backup_sites_default_run { 18 | hook_invoke backup_sites_default_before 19 | 20 | markup_h1 "Move sites/default into safety." 21 | local backup_directory="$DIR_BACKUP" 22 | if [ -d "$backup_directory" ]; then 23 | mkdir -p "$backup_directory" 24 | fi 25 | 26 | if [ -f "$backup_directory/sites-default" ]; then 27 | rm -R "$backup_directory/sites-default" 28 | fi 29 | 30 | drupal_sites_default_unprotect 31 | mv "$DIR_WEB/sites/default" "$backup_directory/sites-default" 32 | if [[ $? -eq 1 ]]; then 33 | markup_error "Error while moving the sites/default directory." 34 | echo 35 | exit 36 | else 37 | message_success "Success." 38 | echo 39 | fi 40 | 41 | hook_invoke backup_sites_default_after 42 | } 43 | -------------------------------------------------------------------------------- /src/bootstrap.sh: -------------------------------------------------------------------------------- 1 | 2 | ################################################################################ 3 | # Bootstrap for the scripts, contains common startup steps. 4 | # 5 | # Defined variables after including this script: 6 | # $SCRIPT_NAME : the name of the called script (install, reset, update, ...). 7 | # $ENVIRONMENT : the environment for who we are running this script. 8 | # $DIR_CURRENT : the path from where the script is called. 9 | # $DIR_BIN : the bin directory where the script is located. 10 | # $DIR_SRC : the directory where all the include scripts are. 11 | # $DIR_ROOT : the root of the project. 12 | # $DIR_PROJECT : the directory where the projects profiles, modules and themes 13 | # are located. 14 | # $DIR_CONFIG : the directory where all the config files are. 15 | # $DIR_WEB : the directory where Drupal will be installed (web root). 16 | # $DIR_BACKUP : the directory where backups will be stored. 17 | # $DIR_BUILD : the directory where the build will be stored. 18 | # $DRUPAL_INSTALLED : Is there a working Drupal instalation 1/0. 19 | # $CONFIRMED : is the --confirm or -y option passed to the script. 20 | ################################################################################ 21 | 22 | 23 | # Get the script name 24 | SCRIPT_NAME=$( basename $0 ) 25 | 26 | 27 | # Define all paths. 28 | DIR_CURRENT=${PWD} 29 | DIR_SRC=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 30 | DIR_BIN=$( cd "$DIR_SRC/.." && pwd) 31 | DIR_ROOT=$( cd "$DIR_BIN/.." && pwd ) 32 | DIR_PROJECT="$DIR_ROOT/project" 33 | DIR_WEB="$DIR_ROOT/web" 34 | DIR_BACKUP="$DIR_ROOT/backup" 35 | DIR_BUILD="$DIR_ROOT/build" 36 | 37 | # Define paths to the config directories. 38 | DIR_CONFIG="$DIR_ROOT/config" 39 | DIR_CONFIG_BIN="$DIR_CONFIG/bin" 40 | DIR_CONFIG_SRC="$DIR_CONFIG_BIN/src" 41 | 42 | 43 | # Include helpers. 44 | source "$DIR_SRC/include/file.sh" 45 | source "$DIR_SRC/include/options.sh" 46 | source "$DIR_SRC/include/colors.sh" 47 | source "$DIR_SRC/include/markup.sh" 48 | source "$DIR_SRC/include/message.sh" 49 | source "$DIR_SRC/include/prompt.sh" 50 | source "$DIR_SRC/include/composer.sh" 51 | source "$DIR_SRC/include/drupal.sh" 52 | 53 | # Load the config file (if any). 54 | if [ -f "$DIR_CONFIG/config.sh" ]; then 55 | source "$DIR_CONFIG/config.sh" 56 | fi 57 | 58 | # Get the environment. 59 | ENVIRONMENT=$(option_get_environment) 60 | 61 | # Check if there is a working Drupal. 62 | # Check if there is currently a working Drupal installation. 63 | DRUPAL_INSTALLED=$( drupal_is_installed ) 64 | 65 | # Check if a confirmed option is given. 66 | if [ $(option_is_set "--confirm") -eq 1 ] || [ $(option_is_set "-y") -eq 1 ]; then 67 | CONFIRMED=1 68 | else 69 | CONFIRMED=0 70 | fi 71 | 72 | # Set the default variable value(s) for composer. 73 | composer_variable_use_global 74 | 75 | # Set the default variable value(s) for drush. 76 | drupal_drush_variable_version 77 | 78 | # Load Help. 79 | source "$DIR_SRC/include/help.sh" 80 | 81 | # Load hook info. 82 | source "$DIR_SRC/include/hook.sh" 83 | -------------------------------------------------------------------------------- /src/build.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to compress a build into a tarbal. 3 | ################################################################################ 4 | 5 | ## 6 | # Build command information. 7 | ## 8 | function build_info { 9 | echo 10 | markup_h1_divider 11 | markup_h1 " ${LWHITE}Build${LBLUE} website ${WHITE}$SITE_NAME${LBLUE} ($ENVIRONMENT)" 12 | markup_h1_divider 13 | markup_h1_li "Drupal core, contrib modules and themes will be downloaded." 14 | markup_h1_li "Custom profiles, modules & themes will be copied into the site structure." 15 | markup_h1_li "The site will not be installed." 16 | 17 | if [ -d "$DIR_BUILD/web" ]; then 18 | markup_h1_li "The previous build will be deleted and overwritten." 19 | fi 20 | 21 | markup_h1_divider 22 | echo 23 | } 24 | 25 | ## 26 | # The build script is finished information. 27 | ## 28 | function build_finished { 29 | markup_h1_divider 30 | markup_success " Finished" 31 | markup_h1_divider 32 | if [ -z "$BUILD_PACKAGE_NAME" ]; then 33 | markup_h1_li "Build directory : ${LWHITE}${DIR_BUILD}/web${RESTORE}" 34 | else 35 | markup_h1_li "Build file : ${LWHITE}${BUILD_PACKAGE_NAME}${RESTORE}" 36 | markup_h1_li "Directory : ${LWHITE}${DIR_BUILD}${RESTORE}" 37 | fi 38 | markup_h1_divider 39 | echo 40 | } 41 | 42 | ## 43 | # Check (and create if not) if the build directory exists. 44 | ## 45 | function build_check_directory { 46 | if [ -d "$DIR_BUILD" ]; then 47 | mkdir -p "$DIR_BUILD" 48 | markup_debug "Build directory created." 1 49 | fi 50 | } 51 | 52 | ## 53 | # Build the drupal package using the make files. 54 | ## 55 | function build_drupal_make { 56 | # Change the $DIR_WEB to the build folder while we run the make files. 57 | DIR_WEB_NORMAL="$DIR_WEB" 58 | DIR_WEB="$DIR_BUILD/web" 59 | drupal_make_run 60 | DIR_WEB="$DIR_WEB_NORMAL" 61 | } 62 | 63 | ## 64 | # Function to create a package from the build result. 65 | # 66 | # This script will trigger 2 "hooks" in the config// directory: 67 | # - build_package_before : Scripts that should run before the package is 68 | # created. 69 | # - build_package_after : Scripts that should run after the package is created. 70 | # 71 | # The hooks will be called without and with environment suffix. 72 | ## 73 | function build_package_run { 74 | if [ $(option_is_set "--no-package") -eq 1 ]; then 75 | markup_debug "Build not packaged (--no-package)." 1 76 | return 77 | fi 78 | 79 | hook_invoke "build_package_before" 80 | 81 | cd "$DIR_BUILD" 82 | markup_h1 "Package the build" 83 | 84 | # Create the package name (from argument of fallback to date). 85 | BUILD_PACKAGE_NAME="${SITE_NAME// /_}-$(date +%Y%m%d_%H%M%S).tar.gz" 86 | if [ ! -z $SCRIPT_ARGUMENT ]; then 87 | BUILD_PACKAGE_NAME="${SCRIPT_ARGUMENT// /_}.tar.gz" 88 | fi 89 | 90 | # Cleanup old build package. 91 | if [ -f "$DIR_BUILD/$BUILD_PACKAGE_NAME" ]; then 92 | markup_debug "Remove old build package." 93 | rm "$DIR_BUILD/$BUILD_PACKAGE_NAME" 94 | fi 95 | 96 | # Create the package. 97 | tar -czf "$BUILD_PACKAGE_NAME" "web" 98 | if [ $? -ne 1 ]; then 99 | message_success "Package created." 100 | markup_debug "Package : $BUILD_PACKAGE_NAME" 101 | else 102 | message_error "Error while creating package" 103 | fi 104 | 105 | # Remove the web directory as this is now part of the package. 106 | rm -R web 107 | if [ $? -ne 1 ]; then 108 | message_success "Cleaned up the build directory." 109 | else 110 | message_error "Error while removing the build directory." 111 | fi 112 | 113 | echo 114 | 115 | hook_invoke "build_package_after" 116 | } 117 | -------------------------------------------------------------------------------- /src/cleanup.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to cleanup files & directories based on config files. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Cleanup files and directories based on the configuration files that holds an 8 | # array of $CLEANUP_FILES and $CLEANUP_DIRECTORIES. 9 | # 10 | # This script will try to load the cleanup from 2 files: 11 | # 3. config//cleanup.sh 12 | # 4. config//cleanup_.sh 13 | # 14 | # This script will trigger 2 "hooks" in the config// directory: 15 | # - cleanup_before : Scripts that should run before the cleanup is run. 16 | # - cleanup_after : Scripts that should run after the cleanup is run. 17 | # 18 | # The hooks will be called without and with environment suffix. 19 | ## 20 | function cleanup_run { 21 | hook_invoke "cleanup_before" 22 | 23 | # Make the default directory and its content writable. 24 | drupal_sites_default_unprotect 25 | 26 | # Cleanup based on script. 27 | cleanup_run_config "$DIR_CONFIG/$SCRIPT_NAME/cleanup.sh" 28 | 29 | # Cleanup based on script and environment. 30 | cleanup_run_config "$DIR_CONFIG/$SCRIPT_NAME/cleanup_$ENVIRONMENT.sh" 31 | 32 | hook_invoke "cleanup_after" 33 | } 34 | 35 | ## 36 | # Cleanup based on the given configuration file. 37 | # 38 | # @param The file name of the script that contains the config array. 39 | ## 40 | function cleanup_run_config { 41 | # Reset the variables. 42 | CLEANUP_FILES=() 43 | CLEANUP_DIRECTORIES=() 44 | 45 | # Check if file exists. 46 | cleanup_file="$1" 47 | if [ ! -f "$cleanup_file" ]; then 48 | markup_debug "File does not exists: $cleanup_file" 49 | return 50 | fi; 51 | 52 | # Load the file and run cleanup. 53 | source "$cleanup_file" 54 | 55 | markup_h1 "Cleanup loaded from $cleanup_file" 56 | cleanup_run_files $CLEANUP_FILES 57 | cleanup_run_directories $CLEANUP_DIRECTORIES 58 | echo 59 | } 60 | 61 | ## 62 | # Cleanup files based on an array of file paths. 63 | # 64 | # @param Array of file paths that need to be deleted. 65 | ## 66 | function cleanup_run_files { 67 | CLEANUP_FILES_CONFIG=$1 68 | 69 | if [ ${#CLEANUP_FILES_CONFIG[@]} -eq 0 ]; then 70 | massage_warning "No files to cleanup" 71 | return 72 | fi 73 | 74 | for cleanup_file in ${CLEANUP_FILES_CONFIG[@]}; do 75 | markup "${cleanup_file}" 76 | 77 | # Delete the file. 78 | if [ -f "${cleanup_file}" ]; then 79 | chmod +w "${cleanup_file}" 80 | rm "${cleanup_file}" 81 | 82 | # Check if the file is deleted. 83 | if [ -f "${cleanup_file}" ]; then 84 | message_error "Can't delete file." 85 | else 86 | message_success "File is deleted." 87 | fi 88 | else 89 | message_warning "File does not exists." 90 | fi 91 | 92 | done 93 | } 94 | 95 | ## 96 | # Cleanup files based on an array of file paths. 97 | # 98 | # @param Array of file paths that need to be deleted. 99 | ## 100 | function cleanup_run_directories { 101 | CLEANUP_DIRECTORIES_CONFIG=$1 102 | 103 | if [ ${#CLEANUP_DIRECTORIES_CONFIG[@]} -eq 0 ]; then 104 | massage_warning "No directories to cleanup" 105 | return 106 | fi 107 | 108 | for cleanup_directory in ${CLEANUP_DIRECTORIES_CONFIG[@]}; do 109 | markup "${cleanup_directory}" 110 | 111 | # Delete the directory. 112 | if [ -d "${cleanup_directory}" ]; then 113 | chmod -R +w "${cleanup_directory}" 114 | rm -R "${cleanup_directory}" 115 | 116 | # Check if the directory is deleted. 117 | if [ -d "${cleanup_directory}" ]; then 118 | message_warning "Can't delete directory." 119 | else 120 | message_success "Directory is deleted." 121 | fi 122 | else 123 | message_warning "Directory does not exists." 124 | fi 125 | 126 | done 127 | } 128 | -------------------------------------------------------------------------------- /src/drupal_install.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to install a Drupal site based on the configuration file. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Function to instal a Drupal site based on the global config parameters. 8 | # 9 | # This script will trigger 2 "hooks" in the config// directory: 10 | # - drupal_install_before : Scripts that should run before Drupal is installed. 11 | # - drupal_install_after : Scripts that should run after Drupal is installed. 12 | # 13 | # The hooks will be called without and with environment suffix. 14 | ## 15 | function drupal_install_run { 16 | # Run any script before we run the Drupal installer. 17 | hook_invoke "drupal_install_before" 18 | 19 | 20 | # Install Drupal with the configuration parameters. 21 | markup_h1 "Install Drupal" 22 | 23 | markup_debug "Install Drupal with:" 24 | markup_debug " - Site name : $SITE_NAME" 25 | markup_debug " - Profile : $SITE_PROFILE" 26 | markup_debug " - Username : $ACCOUNT_NAME" 27 | markup_debug " - Password : $ACCOUNT_PASS" 28 | markup_debug " - Email : $ACCOUNT_MAIL" 29 | markup_debug " - DB host : $DB_HOST" 30 | markup_debug " - DB name : $DB_NAME" 31 | markup_debug " - DB user : $DB_USER" 32 | markup_debug " - DB pass : $DB_PASS" 33 | 34 | drupal_drush -y si \ 35 | --account-name="$ACCOUNT_NAME" \ 36 | --account-pass="$ACCOUNT_PASS" \ 37 | --account-mail="$ACCOUNT_MAIL" \ 38 | --site-name="$SITE_NAME" \ 39 | --db-url="mysql://$DB_USER:$DB_PASS@$DB_HOST/$DB_NAME" \ 40 | $SITE_PROFILE 41 | echo 42 | 43 | 44 | # Run any script after we run the Drupal installer. 45 | hook_invoke "drupal_install_after" 46 | } 47 | -------------------------------------------------------------------------------- /src/drupal_login.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to login de admin user into the Drupal website. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Function to login into a Drupal site with the admin user. 8 | # 9 | # This script will trigger 2 "hooks" in the config// directory: 10 | # - drupal_login_before : Scripts that should run before the user is logged in. 11 | # - drupal_login_after : Scripts that should run after the user id logged in. 12 | # 13 | # The hooks will be called without and with environment suffix. 14 | ## 15 | function drupal_login_run { 16 | if [ $(option_is_set "--no-login") -eq 1 ]; then 17 | markup_debug "Drupal login is disabled" 1 18 | return 19 | fi 20 | 21 | # Run hooks before we login into Drupal. 22 | hook_invoke "drupal_login_before" 23 | 24 | # Open on-time-login in browser. 25 | markup_h1 "Open browser and login" 26 | if [ `drupal_is_installed` -eq 1 ]; then 27 | drupal_drush uli -l "$SITE_URL" / 28 | else 29 | message_error "No working Drupal installation to login to." 30 | fi 31 | echo 32 | 33 | # Run hooks after we login into Drupal. 34 | hook_invoke "drupal_login_after" 35 | } 36 | -------------------------------------------------------------------------------- /src/drupal_make.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to download core and contrib modules & themes using make files. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Function to download core & contrib modules and themes based on the make 8 | # files. 9 | # 10 | # This script will try to load the make config from 4 files: 11 | # 1. config/drupal_make.sh 12 | # 2. config/drupal_make_.sh 13 | # 3. config//drupal_make.sh 14 | # 4. config//drupal_make_.sh 15 | # 16 | # This script will trigger 2 "hooks" in the config// directory: 17 | # - drupal_make_before : Scripts that should run before the user is logged in. 18 | # - drupal_make_after : Scripts that should run after the user id logged in. 19 | # 20 | # The hooks will be called without and with environment suffix. 21 | ## 22 | function drupal_make_run { 23 | # Run any script before we run the make files. 24 | hook_invoke drupal_make_before 25 | 26 | 27 | # Make sure that the web directory does not exists. 28 | if [ -d "$DIR_WEB" ]; then 29 | drupal_sites_default_unprotect 30 | rm -R "$DIR_WEB" 31 | fi 32 | 33 | 34 | # Make Drupal core. 35 | markup_h1 "Download Drupal core" 36 | markup_h2 "_core.make" 37 | drupal_drush_run make "$DIR_CONFIG/make/_core.make" "$DIR_WEB" 38 | echo 39 | 40 | # 1. Default make files. 41 | drupal_make_run_file "$DIR_CONFIG/drupal_make.sh" 42 | 43 | # 2. Make files specific for the environment. 44 | drupal_make_run_file "$DIR_CONFIG/drupal_make_$ENVIRONMENT.sh" 45 | 46 | # 3. Make files specific for the script name. 47 | drupal_make_run_file "$DIR_CONFIG/$SCRIPT_NAME/drupal_make.sh" 48 | 49 | # 4. Make files specific for the script name and environment. 50 | drupal_make_run_file "$DIR_CONFIG/$SCRIPT_NAME/drupal_make_$ENVIRONMENT.sh" 51 | 52 | 53 | # Run any script after we did run the make files. 54 | hook_invoke drupal_make_after 55 | } 56 | 57 | ## 58 | # Run the make files. 59 | # 60 | # @param The file name of the script that contains the config array. 61 | ## 62 | function drupal_make_run_file { 63 | # Reset the variable. 64 | local MAKE_FILES=() 65 | local drupal_make_file="$1" 66 | 67 | # Check if file exists. 68 | if [ ! -f "$drupal_make_file" ]; then 69 | markup_debug "Make file does not exists : $drupal_make_file" 70 | return 71 | fi 72 | 73 | markup_h1 "Make configuration $drupal_make_file" 74 | source "$drupal_make_file" 75 | 76 | # Check if there are make files in the config. 77 | if [ ${#MAKE_FILES[@]} -eq 0 ]; then 78 | markup "No make files in configuration." 79 | return 80 | fi 81 | 82 | # Run all make files in the configuration. 83 | for make_file in ${MAKE_FILES[@]}; do 84 | markup_h2 "${make_file}" 85 | drupal_drush_run make --no-core "$DIR_CONFIG/make/${make_file}" "$DIR_WEB" 86 | done 87 | echo 88 | } 89 | -------------------------------------------------------------------------------- /src/drupal_modules_disable.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to disable modules based on config files. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Function to disable modules as defined in the $MODULES_DISABLE array(s). 8 | # 9 | # This script will try to load the disable config from 4 files: 10 | # 1. config/drupal_modules_disable.sh 11 | # 2. config/drupal_modules_disable_.sh 12 | # 3. config//drupal_modules_disabme.sh 13 | # 4. config//drupal_modules_disable_.sh 14 | # 15 | # This script will trigger 2 "hooks" in the config// directory: 16 | # - drupal_modules_disable_before : Scripts that should run before the modules 17 | # are disabled. 18 | # - drupal_modules_disable_after : Scripts that should run after the modules 19 | # are disabled. 20 | # 21 | # The hooks will be called without and with environment suffix. 22 | ## 23 | function drupal_modules_disable_run { 24 | # Run any script before we run the make files. 25 | hook_invoke drupal_modules_disable_before 26 | 27 | # 1. Disable modules. 28 | drupal_modules_disable_run_file "$DIR_CONFIG/drupal_modules_disable.sh" 29 | 30 | # 2. Disable modules specific for the environment. 31 | drupal_modules_disable_run_file "$DIR_CONFIG/drupal_modules_disable_$ENVIRONMENT.sh" 32 | 33 | # 3. Disable modules specific for the script name. 34 | drupal_modules_disable_run_file "$DIR_CONFIG/$SCRIPT_NAME/drupal_modules_disable.sh" 35 | 36 | # 4. Disable modules specific for the script name and environment. 37 | drupal_modules_disable_run_file "$DIR_CONFIG/$SCRIPT_NAME/drupal_modules_disable_$ENVIRONMENT.sh" 38 | 39 | # Run any script after we did run the make files. 40 | hook_invoke drupal_modules_disable_after 41 | } 42 | 43 | ## 44 | # Run the make file. 45 | # 46 | # @param The file name of the script that contains the config array. 47 | ## 48 | function drupal_modules_disable_run_file { 49 | # Reset the variable. 50 | local MODULES_DISABLE=() 51 | local drupal_modules_disabe_file="$1" 52 | 53 | # Check if file exists. 54 | if [ ! -f "$drupal_modules_disabe_file" ]; then 55 | markup_debug "No modules disable file $drupal_modules_disabe_file" 56 | return 57 | fi 58 | 59 | markup_h1 "Disable unwanted modules" 60 | source "$drupal_modules_disabe_file" 61 | 62 | # Check if there are modules to disable. 63 | if [ ${#MODULES_DISABLE[@]} -eq 0 ]; then 64 | markup "No modules to disable." 65 | return 66 | fi 67 | 68 | # Disable all modules in configuration. 69 | for module_disable in ${MODULES_DISABLE[@]}; do 70 | drupal_drush -y dis ${module_disable} 71 | done 72 | echo 73 | } 74 | -------------------------------------------------------------------------------- /src/drupal_modules_enable.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to enable modules based on config files. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Function to enable modules as defined in the $MODULES_ENABLE array(s). 8 | # 9 | # This script will try to load the enable config from 4 files: 10 | # 1. config/drupal_modules_enable.sh 11 | # 2. config/drupal_modules_enable_.sh 12 | # 3. config//drupal_modules_enable.sh 13 | # 4. config//drupal_modules_enable_.sh 14 | # 15 | # This script will trigger 2 "hooks" in the config// directory: 16 | # - drupal_modules_enable_before : Scripts that should run before the modules 17 | # are enabled. 18 | # - drupal_modules_enable_after : Scripts that should run after the modules 19 | # are enabled. 20 | # 21 | # The hooks will be called without and with environment suffix. 22 | ## 23 | function drupal_modules_enable_run { 24 | # Run any script before we run the make files. 25 | hook_invoke drupal_modules_enable_before 26 | 27 | # 1. Enable modules. 28 | drupal_modules_enable_run_file "$DIR_CONFIG/drupal_modules_enable.sh" 29 | 30 | # 2. Enable modules specific for the environment. 31 | drupal_modules_enable_run_file "$DIR_CONFIG/drupal_modules_enable_$ENVIRONMENT.sh" 32 | 33 | # 3. Enable modules specific for the script name. 34 | drupal_modules_enable_run_file "$DIR_CONFIG/$SCRIPT_NAME/drupal_modules_enable.sh" 35 | 36 | # 4. Enable modules specific for the script name and environment. 37 | drupal_modules_enable_run_file "$DIR_CONFIG/$SCRIPT_NAME/drupal_modules_enable_$ENVIRONMENT.sh" 38 | 39 | # Run any script after we did run the make files. 40 | hook_invoke drupal_modules_enable_after 41 | } 42 | 43 | ## 44 | # Run the make files. 45 | # 46 | # @param The file name of the script that contains the config array. 47 | ## 48 | function drupal_modules_enable_run_file { 49 | # Reset the variable. 50 | local MODULES_ENABLE=() 51 | local drupal_modules_enable_file="$1" 52 | 53 | # Check if file exists. 54 | if [ ! -f "$drupal_modules_enable_file" ]; then 55 | markup_debug "No modules enable file $drupal_modules_enable_file" 56 | return 57 | fi 58 | 59 | markup_h1 "Enable extra modules" 60 | source "$drupal_modules_enable_file" 61 | 62 | # Check if there are modules to enable. 63 | if [ ${#MODULES_ENABLE[@]} -eq 0 ]; then 64 | markup "No modules to enable." 65 | return 66 | fi 67 | 68 | # Enable all modules in configuration. 69 | for module_enable in ${MODULES_ENABLE[@]}; do 70 | drupal_drush -y en ${module_enable} 71 | done 72 | echo 73 | } 74 | -------------------------------------------------------------------------------- /src/drupal_upgrade.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to upgrade Drupal using the drush updb command. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Function to run the Drupal upgrade function. 8 | # 9 | # This script will trigger 2 "hooks" in the config// directory: 10 | # - drupal_upgrade_before : Scripts that should run before the upgrade is run. 11 | # - drupal_upgrade_after : Scripts that should run after the upgrade has run. 12 | # 13 | # The hooks will be called without and with environment suffix. 14 | ## 15 | function drupal_upgrade_run { 16 | markup_h1 "Upgrade Drupal" 17 | 18 | # Check first if we have something to upgrade. 19 | if [ $(drupal_is_installed) -ne 1 ]; then 20 | message_warning "There is no working Drupal installation." 21 | echo 22 | exit 23 | return 1 24 | fi 25 | 26 | # Trigger the before hook(s). 27 | hook_invoke "drupal_upgrade_before" 28 | 29 | # Do Drupal upgrade. 30 | drupal_drush -y updb 31 | drupal_drush cc all 32 | echo 33 | 34 | # Trigger the after hook(s). 35 | hook_invoke "drupal_upgrade_after" 36 | } 37 | -------------------------------------------------------------------------------- /src/help/backup_arguments.txt: -------------------------------------------------------------------------------- 1 | There is only one argument for the backup script: the name of the directory 2 | within the backup directory where the backup files should be stored. 3 | The current timestamp will be used if no argument is passed. 4 | -------------------------------------------------------------------------------- /src/help/backup_description.txt: -------------------------------------------------------------------------------- 1 | The backup script will create a backup of a working Drupal installation. 2 | The web directory and database data will be saved in compressed format in the 3 | backup directory. 4 | -------------------------------------------------------------------------------- /src/help/backup_examples.txt: -------------------------------------------------------------------------------- 1 | * bin/backup Take a backup. 2 | * bin/backup v1.0 Take a backup and store the files in backup/v1.0 3 | -------------------------------------------------------------------------------- /src/help/backup_options.txt: -------------------------------------------------------------------------------- 1 | --only-db Backup only the database. 2 | --only-files Backup only the sites/default/files directory. 3 | --only-web Backup only the web directory. 4 | -------------------------------------------------------------------------------- /src/help/build_arguments.txt: -------------------------------------------------------------------------------- 1 | This script has only one (optional) argument: the name for the package without 2 | the extension. Example: "my_site_v1.0" will become "my_site_v1.0.tar.gz". 3 | If no package name is given, an unique name will be created using the 4 | site_name as defined in the config file and the date-time stamp when the 5 | package was created. 6 | -------------------------------------------------------------------------------- /src/help/build_description.txt: -------------------------------------------------------------------------------- 1 | Create a package of the project by packaging all code. 2 | 3 | The build script will collect all the files (core, contrib modules and themes + 4 | custom modules and theme in 1 directory and will compress them as a package in 5 | a tarbal. No Drupal installation will be run. 6 | -------------------------------------------------------------------------------- /src/help/build_examples.txt: -------------------------------------------------------------------------------- 1 | * bin/build Without arguments, the environment is dev. 2 | * bin/build --env=prd Build the website for the "prd" environment. 3 | * bin/build v1.0 Build the project and package as v1.0.tar.gz. 4 | -------------------------------------------------------------------------------- /src/help/build_options.txt: -------------------------------------------------------------------------------- 1 | --no-package Do not compress the package once build. 2 | -------------------------------------------------------------------------------- /src/help/coder_arguments.txt: -------------------------------------------------------------------------------- 1 | All arguments will be passed to the phpcs or phpcbf command. 2 | Use this as calling the commands directly. 3 | -------------------------------------------------------------------------------- /src/help/coder_description.txt: -------------------------------------------------------------------------------- 1 | The coder command is a wrapper around the phpcs (PHP Code Sniffer) binary. 2 | It provides the option to configure default extensions and ignore patterns in 3 | the config/drupal_coder.sh configuration file. 4 | -------------------------------------------------------------------------------- /src/help/coder_examples.txt: -------------------------------------------------------------------------------- 1 | * bin/coder Run code style checks on all the file paths as defined 2 | in the config/drupal_coder.sh $CODER_DIRECTORIES 3 | variable. 4 | * bin/coder dir/file Run code style check on the given directory of file. 5 | -------------------------------------------------------------------------------- /src/help/coder_extra.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Coder specific help:" 2 | source "$DIR_SRC/drupal_coder.sh" 3 | output="$( drupal_coder_run -h )" 4 | echo "${output//phpcs//bin/coder}" 5 | -------------------------------------------------------------------------------- /src/help/coder_options.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/src/help/coder_options.txt -------------------------------------------------------------------------------- /src/help/common_hook_info.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/help/common_options.txt: -------------------------------------------------------------------------------- 1 | --env= The environment to run the script for (default : dev) 2 | --help (-h) Show this help text. 3 | --hook-info Show information about the available hooks. 4 | --no-color Disable all colored output. 5 | --confirm (-y) Skip the confirmation step when the script starts. 6 | --verbose (-v) Verbose. 7 | -------------------------------------------------------------------------------- /src/help/composer_arguments.txt: -------------------------------------------------------------------------------- 1 | All arguments will be passed to the composer command. 2 | Use this as calling composer directly. 3 | -------------------------------------------------------------------------------- /src/help/composer_description.txt: -------------------------------------------------------------------------------- 1 | The composer command is a wrapper around the composer binary. It allows to use 2 | a globally installed composer or a locally copy. 3 | What composer binary to use is defined in the config/config.sh file using the 4 | $COMPOSER_USE_GLOBAL variable. 5 | -------------------------------------------------------------------------------- /src/help/composer_examples.txt: -------------------------------------------------------------------------------- 1 | * bin/composer help Show help about composer. 2 | * bin/composer --version Show the composer version. 3 | -------------------------------------------------------------------------------- /src/help/composer_extra.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Composer specific help:" 2 | output="$( composer_run -h )" 3 | echo "${output//composer//bin/composer}" 4 | -------------------------------------------------------------------------------- /src/help/composer_options.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/src/help/composer_options.txt -------------------------------------------------------------------------------- /src/help/drush_arguments.txt: -------------------------------------------------------------------------------- 1 | All arguments will be passed to the drush command. 2 | Use this as calling drush directly. 3 | -------------------------------------------------------------------------------- /src/help/drush_description.txt: -------------------------------------------------------------------------------- 1 | The drush script is a wrapper around drush. It will execute all commands within 2 | the web directory. 3 | -------------------------------------------------------------------------------- /src/help/drush_examples.txt: -------------------------------------------------------------------------------- 1 | * bin/drush help Show help about drush. 2 | * bin/drush cc all Clear all cache. 3 | -------------------------------------------------------------------------------- /src/help/drush_extra.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Drush specific help:" 2 | output="$( drupal_drush_run -h )" 3 | echo "${output//drush//bin/drush}" 4 | -------------------------------------------------------------------------------- /src/help/drush_options.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/druleton/druleton/7281afc861aa6629a06ac950bb80c773c87ba246/src/help/drush_options.txt -------------------------------------------------------------------------------- /src/help/init_arguments.txt: -------------------------------------------------------------------------------- 1 | Without argumunt all init steps will run. 2 | Use argment to run a single step: 3 | structure Only check and add missing structure elements. 4 | druleton Only update druleton. 5 | config Only create or update the config file. 6 | composer Only install or update composer. 7 | drush Only install or update drush. 8 | coder Only install or update drupal coder. 9 | custom Only create the custom commands symlinks. 10 | -------------------------------------------------------------------------------- /src/help/init_description.txt: -------------------------------------------------------------------------------- 1 | The init script will initiate or update the project environment. 2 | The script will: 3 | * Check if the project structure is in place (created if not). 4 | * Update druleton submodule. 5 | * Set/Update configuration. 6 | * Install or update composer locally. 7 | * Install or update drush locally (if not configured to use global drush). 8 | * Symlink any custom command from within the config/bin to the bin directory. 9 | This allows you to add custom commands to the project. 10 | 11 | Use the command hooks to add init extra requirements (eg. download extra 12 | requirements, install nodejs packages, install packages using composer, ...). 13 | -------------------------------------------------------------------------------- /src/help/init_examples.txt: -------------------------------------------------------------------------------- 1 | * bin/init Without arguments, the environment is dev. 2 | * bin/init --env=prd Init the environment for the "prd" environment. 3 | -------------------------------------------------------------------------------- /src/help/init_options.txt: -------------------------------------------------------------------------------- 1 | --skip-structure Do not check and/or create the file structure. 2 | --skip-druleton Do not check and/or update drulaton submodule. 3 | --skip-config Do not check and/or set the config file. 4 | --skip-composer Do not install/update composer. 5 | --skip-drush Do not check and install drush. 6 | --skip-coder Do not install/update composer. 7 | --skip-custom Do not check and symlink custom commands. 8 | --force (-f) The init script will only download dependencies if they 9 | are not yet downloaded. The force option will delete the 10 | files and download them again. 11 | It will also foce the config file step to prompt for all 12 | the variables. 13 | -------------------------------------------------------------------------------- /src/help/install_arguments.txt: -------------------------------------------------------------------------------- 1 | This script has no arguments. 2 | -------------------------------------------------------------------------------- /src/help/install_description.txt: -------------------------------------------------------------------------------- 1 | The install script will install a new website in the web directory by 2 | downloading Drupal core, contrib modules & themes using the make files in the 3 | configuration directory. 4 | 5 | If there is a working installation: 6 | * A backup of the web directory and the database will be created. 7 | * The web directory will be deleted and all files will be destroyed. 8 | * The database will be overwritten. 9 | -------------------------------------------------------------------------------- /src/help/install_examples.txt: -------------------------------------------------------------------------------- 1 | * bin/install Without arguments, the environment is dev. 2 | * bin/install --env=prd 3 | Install the website for the "prd" environment. 4 | -------------------------------------------------------------------------------- /src/help/install_options.txt: -------------------------------------------------------------------------------- 1 | --no-backup Do not take a backup before the installation is run. 2 | --no-login Do not open a webbrowser and login to the website when 3 | the installation is finished. 4 | -------------------------------------------------------------------------------- /src/help/reset_arguments.txt: -------------------------------------------------------------------------------- 1 | This script has no arguments. 2 | -------------------------------------------------------------------------------- /src/help/reset_description.txt: -------------------------------------------------------------------------------- 1 | The reset script will reset an existing installation by deleting the database, 2 | the sites/default/files directory and running the Drupal installer. 3 | 4 | * A backup of the web directory and the database will be created. 5 | * The web directory will be deleted and all files will be destroyed. 6 | * The database will be overwritten. 7 | -------------------------------------------------------------------------------- /src/help/reset_examples.txt: -------------------------------------------------------------------------------- 1 | * bin/reset Reset the platform. 2 | * bin/reset --env=prd Reset the platform for the "prd" environment. 3 | -------------------------------------------------------------------------------- /src/help/reset_options.txt: -------------------------------------------------------------------------------- 1 | --no-backup Do not take a backup before the reset is run. 2 | --no-login Do not open a webbrowser and login to the website when 3 | the reset is finished. 4 | -------------------------------------------------------------------------------- /src/help/restore_arguments.txt: -------------------------------------------------------------------------------- 1 | There is only one (optional) argument: the name of the directory within the 2 | backup directory that should be used as the source for the restore. 3 | A list of all backups to choose from will be listed if no argument is passed. 4 | -------------------------------------------------------------------------------- /src/help/restore_description.txt: -------------------------------------------------------------------------------- 1 | The restore script will list all the existing backups and ask which should be 2 | restored. 3 | 4 | If there is a working installation: 5 | * A backup of the web directory and the database will be created. 6 | * The web directory will be deleted and replaced by the files in the backup. 7 | * The database will be overwritten with the data in the backup. 8 | -------------------------------------------------------------------------------- /src/help/restore_examples.txt: -------------------------------------------------------------------------------- 1 | * bin/restore Start the restore script, a menu of backup options will 2 | be listed to choose from. 3 | * bin/restore v1.0 Restore the backup located in the backup/v1.0 directory. 4 | -------------------------------------------------------------------------------- /src/help/restore_options.txt: -------------------------------------------------------------------------------- 1 | --no-backup Do not take a backup before restoring another backup. 2 | --no-login Do not open a webbrowser and login to the website when 3 | the restore process is finished. 4 | --only-db Restore only the database. This will keep the web 5 | directory and its files. 6 | --only-files Restore only the sites/default/files directory. This 7 | will keep the existing web and database data. 8 | --only-web Restore only the web directory. This will keep the 9 | existing database data. 10 | -------------------------------------------------------------------------------- /src/help/upgrade_arguments.txt: -------------------------------------------------------------------------------- 1 | This script has no arguments. 2 | -------------------------------------------------------------------------------- /src/help/upgrade_description.txt: -------------------------------------------------------------------------------- 1 | The upgrade script will upgrade an existing website in the web directory by 2 | downloading the latest Drupal core, contrib modules & themes using the make 3 | files in the configuration directory and run the Drupal upgrade script. 4 | 5 | The sites/default directory will be kept, all other files in the web directory 6 | will be deleted and downloaded again. 7 | -------------------------------------------------------------------------------- /src/help/upgrade_examples.txt: -------------------------------------------------------------------------------- 1 | * bin/upgrade Without arguments, the environment is dev. 2 | * bin/upgrade --env=prd 3 | Install the website for the "prd" environment. 4 | -------------------------------------------------------------------------------- /src/help/upgrade_options.txt: -------------------------------------------------------------------------------- 1 | --no-backup Do not take a backup before the upgrade is run. 2 | --no-login Do not open a webbrowser and login to the website when 3 | the upgrade is finished. 4 | -------------------------------------------------------------------------------- /src/hook_info/backup.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Hook information for the Install script. 3 | ################################################################################ 4 | 5 | # Common hook information. 6 | hook_info_run_load "common.sh" 7 | 8 | # Script specific information. 9 | hook_info_run_load "script_before.sh" 10 | hook_info_run_load "backup.sh" 11 | hook_info_run_load "script_after.sh" 12 | -------------------------------------------------------------------------------- /src/hook_info/build.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Hook information for the Install script. 3 | ################################################################################ 4 | 5 | # Common hook information. 6 | hook_info_run_load "common.sh" 7 | 8 | # Script specific information. 9 | hook_info_run_load "script_before.sh" 10 | hook_info_run_load "drupal_make.sh" 11 | hook_info_run_load "build_package.sh" 12 | hook_info_run_load "script_after.sh" 13 | -------------------------------------------------------------------------------- /src/hook_info/coder.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Hook information for the bin/coder script. 3 | ################################################################################ 4 | 5 | # Common hook information. 6 | hook_info_run_load "coder.sh" 7 | -------------------------------------------------------------------------------- /src/hook_info/composer.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Hook information for the bin/composer script. 3 | ################################################################################ 4 | 5 | # Common hook information. 6 | hook_info_run_load "composer.sh" 7 | -------------------------------------------------------------------------------- /src/hook_info/drush.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Hook information for the bin/drush script. 3 | ################################################################################ 4 | 5 | # Common hook information. 6 | hook_info_run_load "drush.sh" 7 | -------------------------------------------------------------------------------- /src/hook_info/hook/backup.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Create backup of existing platform" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}backup_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}backup_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/backup_sites_default.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Move the sites/default directory to a save location" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}backup_sites_default_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}backup_sites_default_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/build_package.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Build package" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}build_package_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}build_package_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/cleanup.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Cleanup files and directories" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}cleanup_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}cleanup_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/coder.sh: -------------------------------------------------------------------------------- 1 | markup_warning "This command does not implement hooks." 2 | -------------------------------------------------------------------------------- /src/hook_info/hook/common.sh: -------------------------------------------------------------------------------- 1 | markup_h1_divider 2 | markup_h1 " Hook information for ${LWHITE}bin/${SCRIPT_NAME}${RESTORE}" 3 | markup_h1_divider 4 | 5 | markup " 6 | The hook system allows you to plugin bash scripts before or after each step in 7 | the script. You can implement hooks specific for your projects (eg. add 8 | symlinks, delete files, set file permissions, ...). 9 | 10 | You can implement a hook before (eg. backup_before.sh) and/or after 11 | (eg. backup_after) a script step. You can implement a general hook 12 | (eg. backup_before.sh) and/or a script specific for the environment the script 13 | is run for (eg. backup_before_tst.sh). 14 | 15 | All the hook scripts should be placed in the ${LWHITE}config/$SCRIPT_NAME/${RESTORE} directory. 16 | 17 | Find out more about the bin/${SCRIPT_NAME} by reading the help: 18 | ${GREY}\$${RESTORE} bin/${SCRIPT_NAME} -h 19 | " 20 | 21 | echo 22 | markup_h1 "Available hooks:" 23 | markup "${GREY}(_${ENVIRONMENT})${RESTORE} is optional. Fill in the environment name you want to run specific 24 | hooks for. The hooks are listed in the order of the script steps. 25 | " 26 | -------------------------------------------------------------------------------- /src/hook_info/hook/composer.sh: -------------------------------------------------------------------------------- 1 | markup_warning "This command does not implement hooks." 2 | -------------------------------------------------------------------------------- /src/hook_info/hook/drupal_install.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Install Drupal" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_install_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_install_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/drupal_login.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Drupal login" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_login_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_login_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/drupal_make.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Drupal Make file(s)" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_make_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_make_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/drupal_modules_disable.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Disable modules & themes" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_modules_disable_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_modules_disable_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/drupal_modules_enable.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Enable modules & themes" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_modules_enable_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_modules_enable_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/drupal_upgrade.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Upgrade Drupal" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_upgrade_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}drupal_upgrade_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/drush.sh: -------------------------------------------------------------------------------- 1 | markup_warning "This command does not implement hooks." 2 | -------------------------------------------------------------------------------- /src/hook_info/hook/init_coder.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Install or update drupal coder" 2 | markup "Will only be called if the installation of coder is not disabled." 3 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}init_coder_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}init_coder_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 5 | " 6 | -------------------------------------------------------------------------------- /src/hook_info/hook/init_composer.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Install or update local composer" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}init_composer_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}init_composer_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/init_config.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Collect and update custom config file variables" 2 | markup "4 hooks need to be implemented:" 3 | markup 4 | 5 | markup "1. Load the current custom variables values:" 6 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}config_load_current${GREY}(_${ENVIRONMENT})${RESTORE}.sh" 7 | markup 8 | 9 | markup "2. Fill in the custom variables:" 10 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}config_collect${GREY}(_${ENVIRONMENT})${RESTORE}.sh" 11 | markup 12 | 13 | markup "3. Show overview of collected data:" 14 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}config_confirm${GREY}(_${ENVIRONMENT})${RESTORE}.sh" 15 | markup 16 | 17 | markup "4. Save custom variables to the config/config.sh file:" 18 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}config_save${GREY}(_${ENVIRONMENT})${RESTORE}.sh" 19 | markup 20 | -------------------------------------------------------------------------------- /src/hook_info/hook/init_custom_commands.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Symlink custom commands" 2 | markup "Will only be called if there are custom commands to symlink." 3 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}init_custom_commands_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}init_custom_commands_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 5 | " 6 | -------------------------------------------------------------------------------- /src/hook_info/hook/init_druleton.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Update druleton" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}init_druleton_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}init_druleton_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/init_drush.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Install or update local drush" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}init_drush_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}init_drush_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/init_structure.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Check & Install/Update the project file structure" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}init_structure_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}init_structure_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/restore.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Restore platform from a backup" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}restore_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}restore_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/restore_sites_default.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Move the sites/default directory back to the web directory" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}restore_sites_default_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh 3 | ${GREY}config/${SCRIPT_NAME}/${RESTORE}restore_sites_default_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh 4 | " 5 | -------------------------------------------------------------------------------- /src/hook_info/hook/script_after.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "After the script has run" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}script_after${GREY}(_${ENVIRONMENT})${RESTORE}.sh" 3 | echo 4 | -------------------------------------------------------------------------------- /src/hook_info/hook/script_before.sh: -------------------------------------------------------------------------------- 1 | markup_h2 "Before the script is run" 2 | markup "${GREY}config/${SCRIPT_NAME}/${RESTORE}script_before${GREY}(_${ENVIRONMENT})${RESTORE}.sh" 3 | echo 4 | -------------------------------------------------------------------------------- /src/hook_info/init.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Hook information for the Install script. 3 | ################################################################################ 4 | 5 | # Common hook information. 6 | hook_info_run_load "common.sh" 7 | 8 | # Script specific information. 9 | hook_info_run_load "script_before.sh" 10 | hook_info_run_load "init_structure.sh" 11 | hook_info_run_load "init_druleton.sh" 12 | hook_info_run_load "init_config.sh" 13 | hook_info_run_load "init_composer.sh" 14 | hook_info_run_load "init_drush.sh" 15 | hook_info_run_load "init_coder.sh" 16 | hook_info_run_load "init_custom_commands.sh" 17 | hook_info_run_load "script_after.sh" 18 | -------------------------------------------------------------------------------- /src/hook_info/install.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Hook information for the Install script. 3 | ################################################################################ 4 | 5 | # Common hook information. 6 | hook_info_run_load "common.sh" 7 | 8 | # Script specific information. 9 | hook_info_run_load "script_before.sh" 10 | hook_info_run_load "backup.sh" 11 | hook_info_run_load "cleanup.sh" 12 | hook_info_run_load "drupal_make.sh" 13 | hook_info_run_load "drupal_install.sh" 14 | hook_info_run_load "drupal_modules_disable.sh" 15 | hook_info_run_load "drupal_modules_enable.sh" 16 | hook_info_run_load "drupal_login.sh" 17 | hook_info_run_load "script_after.sh" 18 | -------------------------------------------------------------------------------- /src/hook_info/reset.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Hook information for the Reset script. 3 | ################################################################################ 4 | 5 | # Common hook information. 6 | hook_info_run_load "common.sh" 7 | 8 | # Script specific information. 9 | hook_info_run_load "script_before.sh" 10 | hook_info_run_load "backup.sh" 11 | hook_info_run_load "cleanup.sh" 12 | hook_info_run_load "drupal_install.sh" 13 | hook_info_run_load "drupal_modules_disable.sh" 14 | hook_info_run_load "drupal_modules_enable.sh" 15 | hook_info_run_load "drupal_login.sh" 16 | hook_info_run_load "script_after.sh" 17 | -------------------------------------------------------------------------------- /src/hook_info/restore.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Hook information for the Install script. 3 | ################################################################################ 4 | 5 | # Common hook information. 6 | hook_info_run_load "common.sh" 7 | 8 | # Script specific information. 9 | hook_info_run_load "script_before.sh" 10 | hook_info_run_load "backup.sh" 11 | hook_info_run_load "restore.sh" 12 | hook_info_run_load "script_after.sh" 13 | -------------------------------------------------------------------------------- /src/hook_info/upgrade.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Hook information for the Install script. 3 | ################################################################################ 4 | 5 | # Common hook information. 6 | hook_info_run_load "common.sh" 7 | 8 | # Script specific information. 9 | hook_info_run_load "script_before.sh" 10 | hook_info_run_load "backup.sh" 11 | hook_info_run_load "backup_sites_default.sh" 12 | hook_info_run_load "cleanup.sh" 13 | hook_info_run_load "drupal_make.sh" 14 | hook_info_run_load "restore_sites_default.sh" 15 | hook_info_run_load "drupal_upgrade.sh" 16 | hook_info_run_load "drupal_login.sh" 17 | hook_info_run_load "script_after.sh" 18 | -------------------------------------------------------------------------------- /src/include/colors.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that holds the color definitions for text. 3 | ################################################################################ 4 | 5 | # Define the colors only if the are wanted. 6 | if [ $( option_is_set "--no-color" ) -ne 1 ]; then 7 | 8 | # Restore to default colours 9 | RESTORE='\033[0m' 10 | 11 | # Simple colors 12 | BLACK='\033[00;30m' 13 | RED='\033[00;31m' 14 | GREEN='\033[00;32m' 15 | YELLOW='\033[00;33m' 16 | BLUE='\033[00;34m' 17 | MAGENTA='\033[00;35m' 18 | CYAN='\033[00;36m' 19 | WHITE='\033[00;37m' 20 | GREY='\033[01;30m' 21 | 22 | # Bold (lighter) 23 | LBLACK='\033[01;30m' 24 | LRED='\033[01;31m' 25 | LGREEN='\033[01;32m' 26 | LYELLOW='\033[01;33m' 27 | LBLUE='\033[01;34m' 28 | LMAGENTA='\033[01;35m' 29 | LCYAN='\033[01;36m' 30 | LWHITE='\033[01;37m' 31 | 32 | # Predefined background colours 33 | BGBLACK='\033[00;40;37m' 34 | BGRED='\033[00;41;37m' 35 | BGGREEN='\033[00;42;30m' 36 | BGYELLOW='\033[00;43;30m' 37 | BGBLUE='\033[00;44;37m' 38 | BGMAGENTA='\033[00;45;30m' 39 | BGCYAN='\033[00;46;30m' 40 | BGWHITE='\033[00;47;30m' 41 | 42 | # Predefined background colours with lighter foreground 43 | BGLBLACK='\033[01;40;37m' 44 | BGLRED='\033[01;41;37m' 45 | BGLGREEN='\033[01;42;37m' 46 | BGLYELLOW='\033[01;43;37m' 47 | BGLBLUE='\033[01;44;37m' 48 | BGLMAGENTA='\033[01;45;37m' 49 | BGLCYAN='\033[01;46;37m' 50 | BGLWHITE='\033[01;47;30m' 51 | 52 | fi 53 | -------------------------------------------------------------------------------- /src/include/composer.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that holds helper functions about Composer. 3 | ################################################################################ 4 | 5 | ## 6 | # Run a composer command. 7 | # 8 | # This will run the bin/composer command with surpression of the XDEBUG warning. 9 | ## 10 | function composer_run { 11 | local cmd_composer="$DIR_BIN/packagist/composer.phar" 12 | local cmd_options="" 13 | 14 | # Only use colors if not disabled. 15 | if [ $( option_is_set "--no-color") -ne 1 ]; then 16 | cmd_options="$options --ansi" 17 | else 18 | cmd_options="$options --no-ansi" 19 | fi 20 | 21 | if [ "$COMPOSER_USE_GLOBAL" = "1" ]; then 22 | cmd_composer="composer" 23 | fi 24 | 25 | local cmd="$cmd_composer $cmd_options" 26 | COMPOSER_DISABLE_XDEBUG_WARN=1 $cmd "$@" 27 | } 28 | 29 | ## 30 | # Run a composer command within the druleton context. 31 | # 32 | # Use this to perform composer commands on the set of packages required and 33 | # installed by druleton. 34 | ## 35 | function composer_skeleton_run { 36 | composer_run "$@" --working-dir="$DIR_BIN/packagist" 37 | } 38 | 39 | ## 40 | # Make sure that a COMPOSER_USE_GLOBAL variable is set. 41 | ## 42 | function composer_variable_use_global { 43 | if [ "$COMPOSER_USE_GLOBAL" != "1" ]; then 44 | COMPOSER_USE_GLOBAL=0 45 | fi 46 | } 47 | 48 | 49 | ## 50 | # Create the $COMPOSER_OPTIONS array based on the $SCRIPT_OPTIONS_ALL array. 51 | ## 52 | function composer_filter_options { 53 | COMPOSER_OPTIONS=() 54 | 55 | markup_debug "Filter composer options:" 56 | 57 | for composer_option in "${SCRIPT_OPTIONS_ALL[@]}"; do 58 | # Check if the option should be passed to composer. 59 | if [ $(composer_filter_option "$composer_option") -eq 1 ]; then 60 | markup_debug " • $composer_option" 61 | else 62 | COMPOSER_OPTIONS+=("$composer_option") 63 | fi 64 | done 65 | 66 | markup_debug 67 | } 68 | 69 | ## 70 | # Remove druleton specific command options. 71 | # 72 | # @param string 73 | # The command options. 74 | # 75 | # @return string 76 | # The filtered options. 77 | ## 78 | function composer_filter_option { 79 | local option="$1" 80 | 81 | # Druleton uses --no-color, composer does not support it. 82 | if [ "$option" == "--no-color" ]; then 83 | echo 1 84 | return 85 | fi 86 | 87 | # composer has no confirm option. 88 | if [ "$option" == "-y" ] || [ "option" == "--confirm" ]; then 89 | echo 1 90 | return 91 | fi 92 | 93 | # composer does not support environments. 94 | if [[ "$option" == "--env="* ]]; then 95 | echo 1 96 | return 97 | fi 98 | 99 | echo 0 100 | } 101 | -------------------------------------------------------------------------------- /src/include/drupal.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that holds helper functions about Drupal. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Run drush from within the Drupal root ($DIR_WEB folder). 8 | # 9 | # Use this if you need to run the drush command from within the actual web root. 10 | # Do not use it when installing the make files. 11 | # 12 | # 13 | ## 14 | function drupal_drush { 15 | drupal_drush_run "$@" --root="$DIR_WEB" 16 | } 17 | 18 | ## 19 | # Run drush. 20 | # 21 | # This command will run by default the globally installed drush. 22 | # If the $DRUSH_VERSION is set to a specific version, then it will expect drush 23 | # to be installed using composer and will run drush from within the 24 | # bin/vendor/bin directory. 25 | ## 26 | function drupal_drush_run { 27 | local cmd_drush="" 28 | 29 | if [ -z "$DRUSH_VERSION" ] || [ "$DRUSH_VERSION" == "phar" ]; then 30 | cmd_drush="$DIR_BIN/packagist/drush.phar" 31 | elif [ "$DRUSH_VERSION" == "global" ]; then 32 | cmd_drush="drush" 33 | else 34 | cmd_drush="$DIR_BIN/packagist/vendor/bin/drush" 35 | fi 36 | 37 | $cmd_drush "$@" 38 | } 39 | 40 | ## 41 | # Create the $DRUSH_OPTIONS array based on the $SCRIPT_OPTIONS_ALL array. 42 | ## 43 | function drupal_drush_filter_options { 44 | DRUSH_OPTIONS=() 45 | 46 | markup_debug "Filter drush options:" 47 | 48 | for drush_option in "${SCRIPT_OPTIONS_ALL[@]}"; do 49 | # Check if the option should be passed to drush. 50 | if [ $(drupal_drush_filter_option "$drush_option") -eq 1 ]; then 51 | markup_debug " • $drush_option" 52 | else 53 | DRUSH_OPTIONS+=("$drush_option") 54 | fi 55 | done 56 | 57 | markup_debug 58 | } 59 | 60 | ## 61 | # Remove druleton specific command options. 62 | # 63 | # @param string 64 | # The command options. 65 | # 66 | # @return string 67 | # The filtered options. 68 | ## 69 | function drupal_drush_filter_option { 70 | local option="$1" 71 | 72 | # Druleton uses --no-color, drush does not support that. 73 | if [ "$option" == "--no-color" ]; then 74 | echo 1 75 | return 76 | fi 77 | 78 | # drush does not support environments. 79 | if [[ "$option" == "--env="* ]]; then 80 | echo 1 81 | return 82 | fi 83 | 84 | echo 0 85 | } 86 | 87 | ## 88 | # Make sure that the DRUSH_VERSION variable is set. 89 | ## 90 | function drupal_drush_variable_version { 91 | if [ -z "$DRUSH_VERSION" ]; then 92 | DRUSH_VERSION="phar" 93 | fi 94 | } 95 | 96 | ## 97 | # Check if there is a working Drupak installation. 98 | # 99 | # @return is installed 1/0 100 | ## 101 | function drupal_is_installed { 102 | drupal_is_installed_string=`drupal_drush status grep "Drupal bootstrap" \ 103 | | grep "Successful"` 104 | 105 | if [[ "$drupal_is_installed_string" != "" ]]; then 106 | echo 1 107 | return 108 | fi 109 | 110 | echo 0 111 | } 112 | 113 | 114 | ## 115 | # Remove the protection from the sites/default directory. 116 | ## 117 | function drupal_sites_default_unprotect { 118 | if [ -d "$DIR_WEB/sites/default" ]; then 119 | chmod -R u+w "$DIR_WEB/sites/default" 120 | fi 121 | } 122 | 123 | ## 124 | # Restore the protection of the sites/default directory. 125 | ## 126 | function drupal_sites_default_protect { 127 | if [ -f "$DIR_WEB/sites/default/settings.php" ]; then 128 | chmod a-w "$DIR_WEB/sites/default/settings.php" 129 | fi 130 | 131 | if [ -d "$DIR_WEB/sites/default" ]; then 132 | chmod a-w "$DIR_WEB/sites/default" 133 | fi 134 | } 135 | -------------------------------------------------------------------------------- /src/include/file.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that holds helper functions about the file system. 3 | ################################################################################ 4 | 5 | ## 6 | # Get a list of directories within the given path. 7 | # 8 | # @param string The path to list the directories in. 9 | # 10 | # @return The directory names: 1 directory name per directory. 11 | ## 12 | function file_list_subdirectories { 13 | if [ -z "$1" ]; then 14 | return 15 | fi 16 | 17 | ls -l "$1" | grep "^d" | awk -F" " '{print $NF}' 18 | } 19 | 20 | ## 21 | # Symlink all directories within the source directory to the target directory. 22 | # 23 | # @param string $1 24 | # The source directory. 25 | # @param string $2 26 | # The target directory. 27 | ## 28 | function file_symlink_subdirectories { 29 | local directories=$(file_list_subdirectories "$1") 30 | if [ -z "$directories" ]; then 31 | message_warning "No directories to link." 32 | return 33 | fi 34 | 35 | if [ ! -d "$2" ]; then 36 | message_error "Target directory does not exists." 37 | fi 38 | 39 | for directory in $directories 40 | do 41 | ln -s "$1/$directory" "$2/$directory" 42 | message_success "$directory" 43 | done 44 | } 45 | 46 | ## 47 | # Copy all directories within the source directory to the target directory. 48 | # 49 | # @param string $1 50 | # The source directory. 51 | # @param string $2 52 | # The target directory. 53 | ## 54 | function file_copy_subdirectories { 55 | local directories=$(file_list_subdirectories "$1") 56 | if [ -z "$directories" ]; then 57 | message_warning "No directories to copy." 58 | return 59 | fi 60 | 61 | if [ ! -d "$2" ]; then 62 | message_error "Target directory does not exists." 63 | fi 64 | 65 | for directory in $directories 66 | do 67 | cp -R "$1/$directory" "$2/$directory" 68 | message_success "$directory" 69 | done 70 | } 71 | -------------------------------------------------------------------------------- /src/include/help.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that holds the help functionality. 3 | ################################################################################ 4 | 5 | ## 6 | # Function to load the help text(s). 7 | # 8 | # The help text is loaded based on the default "core" script help and the 9 | # optional help text as defined in the config/$SCRIPT_NAME/help.txt file. 10 | ## 11 | function help_run { 12 | echo 13 | help_run_load "$DIR_SRC/help/${SCRIPT_NAME}_description.txt" 14 | help_run_load "$DIR_CONFIG_SRC/help/${SCRIPT_NAME}_description.txt" 15 | echo 16 | 17 | markup_h2 "Examples:" 18 | help_run_load "$DIR_SRC/help/${SCRIPT_NAME}_examples.txt" 19 | help_run_load "$DIR_CONFIG_SRC/help/${SCRIPT_NAME}_examples.txt" 20 | help_run_load "$DIR_SRC/help/common_examples.txt" 21 | echo 22 | 23 | markup_h2 "Arguments:" 24 | help_run_load "$DIR_SRC/help/${SCRIPT_NAME}_arguments.txt" 25 | help_run_load "$DIR_CONFIG_SRC/help/${SCRIPT_NAME}_arguments.txt" 26 | help_run_load "$DIR_SRC/help/common_arguments.txt" 27 | echo 28 | 29 | markup_h2 "Options:" 30 | help_run_load "$DIR_SRC/help/${SCRIPT_NAME}_options.txt" 31 | help_run_load "$DIR_CONFIG_SRC/help/${SCRIPT_NAME}_options.txt" 32 | help_run_load "$DIR_SRC/help/common_options.txt" 33 | echo 34 | 35 | # Check if there are extra's to show. 36 | # Use this for binary wrappers like bin/drush, bin/composer, ... 37 | if [ -f "$DIR_SRC/help/${SCRIPT_NAME}_extra.sh" ]; then 38 | source "$DIR_SRC/help/${SCRIPT_NAME}_extra.sh" 39 | echo 40 | fi 41 | if [ -f "$DIR_CONFIG_SRC/help/${SCRIPT_NAME}_extra.sh" ]; then 42 | source "$DIR_CONFIG_SRC/help/${SCRIPT_NAME}_extra.sh" 43 | echo 44 | fi 45 | 46 | exit 47 | } 48 | 49 | ## 50 | # Load a help file (if exists) and print out on screen. 51 | # 52 | # @param Path to the help file. 53 | ## 54 | function help_run_load { 55 | local content="" 56 | 57 | if [ -f "$1" ]; then 58 | content="$(cat $1)" 59 | fi 60 | 61 | if [ ! -z "$content" ]; then 62 | markup "$content" 63 | fi 64 | } 65 | 66 | 67 | # Detect if the help is called. 68 | if [ $( option_is_set "--help" ) -eq 1 ]; then 69 | help_run 70 | fi 71 | if [ $( option_is_set "-h" ) -eq 1 ]; then 72 | help_run 73 | fi 74 | -------------------------------------------------------------------------------- /src/include/hook.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that holds the code to check and run a hook script file. 3 | ################################################################################ 4 | 5 | ## 6 | # Call a hook by providing the hook name. 7 | # 8 | # It will try to run 2 hook scripts: 9 | # 1. The hook by the script that is run name. 10 | # e.g. config//.sh 11 | # 2. The hook by the script that is run and the environment for who its run. 12 | # e.g. config//_.sh 13 | # 14 | # @param hook name. 15 | ## 16 | function hook_invoke { 17 | local hook_invoke_name="$1" 18 | 19 | # Invoke the script for the script name. 20 | hook_invoke_script "$SCRIPT_NAME/${hook_invoke_name}.sh" 21 | 22 | # Invoke the script for the script and environment name. 23 | hook_invoke_script "$SCRIPT_NAME/${hook_invoke_name}_$ENVIRONMENT.sh" 24 | } 25 | 26 | ## 27 | # Check if the hook script exists, if so include it so it is run. 28 | # 29 | # @param file path within the config folder of the hook script to run. 30 | ## 31 | function hook_invoke_script { 32 | local hook_invoke_script="$1" 33 | if [ -f "$DIR_CONFIG/$hook_invoke_script" ]; then 34 | markup_debug "Run hook : $hook_invoke_script" 1 35 | source "$DIR_CONFIG/$hook_invoke_script" 36 | echo 37 | else 38 | markup_debug "Hook not implemented : $hook_invoke_script" 39 | fi 40 | } 41 | 42 | ## 43 | # Function to load the help text(s). 44 | # 45 | # The help text is loaded based on the default "core" script help and the 46 | # optional help text as defined in the config/$SCRIPT_NAME/help.txt file. 47 | ## 48 | function hook_info_run { 49 | echo 50 | if [ ! -f "$DIR_SRC/hook_info/${SCRIPT_NAME}.sh" ]; then 51 | message_error "No hook info available for this command." 52 | echo 53 | exit 54 | fi 55 | 56 | source "$DIR_SRC/hook_info/${SCRIPT_NAME}.sh" 57 | echo 58 | exit 59 | } 60 | 61 | ## 62 | # Load a hook info file. 63 | # 64 | # @param The path to the file to load. 65 | ## 66 | function hook_info_run_load { 67 | local hook_info="$DIR_SRC/hook_info/hook/$1" 68 | if [ -f "$hook_info" ]; then 69 | source "$hook_info" 70 | fi 71 | } 72 | 73 | 74 | # Detect if the hook_info is called. 75 | if [ $( option_is_set "--hook-info" ) -eq 1 ]; then 76 | hook_info_run 77 | fi 78 | -------------------------------------------------------------------------------- /src/include/markup.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that holds the code to markup the given string. 3 | ################################################################################ 4 | 5 | ## 6 | # Prints a line with support for color variables (eg. ${LWHITE}, ${YELLOW}). 7 | # 8 | # @param string test to show in the markup. 9 | ## 10 | function markup { 11 | echo -e "$1${RESTORE}" 12 | } 13 | 14 | ## 15 | # Show a line as a main header (h1). 16 | # 17 | # This will result in text in blue. 18 | # 19 | # @param string test to show in the markup 20 | ## 21 | function markup_h1 { 22 | markup "${LBLUE}$1" 23 | } 24 | 25 | ## 26 | # Show a line as a secundary header (h2). 27 | # 28 | # This will result in text in light white. 29 | # 30 | # @param string text to show in the markup 31 | ## 32 | function markup_h2 { 33 | markup "${YELLOW}$1" 34 | } 35 | 36 | ## 37 | # Show a line as a tertiary header (h3). 38 | # 39 | # This will result in text in light white. 40 | # 41 | # @param string text to show in the markup 42 | ## 43 | function markup_h3 { 44 | markup "${MAGENTA}$1" 45 | } 46 | 47 | ## 48 | # Show a line of text as a success. 49 | # 50 | # The whole line will be shown in green. 51 | # 52 | # @param string text to show in the markup. 53 | ## 54 | function markup_success { 55 | markup "${GREEN}$1" 56 | } 57 | 58 | ## 59 | # Show a line of text as a warning. 60 | # 61 | # The whole line will be shown in yellow. 62 | # 63 | # @param string text to show in the markup. 64 | ## 65 | function markup_warning { 66 | markup "${YELLOW}$1" 67 | } 68 | 69 | ## 70 | # Show a line of text as an error. 71 | # 72 | # The whole line will be shown in red. 73 | # 74 | # @param string text to show in the markup. 75 | ## 76 | function markup_error { 77 | markup "${RED}$1" 78 | } 79 | 80 | ## 81 | # Show a line of text as info. 82 | # 83 | # The whole line will be shown in cyan. 84 | # 85 | # @param string text to show in the markup. 86 | ## 87 | function markup_info { 88 | markup "${CYAN}$1" 89 | } 90 | 91 | ## 92 | # Show an item as a list item. 93 | # 94 | # @param string The text to show in the bullet. 95 | # @param string (optional) The text to show as a value. 96 | ## 97 | function markup_li { 98 | markup " ${GREY}•${RESTORE} $1" 99 | } 100 | 101 | ## 102 | # Show an item together with a value 103 | # 104 | # The result will be like: 105 | # • Text input : Value 106 | # 107 | # @param string The text to show in the bullet. 108 | # @param string (optional) The text to show as a value. 109 | ## 110 | function markup_li_value { 111 | markup_li "$1 : ${GREEN}$2" 112 | } 113 | 114 | ## 115 | # Show an item as a list item within a h1. 116 | # 117 | # @param The text to show in the bullet. 118 | ## 119 | function markup_h1_li { 120 | markup " ${BLUE}•${LBLUE} $1" 121 | } 122 | 123 | ## 124 | # Show text as a debug message. 125 | # 126 | # @param The text to show in the debug message. 127 | # @param Should there be a newline after the debug message. 128 | ## 129 | function markup_debug { 130 | if [ $(option_is_set "-v") -ne 1 ] && [ $(option_is_set "--verbose") -ne 1 ]; then 131 | return 132 | fi 133 | 134 | markup "${GREY}$1" 135 | if [ ! -z "$2" ]; then 136 | echo 137 | fi 138 | } 139 | 140 | 141 | ## 142 | # Show a horizontal divider. 143 | ## 144 | function markup_divider { 145 | markup "================================================================================" 146 | } 147 | 148 | ## 149 | # Show a horizontal divider within a h1. 150 | ## 151 | function markup_h1_divider { 152 | markup_h1 "================================================================================" 153 | } 154 | -------------------------------------------------------------------------------- /src/include/message.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that holds the code to show messages on screen. 3 | ################################################################################ 4 | 5 | ## 6 | # Function to show a success message. 7 | # 8 | # @param string message 9 | ## 10 | function message_success { 11 | markup " ${GREEN}✓${RESTORE} $1" 12 | } 13 | 14 | ## 15 | # Function to show a warning message. 16 | # 17 | # @param string message 18 | ## 19 | function message_warning { 20 | markup " ${YELLOW}!${RESTORE} $1" 21 | } 22 | 23 | ## 24 | # Function to show an error message. 25 | # 26 | # @param string message 27 | ## 28 | function message_error { 29 | markup " ${RED}✗ $1" 30 | } 31 | 32 | ## 33 | # Function to show a tip message. 34 | # 35 | # @param string message 36 | ## 37 | function message_info { 38 | markup " ${CYAN}ⓘ $1" 39 | } 40 | -------------------------------------------------------------------------------- /src/include/options.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that reads out the script arguments. 3 | ################################################################################ 4 | 5 | # Loop trough the arguments and store them in the options array. 6 | SCRIPT_OPTIONS_ALL=() 7 | SCRIPT_OPTIONS=() 8 | SCRIPT_ARGUMENT="" 9 | while [ "$#" -gt 0 ]; do 10 | SCRIPT_OPTIONS_ALL+=("$1") 11 | 12 | if [[ $1 == -* ]]; then 13 | SCRIPT_OPTIONS+=("$1") 14 | else 15 | SCRIPT_ARGUMENT="$1" 16 | fi 17 | 18 | shift 19 | done 20 | 21 | ## 22 | # Function to check if a given option is set. 23 | # 24 | # @param The option name (including - or --) to check for. 25 | ## 26 | function option_is_set { 27 | for option in ${SCRIPT_OPTIONS[@]}; do 28 | if [[ "$option" == "$1" ]] || [[ "$option" == "$1="* ]]; then 29 | echo 1 30 | return 31 | fi 32 | done 33 | 34 | echo 0 35 | } 36 | 37 | ## 38 | # Get the value from an option. 39 | # 40 | # @param The option name (including - or --) to get the value from. 41 | ## 42 | function option_get_value { 43 | if [ $(option_is_set "$1") -ne 1 ]; then 44 | echo "" 45 | return 46 | fi 47 | 48 | for option in ${SCRIPT_OPTIONS[@]}; do 49 | if [[ "$option" == "$1" ]]; then 50 | echo 1 51 | return 52 | fi 53 | 54 | if [[ "$option" == "$1="* ]]; then 55 | echo "${option#*=}" 56 | return 57 | fi 58 | done 59 | 60 | echo 0 61 | } 62 | 63 | ## 64 | # Get the environment from the argument. 65 | ## 66 | function option_get_environment { 67 | local environment=$(option_get_value "--env") 68 | if [ -z "$environment" ]; then 69 | echo "dev" 70 | return 71 | fi 72 | 73 | echo "$environment" 74 | } 75 | -------------------------------------------------------------------------------- /src/include/prompt.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that holds the code to ask user for input. 3 | ################################################################################ 4 | 5 | ## 6 | # Show a prompt on 2 lines. 7 | # 8 | # - First line: the question with optional default value. 9 | # - Second line: a prompt to fill in the response. 10 | # 11 | # @param string the question to ask 12 | # @param string (optional) the default answer if nothing is filled in. 13 | # 14 | # The result will be stored in the $REPLY variable. 15 | ## 16 | function prompt { 17 | local question="$1" 18 | local default="$2" 19 | local color="${GREEN}" 20 | 21 | echo -e -n "${question}" 22 | 23 | if [ "$2" != "" ]; then 24 | echo -e -n " ${GREY}($2)${RESTORE}" 25 | fi 26 | 27 | echo ":" 28 | 29 | echo -e -n "${GREY} > ${color}" 30 | read 31 | echo -e -n "${RESTORE}" 32 | 33 | # Read the reply, fallback to default if no reply entered. 34 | REPLY="${REPLY:-$default}" 35 | } 36 | 37 | ## 38 | # Show a y/n prompt. 39 | # 40 | # - The [y/n] option will be added automatically to the question string. 41 | # - The REPLY will contain 1 (y) or 0 (no). 42 | # 43 | # @param string the question to ask 44 | # @param string (optional) the default answer if nothing is filled in. 45 | # 46 | # The result will be stored in the $REPLY variable. 47 | ## 48 | function prompt_yn { 49 | local question="$1" 50 | local default 51 | 52 | # Translate the default to y or n. 53 | case $2 in 54 | 1|Y|y) 55 | default="y" 56 | ;; 57 | 58 | 0|N|n) 59 | default="n" 60 | ;; 61 | 62 | *) 63 | default="" 64 | ;; 65 | esac 66 | 67 | # Ask the question. 68 | prompt "${question} [y/n]?" "${default}" 69 | 70 | # Check the answer. 71 | case $REPLY in 72 | 1|Y|y) 73 | REPLY=1 74 | ;; 75 | 76 | 0|N|n) 77 | REPLY=0 78 | ;; 79 | 80 | *) 81 | message_error "Not a valid entry!" 82 | echo 83 | 84 | # Ask the question again. 85 | prompt_yn "${question}" "${default}" 86 | ;; 87 | esac 88 | } 89 | 90 | ## 91 | # Show a confirm prompt. 92 | # 93 | # This is the same as prompt_yn but the question will be in a different color 94 | # to attract more attention. 95 | # 96 | # - The [y/n] option will be added automatically to the question string. 97 | # - The REPLY will contain 1 (y) or 0 (no). 98 | # 99 | # @param string the question to ask 100 | # @param string (optional) the default answer if nothing is filled in. 101 | # 102 | # The result will be stored in the $REPLY variable. 103 | ## 104 | function prompt_confirm { 105 | prompt_yn "${MAGENTA}$1" "$2" 106 | } 107 | 108 | ## 109 | # Show a confirm prompt when a command is called. 110 | # 111 | # This is a wrapper around prompt_confirm. 112 | # 113 | # If the answer is a negative confirm, then the command will be terminated with 114 | # the given message. 115 | # 116 | # If the -y option is used (confirm) then no questions will be asked. 117 | # 118 | # @param string (optional) The question to ask. 119 | # @param string (optional) The message when a negative confirmation was entered. 120 | ## 121 | function prompt_confirm_or_exit { 122 | # Check first if already confirmed by passing the -y option. 123 | if [ $CONFIRMED -eq 1 ]; then 124 | return 125 | fi 126 | 127 | # Get the parameters, fallback to default if none given. 128 | local question="${1:-Are you sure}" 129 | local abort_msg="${2}" 130 | 131 | # Fallback to command name if no abort message was provided. 132 | if [ "$abort_msg" = "" ]; then 133 | local abort_msg="${SCRIPT_NAME:-Command} aborted" 134 | 135 | # Make sure the sentence starts with a capital letter. 136 | abort_msg="$(tr '[:lower:]' '[:upper:]' <<< ${abort_msg:0:1})${abort_msg:1}" 137 | fi 138 | 139 | # Ask the question. 140 | prompt_confirm "${question}" "n" 141 | 142 | # Abort when negative answer is received. 143 | if [ $REPLY -ne 1 ]; then 144 | markup_warning "! ${abort_msg}" 145 | echo 146 | exit 1 147 | fi 148 | 149 | echo 150 | } 151 | -------------------------------------------------------------------------------- /src/init.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to init druleton. 3 | ################################################################################ 4 | 5 | ## 6 | # Initiate the init process. 7 | ## 8 | function init_init { 9 | # Default everything is skipped. 10 | INIT_OPTION_SKIP_STRUCTURE=1 11 | INIT_OPTION_SKIP_DRULETON=1 12 | INIT_OPTION_SKIP_CONFIG=1 13 | INIT_OPTION_SKIP_COMPOSER=1 14 | INIT_OPTION_SKIP_DRUSH=1 15 | INIT_OPTION_SKIP_CODER=1 16 | INIT_OPTION_SKIP_CUSTOM=1 17 | 18 | # Check if a specific argument was provided. 19 | case "$SCRIPT_ARGUMENT" in 20 | structure) 21 | INIT_OPTION_SKIP_STRUCTURE=0 22 | ;; 23 | 24 | druleton) 25 | INIT_OPTION_SKIP_DRULETON=0 26 | ;; 27 | 28 | config) 29 | INIT_OPTION_SKIP_CONFIG=0 30 | ;; 31 | 32 | composer) 33 | INIT_OPTION_SKIP_COMPOSER=0 34 | ;; 35 | 36 | drush) 37 | INIT_OPTION_SKIP_DRUSH=0 38 | ;; 39 | 40 | coder) 41 | INIT_OPTION_SKIP_CODER=0 42 | ;; 43 | 44 | custom) 45 | INIT_OPTION_SKIP_CUSTOM=0 46 | ;; 47 | 48 | "") 49 | # No option, check --skip- options. 50 | INIT_OPTION_SKIP_STRUCTURE=$(option_is_set "--skip-structure") 51 | INIT_OPTION_SKIP_DRULETON=$(option_is_set "--skip-druleton") 52 | INIT_OPTION_SKIP_CONFIG=$(option_is_set "--skip-config") 53 | INIT_OPTION_SKIP_COMPOSER=$(option_is_set "--skip-composer") 54 | INIT_OPTION_SKIP_DRUSH=$(option_is_set "--skip-drush") 55 | INIT_OPTION_SKIP_CODER=$(option_is_set "--skip-coder") 56 | INIT_OPTION_SKIP_CUSTOM=$(option_is_set "--skip-custom") 57 | ;; 58 | 59 | *) 60 | # Other arguments not supported! 61 | message_warning "Argument ${LRED}${SCRIPT_ARGUMENT}${RED} not supported!" 62 | ;; 63 | 64 | esac 65 | } 66 | 67 | ## 68 | # Init info. 69 | ## 70 | function init_info { 71 | echo 72 | markup_h1_divider 73 | markup_h1 " ${LWHITE}Initiate/update${LBLUE} environment for website ${WHITE}$SITE_NAME${LBLUE} ($ENVIRONMENT)" 74 | markup_h1_divider 75 | 76 | if [ $INIT_OPTION_SKIP_STRUCTURE -ne 1 ]; then 77 | markup_h1_li "Check if the project structure is in place (created if not)." 78 | fi 79 | if [ $INIT_OPTION_SKIP_DRULETON -ne 1 ]; then 80 | markup_h1_li "Update druleton if installed as submodule." 81 | fi 82 | if [ $INIT_OPTION_SKIP_CONFIG -ne 1 ]; then 83 | markup_h1_li "Set/Update configuration." 84 | fi 85 | if [ $INIT_OPTION_SKIP_COMPOSER -ne 1 ]; then 86 | markup_h1_li "Composer will be installed or updated in the bin/ directory." 87 | fi 88 | if [ $INIT_OPTION_SKIP_DRUSH -ne 1 ]; then 89 | markup_h1_li "Drush will be installed (or global installed drush will be used)." 90 | fi 91 | if [ $INIT_OPTION_SKIP_CODER -ne 1 ]; then 92 | markup_h1_li "Drupal coder will be installed or updated." 93 | fi 94 | if [ $INIT_OPTION_SKIP_CUSTOM -ne 1 ]; then 95 | markup_h1_li "Any custom command will be included in the bin/ directory." 96 | fi 97 | 98 | markup_h1_divider 99 | echo 100 | } 101 | 102 | ## 103 | # The init script is finished information. 104 | ## 105 | function init_finished { 106 | markup_h1_divider 107 | markup_success " Finished" 108 | markup_h1_divider 109 | echo 110 | } 111 | -------------------------------------------------------------------------------- /src/init_coder.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to install or update drupal/coder locally. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Install (or update) & configure drupal/coder packages. 8 | # 9 | # This script will trigger 2 "hooks" in the config// directory: 10 | # - init_coder_before : Scripts that should run before coder is 11 | # installed/updated. 12 | # - init_coder_after : Scripts that should run after coder is 13 | # installed/updated. 14 | # 15 | # The hooks will be called without and with environment suffix. 16 | # The hooks will only be called if installing coder is not disabled. 17 | ## 18 | function init_coder_run { 19 | # Check not skipped. 20 | if [ $INIT_OPTION_SKIP_CODER -eq 1 ]; then 21 | markup_debug "Skipped : Install/update drupal coder." 22 | markup_debug 23 | return 24 | fi 25 | 26 | markup_h1 "Install coder" 27 | 28 | # Check if not disabled. 29 | if [ "$CODER_DISABLED" = "1" ]; then 30 | markup_warning "drupal/coder is disabled." 31 | markup_info "Enable it by setting CODER_DISABLED=0 in config/config.sh." 32 | echo 33 | return 34 | fi 35 | 36 | 37 | # Hook before install/update composer. 38 | hook_invoke "init_coder_before" 39 | 40 | # Install drupal/coder. 41 | composer_skeleton_run require drupal/coder 42 | 43 | # Register the drupal coding standards to phpcs. 44 | "$DIR_BIN/packagist/vendor/bin/phpcs" \ 45 | --config-set installed_paths \ 46 | "$DIR_BIN/packagist/vendor/drupal/coder/coder_sniffer" 47 | 48 | echo 49 | 50 | # Hook after install/update composer. 51 | hook_invoke "init_coder_after" 52 | } 53 | -------------------------------------------------------------------------------- /src/init_composer.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to install or update composer locally. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Install (download) or (self-)update a local composer instance. 8 | # 9 | # This script will trigger 2 "hooks" in the config// directory: 10 | # - init_composer_before : Scripts that should run before composer is 11 | # installed/updated. 12 | # - init_composer_after : Scripts that should run after composer is 13 | # installed/updated. 14 | # 15 | # The hooks will be called without and with environment suffix. 16 | ## 17 | function init_composer_run { 18 | if [ $INIT_OPTION_SKIP_COMPOSER -eq 1 ]; then 19 | markup_debug "Skipped : Install/Update composer." 20 | markup_debug 21 | return 22 | fi 23 | 24 | # Hook before install/update composer. 25 | hook_invoke "init_composer_before" 26 | 27 | init_composer_with_force 28 | 29 | if [ -d "$DIR_BIN/packagist" ]; then 30 | init_composer_update 31 | echo 32 | init_composer_init 33 | echo 34 | init_composer_update_packages 35 | echo 36 | else 37 | init_composer_install 38 | echo 39 | init_composer_init 40 | echo 41 | fi 42 | 43 | # Hook after install/update composer. 44 | hook_invoke "init_composer_after" 45 | } 46 | 47 | ## 48 | # Check if the init command was called with force. 49 | # 50 | # This will delete downloaded files so the init command will be run as a new 51 | # install. 52 | ## 53 | function init_composer_with_force { 54 | if [ $(option_is_set "-f") -ne 1 ] && [ $(option_is_set "--force") -ne 1 ]; then 55 | markup_debug "Init with force : No force used on druleton." 56 | markup_debug 57 | return 58 | fi 59 | 60 | if [ ! -d "$DIR_BIN/packagist" ]; then 61 | markup_debug "Init with force : No bin/packagist directory to delete." 62 | markup_debug 63 | return 64 | fi 65 | 66 | rm -Rf "$DIR_BIN/packagist" 67 | message_success "Init with force : bin/packagist directory is deleted." 68 | echo 69 | } 70 | 71 | ## 72 | # Install composer by downloading phar file locally. 73 | ## 74 | function init_composer_install { 75 | markup_h1 "Install composer" 76 | mkdir -p "$DIR_BIN/packagist" 77 | 78 | if [ "$COMPOSER_USE_GLOBAL" = "1" ]; then 79 | message_warning "Skip composer installation : globally installed composer will be used." 80 | markup_info "Use local installed composer by setting COMPOSER_GLOBAL=0 in config/config.sh." 81 | else 82 | curl -sS https://getcomposer.org/installer \ 83 | | php -- --install-dir="$DIR_BIN/packagist" 84 | fi 85 | } 86 | 87 | ## 88 | # Update composer. 89 | ## 90 | function init_composer_update { 91 | # Check first if already installed. 92 | if [ "$COMPOSER_USE_GLOBAL" != "1" ] && 93 | [ ! -f "$DIR_BIN/packagist/composer.phar" ]; then 94 | init_composer_install 95 | return 96 | fi 97 | 98 | markup_h1 "Update composer" 99 | 100 | if [ "$COMPOSER_USE_GLOBAL" != "1" ]; then 101 | composer_skeleton_run self-update 102 | else 103 | markup_warning "Skip composer update : globally installed composer is in use." 104 | markup_info "Use local installed composer by setting COMPOSER_GLOBAL=0 in config/config.sh." 105 | fi 106 | } 107 | 108 | ## 109 | # Initiate the composer environment. 110 | ## 111 | function init_composer_init { 112 | markup_h1 "Initiate composer." 113 | 114 | if [ -f "$DIR_BIN/packagist/composer.json" ]; then 115 | message_success "Composer was already initiated." 116 | else 117 | composer_skeleton_run -n init \ 118 | --name="druleton/bin" \ 119 | --description="PHP packages needed by druleton." \ 120 | --author="zero2one " \ 121 | --homepage="https://github.com/zero2one/druleton" \ 122 | --license="MIT" \ 123 | --type="library" 124 | message_success "Composer is initiated" 125 | fi 126 | } 127 | 128 | ## 129 | # Update the composer packages. 130 | ## 131 | function init_composer_update_packages { 132 | markup_h1 "Update installed composer packages" 133 | composer_skeleton_run update 134 | } 135 | -------------------------------------------------------------------------------- /src/init_custom_commands.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to symlink custom commands. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Function to symlink custom commands from the config/bin to the bin directory. 8 | # 9 | # This script will trigger 2 "hooks" in the config// directory: 10 | # - init_custom_commands_before : Scripts that should run before custom commands 11 | # are symlinked within the bin directory. 12 | # - init_custom_commands_after : Scripts that should run after the custom 13 | # commands are symlinked. 14 | # 15 | # The hooks will only be triggered if there are commands to symlink to. 16 | # The hooks will be called without and with environment suffix. 17 | ## 18 | function init_custom_commands_run { 19 | # Check if skipped. 20 | if [ $INIT_OPTION_SKIP_CUSTOM -eq 1 ]; then 21 | markup_debug "Skipped : Symlinking custom commands." 22 | markup_debug 23 | return 24 | fi 25 | 26 | markup_h1 "Symlink custom commands" 27 | 28 | if [ ! -d "$DIR_CONFIG_BIN" ]; then 29 | message_warning "There is no config/bin directory to symlink from." 30 | return 31 | fi 32 | 33 | local commands=$(find "$DIR_CONFIG_BIN" -maxdepth 1 -type f | awk -F"/" '{print $NF}' | grep -v '\.') 34 | if [ -z "$commands" ]; then 35 | message_warning "There are no commands within the config/bin directory to symlink to." 36 | echo 37 | return 38 | fi 39 | 40 | hook_invoke "init_custom_commands_before" 41 | 42 | for command in $commands 43 | do 44 | if [ -L "$DIR_BIN/$command" ]; then 45 | message_success "bin/$command" 46 | elif [ -f "$DIR_BIN/$command" ]; then 47 | message_error "bin/$command : There is already a command with the same name." 48 | else 49 | ln -s "$DIR_CONFIG_BIN/$command" "$DIR_BIN/$command" 50 | message_success "bin/$command" 51 | fi 52 | done 53 | echo 54 | 55 | hook_invoke "init_custom_commands_after" 56 | } 57 | -------------------------------------------------------------------------------- /src/init_druleton.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to install druleton. 3 | ################################################################################ 4 | 5 | ## 6 | # Install druleton. 7 | ## 8 | function init_druleton_run { 9 | # Check if skipped. 10 | if [ $INIT_OPTION_SKIP_DRULETON -eq 1 ]; then 11 | markup_debug "Skipped : Update druleton." 12 | markup_debug 13 | return 14 | fi 15 | 16 | markup_h1 "Update druleton" 17 | 18 | hook_invoke "init_druleton_before" 19 | 20 | if [ -f "$DIR_BIN/.git" ]; then 21 | markup_h2 "Update the druleton project from github." 22 | cd "$DIR_BIN" 23 | git pull 24 | cd "$DIR_ROOT" 25 | message_success "Updated from git." 26 | else 27 | message_error "Druleton not installed as submodule." 28 | fi 29 | 30 | echo 31 | 32 | hook_invoke "init_druleton_after" 33 | } 34 | -------------------------------------------------------------------------------- /src/init_drush.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to install or update drush locally. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Install (download) or (self-)update a local drush instance. 8 | # 9 | # This script will trigger 2 "hooks" in the config// directory: 10 | # - init_drush_before : Scripts that should run before drush is 11 | # installed/updated. 12 | # - init_drush_after : Scripts that should run after drush is 13 | # installed/updated. 14 | # 15 | # The hooks will be called without and with environment suffix. 16 | ## 17 | function init_drush_run { 18 | if [ $INIT_OPTION_SKIP_DRUSH -eq 1 ]; then 19 | markup_debug "Skipped : Install/Update drush." 20 | markup_debug 21 | return 22 | fi 23 | 24 | # Hook before install/update composer. 25 | hook_invoke "init_drush_before" 26 | 27 | markup_h1 "Install drush" 28 | 29 | if [ "$DRUSH_VERSION" == "global" ]; then 30 | markup_warning "Skip drush installation : globally installed drush will be used." 31 | 32 | elif [ "$DRUSH_VERSION" == "phar" ]; then 33 | init_drush_phar_with_force 34 | 35 | if [ ! -f "$DIR_BIN/packagist/drush.phar" ]; then 36 | curl -o "$DIR_BIN/packagist/drush.phar" http://files.drush.org/drush.phar 37 | chmod +x "$DIR_BIN/packagist/drush.phar" 38 | message_success "Drush downloaded to bin/packagist/drush.phar" 39 | else 40 | message_success "Drush was already downloaded to bin/packagist/drush.phar" 41 | fi 42 | 43 | else 44 | composer_skeleton_run require drush/drush:$DRUSH_VERSION --prefer-source 45 | fi 46 | 47 | echo 48 | 49 | # Hook after install/update composer. 50 | hook_invoke "init_drush_after" 51 | } 52 | 53 | ## 54 | # Check if the init command was called with force. 55 | # 56 | # This will delete downloaded files so the init command will be run as a new 57 | # install. 58 | ## 59 | function init_drush_phar_with_force { 60 | if [ $(option_is_set "-f") -ne 1 ] && [ $(option_is_set "--force") -ne 1 ]; then 61 | markup_debug "Init with force : No force used on druleton." 62 | markup_debug 63 | return 64 | fi 65 | 66 | if [ ! -f "$DIR_BIN/packagist/drush.phar" ]; then 67 | markup_debug "Init with force : No drush.phar file to delete." 68 | markup_debug 69 | return 70 | fi 71 | 72 | rm -f "$DIR_BIN/packagist/drush.phar" 73 | message_success "Init with force : drush.phar file is deleted." 74 | echo 75 | } 76 | -------------------------------------------------------------------------------- /src/init_structure.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to install druleton. 3 | ################################################################################ 4 | 5 | ## 6 | # Install druleton. 7 | ## 8 | function init_structure_run { 9 | if [ $INIT_OPTION_SKIP_STRUCTURE -eq 1 ]; then 10 | markup_debug "Skipped : Structure setup/update." 11 | markup_debug 12 | return 13 | fi 14 | 15 | markup_h1 "Structure" 16 | init_structure_root 17 | init_structure_config 18 | init_structure_project 19 | echo 20 | } 21 | 22 | ## 23 | # Copy git & editor configuration files to the root of the project. 24 | ## 25 | function init_structure_root { 26 | if [ ! -f "${DIR_ROOT}/.editorconfig" ]; then 27 | cp "${DIR_BIN}/templates/.editorconfig" "${DIR_ROOT}/" 28 | message_success "Copied .editorconfig file to the root of the project." 29 | else 30 | message_warning "There is already an .editorconfig file." 31 | fi 32 | 33 | if [ ! -f "${DIR_ROOT}/.gitattributes" ]; then 34 | cp "${DIR_BIN}/templates/.gitattributes" "${DIR_ROOT}/" 35 | message_success "Copied .gitattributes file to the root of the project." 36 | else 37 | message_warning "There is already a .gitattributes file." 38 | fi 39 | 40 | if [ ! -f "${DIR_ROOT}/.gitignore" ]; then 41 | cp "${DIR_BIN}/templates/.gitignore" "${DIR_ROOT}/" 42 | message_success "Copied .gitignore file to the root of the project." 43 | else 44 | message_warning "There is already a .gitignore file." 45 | fi 46 | 47 | if [ ! -f "${DIR_ROOT}/README.md" ]; then 48 | cp "${DIR_BIN}/templates/README.md" "${DIR_ROOT}/" 49 | message_success "Copied README.md file to the root of the project." 50 | else 51 | message_warning "There is already a README.md file." 52 | fi 53 | } 54 | 55 | ## 56 | # Copy the template config directory to the root of the project. 57 | ## 58 | function init_structure_config { 59 | if [ ! -d "${DIR_CONFIG}" ]; then 60 | cp -R "${DIR_BIN}/templates/config" "${DIR_CONFIG}" 61 | message_success "Copied the config directory to the root of the project." 62 | else 63 | message_warning "There is already a config directory." 64 | fi 65 | } 66 | 67 | ## 68 | # Copy the example project directory to the root of the project. 69 | ## 70 | function init_structure_project { 71 | if [ ! -d "${DIR_PROJECT}" ]; then 72 | cp -R "${DIR_BIN}/templates/project" "${DIR_PROJECT}" 73 | message_success "Copied the project directory to the root of the project." 74 | else 75 | message_warning "There is already a project directory." 76 | fi 77 | } 78 | -------------------------------------------------------------------------------- /src/install.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to install the site or project. 3 | ################################################################################ 4 | 5 | ## 6 | # Install command information. 7 | ## 8 | function install_info { 9 | echo 10 | markup_h1_divider 11 | markup_h1 " ${LWHITE}Install${LBLUE} website ${WHITE}$SITE_NAME${LBLUE} ($ENVIRONMENT)" 12 | markup_h1_divider 13 | 14 | if [ -d "$DIR_WEB" ]; then 15 | markup_h1_li "A backup of the web directory and the database will be created." 16 | markup_h1_li "The web directory will be deleted and all files will be destroyed." 17 | markup_h1_li "The database will be overwritten." 18 | fi 19 | 20 | markup_h1_li "Drupal core, contrib modules and themes will be downloaded." 21 | markup_h1_li "Drupal will be installed using the $SITE_PROFILE profile." 22 | markup_h1_divider 23 | echo 24 | } 25 | 26 | ## 27 | # The install script is finished information. 28 | ## 29 | function install_finished { 30 | markup_h1_divider 31 | markup_success " Finished" 32 | markup_h1_divider 33 | markup_h1_li "Site Code : ${LWHITE}$DIR_WEB${RESTORE}" 34 | markup_h1_li "Site URL : ${LWHITE}$SITE_URL${RESTORE}" 35 | markup_h1_divider 36 | echo 37 | } 38 | -------------------------------------------------------------------------------- /src/reset.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to reset a site or project. 3 | ################################################################################ 4 | 5 | ## 6 | # Pre reset script steps. 7 | ## 8 | function reset_init { 9 | if [ "$DRUPAL_INSTALLED" -ne 1 ]; then 10 | markup_error "No drupal core available." 11 | echo "You need to run the bin/install script to install Drupal." 12 | exit 13 | fi 14 | } 15 | 16 | ## 17 | # Reset command information. 18 | ## 19 | function reset_info { 20 | echo 21 | markup_h1_divider 22 | markup_h1 " ${LWHITE}Reset${LBLUE} website ${WHITE}$SITE_NAME${LBLUE} ($ENVIRONMENT)" 23 | markup_h1_divider 24 | markup_h1_li "The database will be deleted." 25 | markup_h1_li "The files directory will be deleted, all files will be destroyed." 26 | markup_h1_li "The settings.php file will be deleted." 27 | markup_h1_li "The database will be overwritten." 28 | markup_h1_li "This will install the website." 29 | markup_h1_divider 30 | echo 31 | } 32 | 33 | ## 34 | # The reset command is finished information. 35 | ## 36 | function reset_finished { 37 | markup_h1_divider 38 | markup_success " Finished" 39 | markup_h1_divider 40 | markup_h1_li "Site Code : ${LWHITE}$DIR_WEB${RESTORE}" 41 | markup_h1_li "Site URL : ${LWHITE}$SITE_URL${RESTORE}" 42 | markup_h1_divider 43 | echo 44 | } 45 | 46 | -------------------------------------------------------------------------------- /src/restore_sites_default.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that restores the sites/default directory from 3 | # backup/sites-default 4 | ################################################################################ 5 | 6 | 7 | ## 8 | # Function to run the sites/default restore process. 9 | # 10 | # This will move the sites/default directory from backup/sites-default back to 11 | # web/sites/default. 12 | # Existing web/sites/default directory will be deleted before restore. 13 | # 14 | # This script will trigger 2 "hooks" in the config// directory: 15 | # - restore_sites_default_before : Scripts that should run before the restore is 16 | # performed. 17 | # - restore_sites_default_after : Scripts that should run after the backup is 18 | # performed. 19 | # 20 | # The hooks will be called without and with environment suffix. 21 | ## 22 | function restore_sites_default_run { 23 | # Trigger the before hook(s). 24 | hook_invoke restore_sites_default_before 25 | 26 | markup_h1 "Move sites/default back into place." 27 | 28 | if [ -f "$DIR_BACKUP/sites-default" ]; then 29 | markup_error "The sites/default backup does not exists." 30 | echo 31 | return 1 32 | fi 33 | 34 | if [ -d "$DIR_WEB/sites/default" ]; then 35 | drupal_sites_default_unprotect 36 | rm -R "$DIR_WEB/sites/default" 37 | fi 38 | 39 | mv "$DIR_BACKUP/sites-default" "$DIR_WEB/sites/default" 40 | drupal_sites_default_protect 41 | 42 | if [[ $? -eq 1 ]]; then 43 | markup_error "Could not restore the sites-default directory." 44 | echo 45 | exit 46 | else 47 | message_success "Directory restored." 48 | echo 49 | fi 50 | 51 | # Trigger the after hook(s). 52 | hook_invoke restore_sites_default_after 53 | } 54 | 55 | 56 | restore_sites_default_run 57 | -------------------------------------------------------------------------------- /src/script.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to trigger the script before and after hooks. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Function to run the script_before hook. 8 | # 9 | # This script will trigger 1 "hooks" in the config// directory: 10 | # - script_before : Scripts that should run before the actual script is run. 11 | # 12 | # The hook will be called without and with environment suffix. 13 | ## 14 | function script_before_run { 15 | hook_invoke "script_before" 16 | } 17 | 18 | ## 19 | # Function to run the script_after hook. 20 | # 21 | # This script will trigger 1 "hooks" in the config// directory: 22 | # - script_after : Scripts that should run after the actual script is run. 23 | # 24 | # The hook will be called without and with environment suffix. 25 | ## 26 | function script_after_run { 27 | hook_invoke "script_after" 28 | } 29 | -------------------------------------------------------------------------------- /src/script_after.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that triggers the script_after hook. 3 | ################################################################################ 4 | 5 | 6 | ## 7 | # Function to run the script_after hook. 8 | # 9 | # This script will trigger 1 "hooks" in the config// directory: 10 | # - script_after : Scripts that should run after the actual script is run. 11 | # 12 | # The hook will be called without and with environment suffix. 13 | ## 14 | function script_after_run { 15 | hook_invoke "script_after" 16 | } 17 | -------------------------------------------------------------------------------- /src/script_before.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Include script that triggers the script_before hook. 3 | # 4 | # This script will trigger 1 "hooks" in the config// directory: 5 | # - script_before : Scripts that should run before the actual script is run. 6 | ################################################################################ 7 | 8 | 9 | ## 10 | # Function to run the script_before hook. 11 | # 12 | # This script will trigger 1 "hooks" in the config// directory: 13 | # - script_before : Scripts that should run before the actual script is run. 14 | # 15 | # The hook will be called without and with environment suffix. 16 | ## 17 | function script_before_run { 18 | hook_invoke "script_before" 19 | } 20 | -------------------------------------------------------------------------------- /src/upgrade.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Functionality to upgrade the site or project. 3 | ################################################################################ 4 | 5 | ## 6 | # Init the upgrade command. 7 | ## 8 | function upgrade_init { 9 | # Check first if there is a Drupal core avaibale in the web folder. 10 | if [ "$DRUPAL_INSTALLED" -ne 1 ]; then 11 | markup_error "No drupal core available." 12 | echo "You need to run the bin/install script to install Drupal." 13 | exit 14 | fi 15 | } 16 | 17 | ## 18 | # Upgrade command information. 19 | ## 20 | function upgrade_info { 21 | echo 22 | markup_h1_divider 23 | markup_h1 " ${LWHITE}Upgrade${LBLUE} website ${WHITE}$SITE_NAME${LBLUE} ($ENVIRONMENT)" 24 | markup_h1_divider 25 | markup_h1_li "A backup of the web directory and the database will be created." 26 | markup_h1_li "The web/sites/default dirctory will be put aside." 27 | markup_h1_li "The web directory will be deleted." 28 | markup_h1_li "Drupal core, contrib modules and themes will be downloaded." 29 | markup_h1_li "Drupal upgrade will be run." 30 | markup_h1_li "Drupal cache will be cleared." 31 | markup_h1_divider 32 | echo 33 | } 34 | 35 | ## 36 | # The upgrade script is finished information. 37 | ## 38 | function upgrade_finished { 39 | markup_h1_divider 40 | markup_success " Finished" 41 | markup_h1_divider 42 | markup_h1_li "Site Code : ${LWHITE}$DIR_WEB${RESTORE}" 43 | markup_h1_li "Site URL : ${LWHITE}$SITE_URL${RESTORE}" 44 | markup_h1_divider 45 | echo 46 | } 47 | -------------------------------------------------------------------------------- /templates/.editorconfig: -------------------------------------------------------------------------------- 1 | # Drupal editor configuration normalization 2 | # @see http://editorconfig.org/ 3 | 4 | # This is the top-most .editorconfig file; do not search in parent directories. 5 | root = true 6 | 7 | # All files. 8 | [*] 9 | end_of_line = LF 10 | indent_style = space 11 | indent_size = 2 12 | charset = utf-8 13 | trim_trailing_whitespace = true 14 | insert_final_newline = true 15 | -------------------------------------------------------------------------------- /templates/.gitattributes: -------------------------------------------------------------------------------- 1 | # Drupal git normalization 2 | # @see https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html 3 | # @see https://www.drupal.org/node/1542048 4 | 5 | # Normally these settings would be done with macro attributes for improved 6 | # readability and easier maintenance. However macros can only be defined at the 7 | # repository root directory. Drupal avoids making any assumptions about where it 8 | # is installed. 9 | 10 | # Define text file attributes. 11 | # - Treat them as text. 12 | # - Ensure no CRLF line-endings, neither on checkout nor on checkin. 13 | # - Detect whitespace errors. 14 | # - Exposed by default in `git diff --color` on the CLI. 15 | # - Validate with `git diff --check`. 16 | # - Deny applying with `git apply --whitespace=error-all`. 17 | # - Fix automatically with `git apply --whitespace=fix`. 18 | 19 | # Auto-detect text files, ensure they use LF. 20 | * text=auto eol=lf 21 | 22 | *.css text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 23 | *.engine text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php 24 | *.html text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=html 25 | *.inc text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php 26 | *.info text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 27 | *.install text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php 28 | *.js text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 29 | *.json text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 30 | *.lock text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 31 | *.md text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 32 | *.module text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php 33 | *.php text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php 34 | *.po text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 35 | *.script text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 36 | *.sh text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php 37 | *.sql text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 38 | *.test text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php 39 | *.theme text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=php 40 | *.txt text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 41 | *.xml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 42 | *.yml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 43 | 44 | # Define binary file attributes. 45 | # - Do not treat them as text. 46 | # - Include binary diff in patches instead of "binary files differ." 47 | *.gif -text diff 48 | *.gz -text diff 49 | *.ico -text diff 50 | *.jpg -text diff 51 | *.png -text diff 52 | *.phar -text diff 53 | *.exe -text diff 54 | -------------------------------------------------------------------------------- /templates/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # The config file is environment (local, dev, tst, prd, ...) different and 3 | # contains sensitive data (passwords). 4 | # This file should never be in a repository! 5 | config/config.sh 6 | 7 | # The backups folder is used to store local backups whan one of the scripts is 8 | # performing destructive operations. No need for it in the repository. 9 | /backup 10 | 11 | # The build folder is used when building the whole project to be packaged or 12 | # uploaded. No need to be stored in the repository. 13 | /build 14 | 15 | # The reason of this project is to avoid core and contrib code to be stored in 16 | # the project repository. Do not store what can be build using make files. 17 | /web 18 | -------------------------------------------------------------------------------- /templates/config/README.md: -------------------------------------------------------------------------------- 1 | # Druleton configuration 2 | 3 | This directory contains the configuration for the project and 4 | [hooks][link-hooks] for specific commands. 5 | 6 | The minimal required configuration file is `config.sh`. Create one by taking a 7 | copy of the `config_example.sh` file and fill in the 8 | [parameters][link-config-config]. 9 | 10 | - Read the [documentation about the config directory][link-config] 11 | - See [info about the config.sh file][link-config-config] 12 | - Read [documentation about druleton][link-documentation] 13 | 14 | 15 | 16 | [link-hooks]: ../bin/docs/hooks.md 17 | [link-config]: ../bin/docs/config.sh 18 | [link-config-config]: ../bin/docs/config-config.sh 19 | [link-documentation]: ../bin/docs/README.md 20 | -------------------------------------------------------------------------------- /templates/config/backup/README.md: -------------------------------------------------------------------------------- 1 | # `bin/backup` command configuration 2 | 3 | This directory contains the implemented hooks for the 4 | [`bin/backup`][link-command-backup] command. 5 | 6 | - See [hooks documentation][link-hooks] 7 | - See [`bin/backup` command documentation][link-command-backup] 8 | - Read [documentation about druleton][link-documentation] 9 | 10 | 11 | 12 | [link-hooks]: ../../bin/docs/hooks.md 13 | [link-command-backup]: ../../bin/docs/command-backup.sh 14 | [link-documentation]: ../../bin/docs/README.md 15 | -------------------------------------------------------------------------------- /templates/config/bin/README.md: -------------------------------------------------------------------------------- 1 | # Project specific commands 2 | 3 | This directory contains custom commands that are specific for the project. 4 | These are optional. 5 | 6 | The commands will become available as `bin/commandname` after running the 7 | `bin/init` command. 8 | 9 | 10 | - Read the [documentation about the custom commands][link-config-commands] 11 | - Read [documentation about druleton][link-documentation] 12 | 13 | 14 | 15 | [link-command-custom]: ../bin/docs/config-commands.sh 16 | [link-documentation]: ../bin/docs/README.md 17 | -------------------------------------------------------------------------------- /templates/config/build/README.md: -------------------------------------------------------------------------------- 1 | # `bin/build` command configuration 2 | 3 | This directory contains the implemented hooks for the 4 | [`bin/build`][link-command-build] command. 5 | 6 | - See [hooks documentation][link-hooks] 7 | - See [`bin/build` command documentation][link-command-build] 8 | - Read [documentation about druleton][link-documentation] 9 | 10 | 11 | 12 | [link-hooks]: ../../bin/docs/hooks.md 13 | [link-command-build]: ../../bin/docs/command-build.sh 14 | [link-documentation]: ../../bin/docs/README.md 15 | -------------------------------------------------------------------------------- /templates/config/build/drupal_make_after.sh: -------------------------------------------------------------------------------- 1 | 2 | ################################################################################ 3 | # Use this file to add custom script steps that should run after the make files 4 | # have run for the build script. 5 | ################################################################################ 6 | 7 | 8 | # Add the custom code from the project folder. 9 | markup_h1 "Copy project profiles, modules, themes and libraries." 10 | 11 | markup_h2 "Profiles" 12 | file_copy_subdirectories "$DIR_PROJECT/profiles" "$DIR_WEB/profiles" 13 | 14 | markup_h2 "Modules" 15 | mkdir -p "$DIR_WEB/sites/all/modules" 16 | file_copy_subdirectories "$DIR_PROJECT/modules" "$DIR_WEB/sites/all/modules" 17 | 18 | markup_h2 "Themes" 19 | mkdir -p "$DIR_WEB/sites/all/themes" 20 | file_copy_subdirectories "$DIR_PROJECT/themes" "$DIR_WEB/sites/all/themes" 21 | 22 | markup_h2 "Libraries" 23 | mkdir -p "$DIR_WEB/sites/all/libraries" 24 | file_copy_subdirectories "$DIR_PROJECT/libraries" "$DIR_WEB/sites/all/libraries" 25 | 26 | 27 | echo 28 | -------------------------------------------------------------------------------- /templates/config/config_example.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This is the global configuration file. 3 | # 4 | # ! It contains sensitive data and should never be comitted to a repository. 5 | # 6 | # Copy this example to config/config.sh and fill in the values. 7 | # You can add extra config variables if you need them in your scripts. 8 | ################################################################################ 9 | 10 | # The name of the site. 11 | SITE_NAME="My Website" 12 | 13 | # URL where the site is hosted. 14 | SITE_URL="my-site.dev" 15 | 16 | # The install profile that shouls be installed. 17 | SITE_PROFILE="standard" 18 | 19 | # Database connection parameters. 20 | DB_USER="" 21 | DB_PASS="" 22 | DB_NAME="my_site_db" 23 | DB_HOST="localhost" 24 | 25 | # Administrator account (user 1). 26 | ACCOUNT_NAME="admin" 27 | ACCOUNT_PASS="drupal" 28 | ACCOUNT_MAIL="$ACCOUNT_NAME@$SITE_URL" 29 | 30 | 31 | 32 | ################################################################################ 33 | # Druleton configuration. 34 | ################################################################################ 35 | 36 | # Composer is by default downloaded during the bin/init script. 37 | # You can optionally use a global installed composer. 38 | COMPOSER_USE_GLOBAL=0 39 | 40 | # The Drush version to use. 41 | # 42 | # Options: 43 | # - phar : use the drush.phar file as the local drush binary. This is the 44 | # default option. 45 | # - branch or tag name : use a specific version by setting the variable to the 46 | # proper branch or tag name (eg. dev-master). 47 | # See https://github.com/drush-ops/drush. 48 | # - global : use the globally installed drush command (outside druleton). 49 | # 50 | # If the variable is not set, phar will be used. 51 | DRUSH_VERSION="phar" 52 | 53 | # drupal/coder is installed by default as a dependency for the bin/coder 54 | # command. The installation is not required on all environments. 55 | # Disable installing it by setting the CODER_DISABLED variable to 1 (default 0). 56 | CODER_DISABLED=0 57 | -------------------------------------------------------------------------------- /templates/config/drupal_coder.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # drupal/coder configuration arrays. 3 | ################################################################################ 4 | 5 | ## 6 | # File extensions to include in the code inspections. 7 | ## 8 | CODER_EXTENSIONS=( 9 | css 10 | inc 11 | info 12 | install 13 | js 14 | md 15 | module 16 | php 17 | profile 18 | test 19 | theme 20 | txt 21 | ) 22 | 23 | ## 24 | # Ignore patterns to exclude specific files from the code inspections. 25 | ## 26 | CODER_IGNORE=( 27 | # Code generated by exporting features. 28 | "*.context.inc" 29 | "*.ds.inc" 30 | "*.facetapi_defaults.inc" 31 | "*.features.inc" 32 | "*.features.*.inc" 33 | "*.field_group.inc" 34 | "*.file_default_displays.inc" 35 | "*.pages.inc" 36 | "*.pages_default.inc" 37 | "*.strongarm.inc" 38 | "*.views_default.inc" 39 | # 3th party javascript libraries. 40 | "ckeditor-plugins" 41 | # Builders (npm, grunt, gulp, bower,... related files). 42 | "dist" 43 | "node_modules" 44 | "bower_components" 45 | ) 46 | 47 | ## 48 | # Directories to scan and perform code inspections on. 49 | # 50 | # If the number of code (modules/themes) in a directory is to big, PHP memory 51 | # limit can be reached. A workaround is to specify the paths separately in the 52 | # config array as each entry will be inspected in a separate code inspection 53 | # call. 54 | ## 55 | CODER_DIRECTORIES=( 56 | "$DIR_PROJECT/profiles" 57 | "$DIR_PROJECT/modules" 58 | "$DIR_PROJECT/themes" 59 | ) 60 | -------------------------------------------------------------------------------- /templates/config/drupal_make.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set the make files that need to be run before the installation. 3 | # 4 | # !Do not not include _core.make as this one is always installed first. 5 | ################################################################################ 6 | 7 | MAKE_FILES=( 8 | "minimal.make" 9 | "administration.make" 10 | ) 11 | -------------------------------------------------------------------------------- /templates/config/drupal_make_dev.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Set of DEV environment make files that need to be run before the installation. 3 | # These are run after the files in the make.sh file. 4 | # 5 | # The make files in this array will only be installed if the ennvironment = dev. 6 | ################################################################################ 7 | 8 | MAKE_FILES=( 9 | "development.make" 10 | ) 11 | -------------------------------------------------------------------------------- /templates/config/drupal_modules_disable.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Modules that need to be disabled after the installation. 3 | # 4 | # Some profiles (like default) enable more modules then realy needed. 5 | # List their names so they will be disabled after the installation has finished. 6 | ################################################################################ 7 | 8 | MODULES_DISABLE=( 9 | "color" 10 | "overlay" 11 | "search" 12 | "shortcut" 13 | "update" 14 | ) 15 | -------------------------------------------------------------------------------- /templates/config/drupal_modules_disable_prd.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Modules that need to be disabled after the installation for the 3 | # production environment. 4 | # 5 | # Some profiles (like default) enable more modules then realy needed. 6 | # List their names so they will be disabled after the installation has finished. 7 | ################################################################################ 8 | 9 | MODULES_DISABLE=( 10 | "field_ui" 11 | ) 12 | -------------------------------------------------------------------------------- /templates/config/drupal_modules_enable.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Modules that need to be enabled after the installation. 3 | # 4 | # Do not list dependencies of modules you want to enable, 5 | # they will be automatically enabled when the depending module is installed. 6 | ################################################################################ 7 | 8 | MODULES_ENABLE=( 9 | # Administration. 10 | "admin_views" 11 | "adminimal" 12 | "adminimal_admin_menu" 13 | "module_filter" 14 | # Minimal. 15 | "ctools" 16 | "entity" 17 | "entityreference" 18 | "jquery_update" 19 | "libraries" 20 | "pathauto" 21 | "redirect" 22 | "token" 23 | "transliteration" 24 | "views" 25 | "views_bulk_operations" 26 | ) 27 | -------------------------------------------------------------------------------- /templates/config/drupal_modules_enable_dev.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Modules that need to be enabled on a development environment. 3 | # 4 | # Do not list dependencies of modules you want to enable, 5 | # they will be automatically enabled when the depending module is installed. 6 | ################################################################################ 7 | 8 | MODULES_ENABLE=( 9 | "devel" 10 | "devel_generate" 11 | "views_ui" 12 | ) 13 | -------------------------------------------------------------------------------- /templates/config/init/config_collect.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # When the bin/init command is run, the config variables are collected and 3 | # written to the config.sh file. 4 | # 5 | # This file is used to prompt for custom configuration values. 6 | # 7 | # Use the "prompt" helper to ask the user for input. 8 | # The helper has 2 parameters: 9 | # - The question text. 10 | # - An optional current value. 11 | # 12 | # Save the collected value by assigning the $REPLY value to the INIT_CONFIG_X 13 | # variable: 14 | # 15 | # Example: 16 | # 17 | # markup_h2 "Custom variables" 18 | # prompt "Custom variable" "$INIT_CONFIG_CUSTOM_VARIABLE" 19 | # INIT_CONFIG_CUSTOM_VARIABLE="${REPLY}" 20 | # echo 21 | # 22 | ################################################################################ 23 | 24 | #markup_h2 "Custom variables" 25 | #prompt "Custom variable" "$INIT_CONFIG_CUSTOM_VARIABLE" 26 | #INIT_CONFIG_CUSTOM_VARIABLE="${REPLY}" 27 | #echo 28 | -------------------------------------------------------------------------------- /templates/config/init/config_confirm.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # When the bin/init command is run, the config variables are collected and 3 | # written to the config.sh file. 4 | # 5 | # This file prints out the collected custom variables so the user can review 6 | # them. 7 | # 8 | # Use the markup_li_value helper to list the config variable name and value. 9 | # 10 | # The helper has 2 parameters: 11 | # - The variable name. 12 | # - The value. 13 | # 14 | # Use variable substitution (see 15 | # http://tldp.org/LDP/abs/html/parameter-substitution.html) to show a - when no 16 | # value has been entered (variable is empty): 17 | # 18 | # markup_li_value "Custom variable" "${INIT_CONFIG_CUSTOM_VARIABLE:--}" 19 | # 20 | ################################################################################ 21 | 22 | #markup_h2 "Custom variables" 23 | #markup_li_value "Custom variable" "${INIT_CONFIG_CUSTOM_VARIABLE:--}" 24 | -------------------------------------------------------------------------------- /templates/config/init/config_load_current.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # When the bin/init command is run, the config variables are collected and 3 | # written to the config.sh file. 4 | # 5 | # This file is used to load the current config variables and store them in 6 | # temporary script variables. 7 | # 8 | # Prefix the variable to store the loaded value with **INIT_CONFIG_**! 9 | # 10 | # INIT_CONFIG_CUSTOM_VARIABLE="${CUSTOM_VARIABLE}" 11 | # 12 | # You can set a default value (if no value is found in the config file) by 13 | # adding `:-default_value` (variable substitution see 14 | # http://tldp.org/LDP/abs/html/parameter-substitution.html) to the 15 | # assignment: 16 | # 17 | # INIT_CONFIG_CUSTOM_VARIABLE="${CUSTOM_VARIABLE:-no value yet}" 18 | # 19 | ################################################################################ 20 | 21 | #INIT_CONFIG_CUSTOM_VARIABLE="${CUSTOM_VARIABLE}" 22 | -------------------------------------------------------------------------------- /templates/config/init/config_save.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # When the bin/init command is run, the config variables are collected and 3 | # written to the config.sh file. 4 | # 5 | # Add in this file the code to save the custom variables to the config file. 6 | # 7 | # Use the `init_config_save_variable` function to save the variable to the config 8 | # file. 9 | # 10 | # This function has 2 arguments: 11 | # - The variable confg key. 12 | # - The variable value. 13 | # 14 | # init_config_save_variable "CUSTOM_VARIABLE" "${INIT_CONFIG_CUSTOM_VARIABLE}" 15 | # 16 | ################################################################################ 17 | 18 | #init_config_save_variable "CUSTOM_VARIABLE" "${INIT_CONFIG_CUSTOM_VARIABLE}" 19 | -------------------------------------------------------------------------------- /templates/config/install/README.md: -------------------------------------------------------------------------------- 1 | # `bin/install` command configuration 2 | 3 | This directory contains the implemented hooks for the 4 | [`bin/install`][link-command-install] command. 5 | 6 | It also contains the [`cleanup.sh` configuration arrays][link-config-cleanup]. 7 | 8 | - See [hooks documentation][link-hooks] 9 | - See [`bin/install` command documentation][link-command-install] 10 | - See [cleanup documentation][link-config-cleanup] 11 | - Read [documentation about druleton][link-documentation] 12 | 13 | 14 | 15 | [link-config-cleanup]: ../../bin/docs/config-cleanup.sh 16 | [link-hooks]: ../../bin/docs/hooks.md 17 | [link-command-install]: ../../bin/docs/command-install.sh 18 | [link-documentation]: ../../bin/docs/README.md 19 | -------------------------------------------------------------------------------- /templates/config/install/cleanup.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # List files and directories that should be deleted before a new installation. 3 | # All PATHS are relative to the root of Drupal or are fully prefixed using the 4 | # script path variables (see bin/src/bootstrap.sh). 5 | ################################################################################ 6 | 7 | 8 | # Files to be deleted before the script is run. 9 | CLEANUP_FILES=( 10 | ) 11 | 12 | # Directories to be deleted before the script is run. 13 | CLEANUP_DIRECTORIES=( 14 | "$DIR_WEB" 15 | ) 16 | -------------------------------------------------------------------------------- /templates/config/install/drupal_make_after.sh: -------------------------------------------------------------------------------- 1 | 2 | ################################################################################ 3 | # Use this file to add custom script steps that should run before the 4 | # installation of Drupal is started. 5 | ################################################################################ 6 | 7 | 8 | # Add symlinks from the project directory. 9 | markup_h1 "Symlink project profiles, modules, themes and libraries." 10 | 11 | markup_h2 "Profiles" 12 | file_symlink_subdirectories "$DIR_PROJECT/profiles" "$DIR_WEB/profiles" 13 | 14 | markup_h2 "Modules" 15 | mkdir -p "$DIR_WEB/sites/all/modules" 16 | file_symlink_subdirectories "$DIR_PROJECT/modules" "$DIR_WEB/sites/all/modules" 17 | 18 | markup_h2 "Themes" 19 | mkdir -p "$DIR_WEB/sites/all/themes" 20 | file_symlink_subdirectories "$DIR_PROJECT/themes" "$DIR_WEB/sites/all/themes" 21 | 22 | markup_h2 "Libraries" 23 | mkdir -p "$DIR_WEB/sites/all/libraries" 24 | file_symlink_subdirectories "$DIR_PROJECT/libraries" "$DIR_WEB/sites/all/libraries" 25 | -------------------------------------------------------------------------------- /templates/config/install/drupal_modules_enable_after.sh: -------------------------------------------------------------------------------- 1 | 2 | ################################################################################ 3 | # Use this file to add custom script steps that should run after the 4 | # installation of Drupal and its contrib modules has finished. 5 | ################################################################################ 6 | 7 | # Make sure that we are in the Drupal root. 8 | cd "$DIR_WEB" 9 | 10 | 11 | # Set the administration theme. 12 | markup_h1 "Set the administration menu" 13 | drush vset admin_theme adminimal 14 | echo 15 | -------------------------------------------------------------------------------- /templates/config/install/drupal_modules_enable_after_dev.sh: -------------------------------------------------------------------------------- 1 | 2 | ################################################################################ 3 | # Use this file to add custom script steps that should run after the 4 | # installation of Drupal and its contrib modules has finished. 5 | ################################################################################ 6 | 7 | # Make sure that we are in the Drupal root. 8 | cd "$DIR_WEB" 9 | 10 | 11 | # Make the default directory and its content writable. 12 | markup_h1 "Make the sites/default directory and its content writable." 13 | chmod -R u+w "$DIR_WEB/sites/default" 14 | echo 15 | 16 | 17 | # Enable the theme debugging. 18 | markup_h1 "Enable theme debugging" 19 | drupal_drush vset theme_debug 1 20 | echo 21 | -------------------------------------------------------------------------------- /templates/config/make/README.md: -------------------------------------------------------------------------------- 1 | # make files bundles 2 | 3 | This directory contains the Drupal make file "bundles". A bundle file is a 4 | Drupal make file that groups modules, themes and libraries that provide a 5 | specific set of functionality. E.g. a `media.make` file contains all modules and 6 | libraries to provide media support in the platform. 7 | 8 | The `_core.make` file is the only required make file: it contains the required 9 | Drupal version for the project. 10 | 11 | 12 | - See [make documentation][link-config-make] 13 | - Read [documentation about druleton][link-documentation] 14 | 15 | 16 | 17 | [link-config-make]: ../../bin/docs/config-make.sh 18 | [link-documentation]: ../../bin/docs/README.md 19 | -------------------------------------------------------------------------------- /templates/config/make/_core.make: -------------------------------------------------------------------------------- 1 | core = 7.x 2 | api = 2 3 | 4 | projects[drupal][version] = "7.41" 5 | -------------------------------------------------------------------------------- /templates/config/make/administration.make: -------------------------------------------------------------------------------- 1 | core = 7.x 2 | api = 2 3 | 4 | ; Modules to make the life of a Drupal admin more pleasant. 5 | 6 | projects[admin_menu][subdir] = "contrib" 7 | projects[admin_menu][version] = "3.0-rc5" 8 | 9 | projects[admin_views][subdir] = "contrib" 10 | projects[admin_views][version] = "1.5" 11 | 12 | projects[adminimal_admin_menu][subdir] = "contrib" 13 | projects[adminimal_admin_menu][version] = "1.6" 14 | 15 | projects[module_filter][subdir] = "contrib" 16 | projects[module_filter][version] = "2.0" 17 | 18 | 19 | 20 | ; Themes to upgrade the admin backend. 21 | 22 | projects[adminimal_theme][subdir] = "contrib" 23 | projects[adminimal_theme][version] = "1.22" 24 | projects[adminimal_theme][type] = "theme" 25 | -------------------------------------------------------------------------------- /templates/config/make/development.make: -------------------------------------------------------------------------------- 1 | core = 7.x 2 | api = 2 3 | 4 | ; Modules only to install for development environments. 5 | 6 | projects[devel][subdir] = "development" 7 | projects[devel][version] = "1.x-dev" 8 | -------------------------------------------------------------------------------- /templates/config/make/minimal.make: -------------------------------------------------------------------------------- 1 | core = 7.x 2 | api = 2 3 | 4 | ; Modules that every project (should) need. 5 | 6 | projects[ctools][subdir] = "contrib" 7 | projects[ctools][version] = "1.9" 8 | 9 | projects[entity][subdir] = "contrib" 10 | projects[entity][version] = "1.6" 11 | 12 | projects[entityreference][subdir] = "contrib" 13 | projects[entityreference][version] = "1.1" 14 | 15 | projects[jquery_update][subdir] = "contrib" 16 | projects[jquery_update][version] = "3.0-alpha2" 17 | 18 | projects[libraries][subdir] = "contrib" 19 | projects[libraries][version] = "2.2" 20 | 21 | projects[pathauto][subdir] = "contrib" 22 | projects[pathauto][version] = "1.2" 23 | 24 | projects[redirect][subdir] = "contrib" 25 | projects[redirect][version] = "1.0-rc3" 26 | 27 | projects[token][subdir] = "contrib" 28 | projects[token][version] = "1.6" 29 | 30 | projects[transliteration][subdir] = contrib 31 | projects[transliteration][version] = "3.2" 32 | 33 | projects[views][subdir] = "contrib" 34 | projects[views][version] = "3.11" 35 | 36 | projects[views_bulk_operations][subdir] = "contrib" 37 | projects[views_bulk_operations][version] = "3.3" 38 | -------------------------------------------------------------------------------- /templates/config/reset/README.md: -------------------------------------------------------------------------------- 1 | # `bin/reset` command configuration 2 | 3 | This directory contains the implemented hooks for the 4 | [`bin/reset`][link-command-reset] command. 5 | 6 | It also contains the [`cleanup.sh` configuration arrays][link-config-cleanup] 7 | when the reset command is run. 8 | 9 | - See [hooks documentation][link-hooks] 10 | - See [`bin/reset` command documentation][link-command-reset] 11 | - See [cleanup documentation][link-config-cleanup] 12 | - Read [documentation about druleton][link-documentation] 13 | 14 | 15 | 16 | [link-config-cleanup]: ../../bin/docs/config-cleanup.sh 17 | [link-hooks]: ../../bin/docs/hooks.md 18 | [link-command-reset]: ../../bin/docs/command-reset.sh 19 | [link-documentation]: ../../bin/docs/README.md 20 | -------------------------------------------------------------------------------- /templates/config/reset/cleanup.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # List files and directories that should be deleted before a reset is performed. 3 | # All PATHS are relative to the root of Drupal or are fully prefixed using the 4 | # script path variables (see bin/src/bootstrap.sh). 5 | ################################################################################ 6 | 7 | 8 | # Files to be deleted before the script is run. 9 | CLEANUP_FILES=( 10 | "$DIR_WEB/sites/default/settings.php" 11 | ) 12 | 13 | # Directories to be deleted before the script is run. 14 | CLEANUP_DIRECTORIES=( 15 | "$DIR_WEB/sites/default/files" 16 | ) 17 | -------------------------------------------------------------------------------- /templates/config/reset/drupal_modules_enable_after.sh: -------------------------------------------------------------------------------- 1 | 2 | ################################################################################ 3 | # Use this file to add custom script steps that should run after the 4 | # installation of Drupal and its contrib modules has finished. 5 | ################################################################################ 6 | 7 | 8 | source "$DIR_CONFIG/install/drupal_modules_enable_after.sh" 9 | -------------------------------------------------------------------------------- /templates/config/reset/drupal_modules_enable_after_dev.sh: -------------------------------------------------------------------------------- 1 | 2 | ################################################################################ 3 | # Use this file to add custom script steps that should run after the 4 | # installation of Drupal and its contrib modules has finished. 5 | ################################################################################ 6 | 7 | 8 | source "$DIR_CONFIG/install/drupal_modules_enable_after_dev.sh" 9 | -------------------------------------------------------------------------------- /templates/config/upgrade/README.md: -------------------------------------------------------------------------------- 1 | # `bin/upgrade` command configuration 2 | 3 | This directory contains the implemented hooks for the 4 | [`bin/upgrade`][link-command-upgrade] command. 5 | 6 | It also contains the [`cleanup.sh` configuration arrays][link-config-cleanup] 7 | when the upgrade command is run. 8 | 9 | - See [hooks documentation][link-hooks] 10 | - See [`bin/upgrade` command documentation][link-command-upgrade] 11 | - See [cleanup documentation][link-config-cleanup] 12 | - Read [documentation about druleton][link-documentation] 13 | 14 | 15 | 16 | [link-config-cleanup]: ../../bin/docs/config-cleanup.sh 17 | [link-hooks]: ../../bin/docs/hooks.md 18 | [link-command-upgrade]: ../../bin/docs/command-upgrade.sh 19 | [link-documentation]: ../../bin/docs/README.md 20 | -------------------------------------------------------------------------------- /templates/config/upgrade/cleanup.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # List files and directories that should be deleted before an upgrade is 3 | # performed. 4 | # All PATHS are relative to the root of Drupal or are fully prefixed using the 5 | # script path variables (see bin/src/bootstrap.sh). 6 | ################################################################################ 7 | 8 | # Files to be deleted before the script is run. 9 | CLEANUP_FILES=( 10 | ) 11 | 12 | # Directories to be deleted before the script is run. 13 | CLEANUP_DIRECTORIES=( 14 | "$DIR_WEB" 15 | ) 16 | -------------------------------------------------------------------------------- /templates/config/upgrade/drupal_make_after.sh: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Use this file to add custom script steps that should run before the 3 | # installation of Drupal is started. 4 | ################################################################################ 5 | 6 | # Upgrade needs to symlink the same custom modules as the installation. 7 | source "$DIR_CONFIG/install/drupal_make_after.sh" 8 | -------------------------------------------------------------------------------- /templates/project/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | > **NOTE** : Use this changelog to document the changes to the project, install 4 | > profiles, custom modules, themes and libraries. 5 | > 6 | > Create for each release a new chapter and list the changes. Link for each 7 | > release to a diff on the repository frontend. 8 | > 9 | > Example: see the [CHANGELOG](../bin/CHANGELOG.md) of druleton. 10 | 11 | 12 | ## [Unreleased][1.x.x] 13 | ### Added 14 | - Nothing 15 | 16 | ### Deprecated 17 | - Nothing 18 | 19 | ### Fixed 20 | - Nothing 21 | 22 | ### Removed 23 | - Nothing 24 | 25 | ### Security 26 | - Nothing 27 | 28 | 29 | 30 | 31 | [1.x.x]: https://github.com/ACCOUNT/REPOSITORY-NAME/compare/master...develop 32 | -------------------------------------------------------------------------------- /templates/project/README.md: -------------------------------------------------------------------------------- 1 | # Project directory 2 | The project directory contains all the custom code for the project: 3 | 4 | - [Install profiles](profiles/README.md). 5 | - [Modules](modules/README.md). 6 | - [Themes](themes/README.md). 7 | - [Libraries](libraries/README.md). 8 | 9 | Put all the custom code in this directory. The by default available directory 10 | structure is an example, feel free to create the structure as required for the 11 | project you are building. 12 | 13 | Integrating this code into the project can be done by symlinking them into the 14 | web directory by implemnting one of the hooks (see 15 | `config/install/drupal_make_after.sh`) for an example. 16 | 17 | Including the custom functionality code into the build is done by copying the 18 | project (sub)directories into the build (see 19 | `config/build/drupal_make_after.sh`) for an example. 20 | 21 | [See druleton documentation about project][link-project]. 22 | 23 | 24 | 25 | [link-project]: ../bin/docs/project.md 26 | -------------------------------------------------------------------------------- /templates/project/libraries/README.md: -------------------------------------------------------------------------------- 1 | # Project libraries 2 | Put custom libraries in this directory. 3 | 4 | Each subdirectory in this directory will be symlinked to the 5 | `web/sites/all/libraries` directory during install & upgrade. Or copied into 6 | `build/web/sites/all/libraries` during build. 7 | 8 | [See druleton documentation about project][link-project]. 9 | 10 | 11 | 12 | [link-project]: ../../bin/docs/project.md 13 | -------------------------------------------------------------------------------- /templates/project/modules/README.md: -------------------------------------------------------------------------------- 1 | # Project modules 2 | Put custom modules in this directory. 3 | 4 | Each subdirectory in this directory will be symlinked to the 5 | `web/sites/all/modules` directory during install & upgrade. Or copied into 6 | `build/web/sites/all/modules` during build. 7 | 8 | > **Tip** : Create a subdirectory to put custom modules in (eg. `custom`, 9 | `features`, ...). 10 | 11 | [See druleton documentation about project][link-project]. 12 | 13 | 14 | 15 | [link-project]: ../../bin/docs/project.md 16 | -------------------------------------------------------------------------------- /templates/project/profiles/README.md: -------------------------------------------------------------------------------- 1 | # Project install profiles 2 | Put custom drupal install profiles in this directory. 3 | 4 | Each subdirectory in this directory will be symlinked to the 5 | `web/profiles` directory during install & upgrade. Or copied into 6 | `build/web/profiles` during build. 7 | 8 | [See druleton documentation about project][link-project]. 9 | 10 | 11 | 12 | [link-project]: ../../bin/docs/project.md 13 | -------------------------------------------------------------------------------- /templates/project/themes/README.md: -------------------------------------------------------------------------------- 1 | # Project themes 2 | Put custom themes in this directory. 3 | 4 | Each subdirectory in this directory will be symlinked to the 5 | `web/sites/all/themes` directory during install & upgrade. Or copied into 6 | `build/web/sites/all/themes` during build. 7 | 8 | > **Tip** : Create a subdirectory to put custom themes in (eg. `custom`). 9 | 10 | 11 | [See druleton documentation about project][link-project]. 12 | 13 | 14 | 15 | [link-project]: ../../bin/docs/project.md 16 | -------------------------------------------------------------------------------- /upgrade: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################################################ 4 | # Script to upgrade an existing site based on the configuration by replacing 5 | # core & contrib by removing the web directory and download again based on the 6 | # make files. 7 | # 8 | # ! Do not change this file ! 9 | # All configuration is in the config directory 10 | ################################################################################ 11 | 12 | 13 | # Bootstrap the script. 14 | source $(dirname $0)/src/bootstrap.sh 15 | 16 | # Includes. 17 | source "$DIR_SRC/script.sh" 18 | source "$DIR_SRC/upgrade.sh" 19 | source "$DIR_SRC/backup.sh" 20 | source "$DIR_SRC/cleanup.sh" 21 | source "$DIR_SRC/drupal_make.sh" 22 | source "$DIR_SRC/restore.sh" 23 | source "$DIR_SRC/drupal_upgrade.sh" 24 | source "$DIR_SRC/drupal_login.sh" 25 | 26 | # Pre script. 27 | upgrade_init 28 | upgrade_info 29 | prompt_confirm_or_exit 30 | 31 | # START Script ----------------------------------------------------------------- 32 | script_before_run 33 | backup_run 34 | backup_run_sites_default_directory 35 | cleanup_run 36 | drupal_make_run 37 | restore_run_sites_default_directory 38 | drupal_upgrade_run 39 | drupal_login_run 40 | script_after_run 41 | # END Script ------------------------------------------------------------------- 42 | 43 | # Finish message. 44 | upgrade_finished 45 | 46 | # End. 47 | exit 0 48 | --------------------------------------------------------------------------------