2017 © Pedro Peláez
 

symfony-bundle sympatch-bundle

Symfony2 code patch tool

image

dhorchler/sympatch-bundle

Symfony2 code patch tool

  • Saturday, August 2, 2014
  • by DHorchler
  • Repository
  • 1 Watchers
  • 3 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 5 % Grown

The README.md

Sympatch

Symfony2 code patch tool, (*1)

This bundle has been discontinued, (*2)

Information

DHorchlerSympatchBundle consists in a tool that enables you to patch code parts anywhere in your Symfony project (including vendors). It even lets you extend foreign (vendors) entities!, (*3)

Allows you to send minor code changes to your customers in just a single XML-file!, (*4)

Features:

  • original source file is saved (*.org) when the first patch is entered
  • patches can be deactivated without loosing them (for example before composer.phar update)
  • code location via line number or before/after code fragments (recommended)
  • you can patch any kind of code, not only PHP

Get the bundle

Let Composer download and install the bundle by first adding it to your composer.json, (*5)


{
    "require": {
        "dhorchler/sympatch-bundle": "dev-master"
    }
}

and then running, (*6)

php composer.phar update dhorchler/sympatch-bundle

Enable the bundle

in app/AppKernel.php, (*7)

public function registerBundles() {
    $bundles = array(
        // ...
        new DHorchler\SympatchBundle\DHorchlerSympatchBundle(),
    );
    // ...
}

Create the patch file(s)

use example file at Ressources/patch/patches_examples.xml to create your patch files keeping the XML structure of that file. Sympatch will look for files Ressources/patch/patches_*.xml to load the patches., (*8)

usage:

php app/console patch --func=list
php app/console patch --func=listall
php app/console patch --func=update
php app/console patch --func=deactivateall

hints:

  • when specifying code locations in <beforecode> or <aftercode> tags, copy complete lines from the target source file(s) to the xml file, (*9)

  • by running the tests any patch file in /Resources/patch like patches_.xml is temporarily renamed to patches_.xml.unittest, (*10)

  • the use of <beforecode>, <aftercode> is encouraged over <beforeline>, <afterline> for two reasons: more than one patch in the same file will not cause problems of keeping track of line numbers because of line shifts caused by each patch. generally, chances are better to have patches working after code base upgrades without modifications., (*11)

  • the deactivateall command has been added to allow code base upgrades without version collisions. It will deactivate all patches disregarding the status that each patch has in the patch files. The sequence would be:, (*12)

    • php app/console patch --func=deactivateall
    • do upgrades (e.g. php composer.phar update)
    • php app/console patch --func=update
  • when you send code patches to others, mark the patch file(s) as not processed (<processed>no</processed>). The receiver will have to copy the xml-files to Resources/patch and then restart his application. During the restart Sympatch will look for non processed patch files, process them (onKernelRequest trigger) and mark them as processed., (*13)

The Versions

02/08 2014

dev-master

9999999-dev

Symfony2 code patch tool

  Sources   Download

The Requires

 

by Detlef Horchlerl