Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Add dependency on Configuration Split module; empty Develop configura…
Browse files Browse the repository at this point in the history
…tion split
  • Loading branch information
T2L committed Jun 22, 2017
1 parent f1fd0db commit 0bf37a6
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 5 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
## Draft 1.x.x

- Added empty Develop configuration split
- Added dependencies on:
* Administration links access filter (admin_links_access_filter:admin_links_access_filter)
* Administration Links Access Filter (admin_links_access_filter:admin_links_access_filter)
* Configuration Split (config_split:config_split)
- Added vendor libraries:
* Administration links access filter (drupal/admin_links_access_filter: **^1.0**)
* Drupal Console (drupal/console: **^1.0**)
* Administration Links Access Filter (drupal/admin_links_access_filter: **^1.0**)
* Configuration Split (drupal/admin_links_access_filter: **^1.0**)
* Drupal Console (drupal/config_split: **^1.0**)
* Drush (drush/drush: **^8.1**)
- Make sure that all dependencies are prefixed with the project name
- Added this file
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Just run this command:
$ composer create-project lemberg/draft-project my_awesome_project
```

## Docs

Everybody loves documentation. We do too! [Check this out](docs).

## Changelog

Changelog can be found here [CHANGELOG.md](CHANGELOG.md)
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"drupal/admin_links_access_filter": "^1.0",
"drupal/admin_toolbar": "^1.0",
"drupal/adminimal_admin_toolbar": "^1.0",
"drupal/adminimal_theme": "^1.0"
"drupal/adminimal_theme": "^1.0",
"drupal/config_split": "^1.0"
},
"repositories": [
{
Expand Down
13 changes: 13 additions & 0 deletions config/install/config_split.config_split.develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
langcode: en
status: true
dependencies: { }
id: develop
label: Develop
folder: ../config/develop
module: { }
theme: { }
blacklist: { }
graylist: { }
graylist_dependents: true
graylist_skip_equal: true
weight: 0
11 changes: 11 additions & 0 deletions docs/config_split.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Configuration Split

[Configuration Split](https://www.drupal.org/project/config_split) module allows to define sets of configuration that will get exported to separate directories when exporting, and get merged together when importing.

Empty **Develop** configuration split is shipped with this profile.

## How to

1. We assume that configuration gets exported into a sub directory of the `config` directory above the web root (e.g. `../config/default`). Develop split will be exported to `../config/develop`. Profile will try to create it upon installation automatically. Export directory can be changed any time.

1. We do not provide any development configuration. Go to `admin/config/development/configuration/config-split/develop/edit` and edit split settings. [Devel](https://www.drupal.org/project/devel) is a great example of a module which must be blacklisted.
1 change: 1 addition & 0 deletions draft.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
- admin_links_access_filter:admin_links_access_filter
- admin_toolbar:admin_toolbar
- adminimal_admin_toolbar:adminimal_admin_toolbar
- config_split:config_split

themes:
- adminimal_theme:adminimal_theme
55 changes: 54 additions & 1 deletion draft.install
Original file line number Diff line number Diff line change
@@ -1,8 +1,61 @@
<?php

use Drupal\Core\Config\FileStorage;

/**
* Implements hook_install().
*/
function draft_install() {
$config = _draft_read_develop_config_split();
_draft_prepare_develop_config_split_directory($config);
}

/**
* Enables Administration links access filter module.
* Installs Administration Links Access Filter module.
*/
function draft_update_8101(&$sandbox = NULL) {
\Drupal::service('module_installer')->install(['admin_links_access_filter']);
}

/**
* Installs Configuration Split module and Develop configuration split.
*/
function draft_update_8102(&$sandbox = NULL) {
if (!Drupal::moduleHandler()->moduleExists('config_split')) {
\Drupal::service('module_installer')->install(['config_split']);

$config = _draft_read_develop_config_split();
_draft_prepare_develop_config_split_directory($config);

/** @var \Drupal\Core\Config\CachedStorage $config_storage */
$config_storage = \Drupal::service('config.storage');
$config_storage->write('config_split.config_split.develop', $config);
}
}

/**
* Reads Develop configuration split configuration data.
*
* @return array
* Develop configuration split configuration data.
*/
function _draft_read_develop_config_split() {
$config_path = drupal_get_path('profile', 'draft') . '/config/install';
$source = new FileStorage($config_path);
return $source->read('config_split.config_split.develop');
}

/**
* Prepares Develop configuration split export directory.
*
* @param array $config
* Develop configuration split configuration data.
*
* @return bool
* TRUE if Develop configuration split export directory exists and is
* writable, FALSE otherwise.
*/
function _draft_prepare_develop_config_split_directory(array $config) {
$directory = \Drupal::root() . '/' . $config['folder'];
return file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
}

0 comments on commit 0bf37a6

Please sign in to comment.