Skip to content

Instantly share code, notes, and snippets.

@wxactly
Last active July 14, 2017 21:05
Show Gist options
  • Save wxactly/34afe914c6f1089244e7cadaf0d632f4 to your computer and use it in GitHub Desktop.
Save wxactly/34afe914c6f1089244e7cadaf0d632f4 to your computer and use it in GitHub Desktop.
Robo task for updating Drupal 8 module config
<?php
class RoboFile extends \Robo\Tasks
{
/**
* Update site config by importing from a module's config directory.
*
* @param string $module Module name
* @param array $opts
*
* @return \Robo\Result
*/
public function configUpdate( $module, $opts = [ 'yes|y' => false ] ) {
$get_module_path = 'drush pmi ' . $module . ' --format=csv --fields=path';
$get_source = '$(' . $get_module_path . ')/config/install';
$y = $opts['yes'] ? ' --yes' : '';
return $this->taskExec( 'drush cim' . $y . ' --partial --source=' . $get_source )
->dir( 'web' )
->run();
}
}
@wxactly
Copy link
Author

wxactly commented Jul 14, 2017

Usage:

robo config:update my_module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment