liip/LiipDrushVersionManagerCommand

Name: LiipDrushVersionManagerCommand

Owner: Liip

Description: modules update without issuing drush dis module && drush pm-uninstall module

Created: 2013-06-01 16:48:55.0

Updated: 2014-01-25 10:16:40.0

Pushed: 2013-06-03 07:00:59.0

Homepage: null

Size: 144

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

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.

Travis build status

Build Status

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.

uire": {
"liip/drushversionmanagercommand": "1.*"


ra": {
"installer-paths": {
    "path/2/drush/commands/{$name}/": [
        "liip/drushversionmanagercommand"
    ],

Then execute the following commands on the command line:

url -s http://getcomposer.org/installer | php
hp 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().


pdate script

return bool

tion 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:

..
ion = 1.0
..
Let composer post_install or post_update handle module updates
in/bash
H="drush"

ore version number from installed modules
SH php-script scripts/invoke_module_update 

date modules if needed
SH php-script scripts/update_module_versions
Command line examples
Get help

General usage:

ush help vm-update
t information about the specified module(s).

ples:
sh versionmanager-update --all   Update every named module to the new version. 


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

ons:
ll                               Run the update on all installed and enabled modules where an 
                                 update is available. 

ses: vm-update
ash
ush help vm-info
t information about the specified module(s).

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

ments:
ules                                   A comma delimited list of module names 


ons:
ll                                     Run the update on all installed and enabled modules              
ull                                    show extended information about the module (this is the default) 
hort                                   show basic information about the module                          


ses: vm-info
Update all modules
ush vm-update --all
ting ModuleName1 ...                                                                   [success]
ing to update for module »ModuleName2«                                                 [warning]
Update a subset of all enabled modules
ush vm-update ModuleName1, ModuleName2
ting ModuleName1 ...                                                                   [success]
ting 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.

ush vm-info --all --short
leName1, 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.

ush vm-info --full --all
e                         :  Title of ModuleName1
                          :  ModuleName1 
ion                       :  0.1 
te available to version   :  1.5

e     :  Title of ModuleName2
      :  ModuleName2 
ion   :  7.x-2.x-dev  



This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.