p16r.nl

Mate - a command line Magento development toolkit

March 14, 2012 - 3 min read

Over the past few months, we’ve been listing our most common development tasks to see if we could automate parts of it in order to work more efficiently. A lot of tasks are repetitive during development. When we had a nice and decent list, I decided to make a command line script to help me with these tasks. The result of this is Mate. Mate can turn on (admin) template hints, disable/enable modules, make backups, clear cache, clear sessions, run the cron, reset file & dir permissions, install Magento instances and some more. You can also use the indexer and the compiler functions; these are just piped through mate to the corresponding PHP files.

The help listing of Mate is as follows;

Mate (command line Magento toolkit) - by Elgentos (peterjaap@elgentos.nl)

mate index/indexer 
    --status             Show Indexer(s) Status
    --mode               Show Indexer(s) Index Mode
    --mode-realtime      Set index mode type "Update on Save"
    --mode-manual        Set index mode type "Manual Update"
    --reindex            Reindex Data
    info                          Show allowed indexers
    reindexall                    Reindex Data by all indexers
    Indexes:
        catalog_product_attribute     Product Attributes
        catalog_product_price         Product Prices
        catalog_url                   Catalog URL Rewrites
        catalog_product_flat          Product Flat Data
        catalog_category_flat         Category Flat Data
        catalog_category_product      Category Products
        catalogsearch_fulltext        Catalog Search Index
        cataloginventory_stock        Stock Status
        tag_summary                   Tag Aggregation Data
mate compiler 
    state         Show Compilation State
    compile       Run Compilation Process
    clear         Disable Compiler include path and Remove compiled files
    enable        Enable Compiler include path
    disable       Disable Compiler include path
    help          This help
mate connect 
    channel-add          Add a Channel
    channel-alias        Specify an alias to a channel name
    channel-delete       Remove a Channel From the List
    channel-info         Retrieve Information on a Channel
    channel-login        Connects and authenticates to remote channel server
    channel-logout       Logs out from the remote channel server
    clear-cache          Clear Web Services Cache
    config-get           Show One Setting
    config-help          Show Information About Setting
    config-set           Change Setting
    config-show          Show All Settings
    convert              Convert old magento PEAR package to new format
    download             Download Package
    info                 Display information about a package
    install              Install Package
    install-file         Install Package Archive File
    list-available       List Available Packages
    list-channels        List Available Channels
    list-files           List Files In Installed Package
    list-installed       List Installed Packages In The Default Channel
    list-upgrades        List Available Upgrades
    package              Build Package
    package-dependencies Show package dependencies
    package-prepare      Show installation information of package
    sync                 Synchronize Manually Installed Packages
    sync-pear            Synchronize already Installed Packages by pear
    uninstall            Un-install Package
    upgrade              Upgrade Package
    upgrade-all          Upgrade All Packages
mate modules - overview the module list
mate enable Package_Module - enable a module
mate disable Package_Module - disable a module
mate toggle Package_Module - toggle the status of a module
mate backup - make a database dump to database.sql
mate cc/cache - clear cache
mate cs/session(s) - clear sessions
mate cron - run the cron
mate connect {arguments} - use default 'mage' exec to interface Magento Connect
mate install channelName packageName - install packages using default 'mage' exec
mate minstall {version} - install Magento (use '1600' or '1.6.2.0' for {version})
mate resetmods - reset all permissions of dirs to 775 and files to 664
mate hints (admin/scope id/leave empty) on/off - turn the template hints on and off for store or admin

Current root dir is /path/to/magento

This has been written in a few hours and seems to work well; our developers are quite happy with it. This does not say the code is flawless; there is much work to be done but this is a nice stepping stone. You can fork me at https://github.com/peterjaap/mate

Leave any ideas about functionality in the comments :-)


Kyle Mathews

Written by Peter Jaap Blaakmeer @PeterJaap