2017 © Pedro Peláez
 

drupal-drush drushversionmanagercommand

This module provides a drush command to maintain module versions.

image

liip/drushversionmanagercommand

This module provides a drush command to maintain module versions.

  • Monday, June 3, 2013
  • by pjezek
  • Repository
  • 49 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

LiipDrushVersionManagerCommand

Purpose

This drush extension implementes commands to check for new versions of installed modules and update them without issuing drush dis module && drush pm-uninstall module. On update it uses a custom hook called hook_vm_update(). With this the module can decide if there is something to do on update. And return true on success or false on failure. It has the advantage that the hook_install() and hook_uninstall() is not issued. (E.g. loosing all data if the hook_uninstall() cleans a table in the database., (*1)

Travis build status

Build Status, (*2)

Obtain sources

Get it from packagist.org

To obtain the sources via composer add the following lines to your composer.json file or complete the list of dependencies., (*3)

"require": {
    "liip/drushversionmanagercommand": "1.*"
}
...
"extra": {
    "installer-paths": {
        "path/2/drush/commands/{$name}/": [
            "liip/drushversionmanagercommand"
        ],

Then execute the following commands on the command line:, (*4)

$> curl -s http://getcomposer.org/installer | php
$> php composer.phar install

Getting started

Sources fetched? Brilliant.. now we can start using the module updater. In your ModuleName.install file implement the hook_vm_update()., (*5)

/**
 * Update script
 *
 * @return bool
 */
function ModuleName_vm_update()
{
    // clean out no longer used variables
    variable_set('ModuleName_some_variable', 'myValue')

    // this update was successful
    return (bool) variable_get('ModuleName_some_variable', false);
}

Add a version to the ModuleName.info file:, (*6)

// ...
version = 1.0
// ...

Let composer post_install or post_update handle module updates

#!/bin/bash
DRUSH="drush"

# store version number from installed modules
$DRUSH php-script scripts/invoke_module_update 

# update modules if needed
$DRUSH php-script scripts/update_module_versions

Command line examples

Get help

General usage:, (*7)

$ drush help vm-update
Print information about the specified module(s).

Examples:
 drush versionmanager-update --all   Update every named module to the new version. 


Arguments:
 modules                             A comma delimited list of module names 
                                     (e.g. module1,module2,module2) 

Options:
 --all                               Run the update on all installed and enabled modules where an 
                                     update is available. 

Aliases: vm-update
$ drush help vm-info
Print information about the specified module(s).

Examples:
 drush versionmanager-information --all    Display information about any provided module if there 
                                           is an update available. 

Arguments:
 modules                                   A comma delimited list of module names 


Options:
 --all                                     Run the update on all installed and enabled modules              
 --full                                    show extended information about the module (this is the default) 
 --short                                   show basic information about the module                          


Aliases: vm-info

Update all modules

$ drush vm-update --all
Updating ModuleName1 ...                                                                   [success]
Nothing to update for module »ModuleName2«                                                 [warning]

Update a subset of all enabled modules

$ drush vm-update ModuleName1, ModuleName2
Updating ModuleName1 ...                                                                   [success]
Updating ModuleName2 ...                                                                   [success]

Get short list of all modules were an update is available

The neat thing is that you can copy and paste the out put directly to vm-update and not using the --all switch there. This will make it segnificantly faster., (*8)

$ drush vm-info --all --short
ModuleName1, ModuleName2, ..., ModuleNameN

Get full information about module updates

The --full switch is not only optional but also the default if --short is not declared. As you'd guess ModuleName2 has no update available., (*9)

$ drush vm-info --full --all
Title                         :  Title of ModuleName1
Name                          :  ModuleName1 
Version                       :  0.1 
Update available to version   :  1.5
 
Title     :  Title of ModuleName2
Name      :  ModuleName2 
Version   :  7.x-2.x-dev  
 
...

The Versions

03/06 2013

dev-master

9999999-dev

This module provides a drush command to maintain module versions.

  Sources   Download

MIT

The Requires

 

by Patrick Jezek

drupal drush drupal 7

02/06 2013

dev-versionsToCustomHook

dev-versionsToCustomHook

This module provides a drush command to maintain module versions.

  Sources   Download

MIT

The Requires

 

by Patrick Jezek

drupal drush drupal 7

01/06 2013

dev-multiple-versions

dev-multiple-versions

This module provides a drush command to maintain module versions.

  Sources   Download

MIT

The Requires

 

by Patrick Jezek

drupal drush drupal 7