smalot/cerbere

Drush command line that controls the updates of Drupal modules.

v0.7 2017-03-23 18:19 UTC

This package is not auto-updated.

Last update: 2024-03-16 15:30:34 UTC


README

Cerbere is a Drush commands set performing action on project' modules stored in GIT, SVN or just locally.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality

Requirements

Compatible with both Drush 7.x and Drupal 8.x.

Installation

Composer

You need first to download this library using composer.

composer global require smalot/cerbere:dev-master

Go to GetComposer.org to install Composer on your environment.

Bootstrap

You need to create, or alter, a file named drushrc.php stored in the following folder: ~/.drush.

See Drush documentation for more detail on this file.

<?php

// Detected composer dir according to OS platform.
if (($home_dir = getenv('HOME')) && (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')) {
    $composer_dir = $home_dir . '/AppData/Roaming/Composer';
} else {
    $composer_dir = $home_dir . '/.composer';
}

// Include composer autoload file and declare Cerbere commands.
if (is_file($composer_dir . '/vendor/autoload.php') && 
    is_dir($composer_dir . '/vendor/smalot/cerbere/commands')) {
    include_once $composer_dir . '/vendor/autoload.php';

    $options['include'][] = $composer_dir . '/vendor/smalot/cerbere/commands';
}

Doing this step, Drush will be aware of commands provided by Cerbere, otherwise you'll need to use the --include command line option to declare the command folder each time.

drush --include=$HOME/.composer/vendor/smalot/cerbere/commands

Use

Command : cerbere-update

This report is oriented on the update of the modules. It can be enriched with the hacked flag which will append 2 columns indicating that a module has been locally altered or not.

  • --no-cache : Disable cache mecanism. Otherwise, remote informations are cached for 1800 seconds.
  • --no-progress : Disable progress bar.
  • --level : Specify analyze verbosity (all, security, unsupported, update) - default : all.
  • --hacked : Append Hacked reporting.
  • --format : Output format (table, csv, json) - default : table.

Example

List all outdated module, and check if there has been hacked. Usefull to know if module update can be safely realized.

drush cerbere-update sites/all/modules/*.info --hacked --level=update

Command : cerbere-hacked

This report is dedicated to the hacked check.

  • --no-progress : Disable progress bar.
  • --format : Output format (table, csv, json) - default : table.

Roadmap

  • Add Yaml support (Drupal 8.x)
  • Fix notices (mkdir / unlink)
  • Add error handler on hacked plugin
  • Add logging on hacked plugin
  • Add unit tests on hacked plugin
  • Add cache and option in command line to disable it (archives / hash file)

Credits

Parts of code has been reused from Drupal 7.x core, Hacked module.