Ticket #204 (assigned enhancement)

Opened 5 months ago

Last modified 3 months ago

Resolve task class names with PEAR/ZEND/etc. naming convention

Reported by: Markus Fischer <markus@fischer.name> Assigned to: hans (accepted)
Priority: major Milestone: 2.3.1
Component: phing-core Version: 2.3.0
Keywords: Cc:

Description

I'm creating specific tasks which are put in our own code repository, e.g. MyRepos. All our classes follow the prominent naming convention of class name matches directory to filename, e.g. MyRepos/Some/File.php requires the class MyRepos_Some_File being in File.php .

Now <taskdef> supports providing a classname but only has one rule to instantiate the class, namely by it right-most name before the first dot. So when I provide

<taskdef name="mytask" classname="MyRepos.Phing.OurOwnTask">

only OurOwnTask is tried to be instantiated. With the attached patch, when this resolution fails, the classname dots are converted to underscores and then the class is tried to instantiate, in this example MyRepos_Phing_OurOwnTask .

Since the naming convention I'm using is quite common, it shouldn't be seen as too specific and maybe of interest for phing in general. I hope :)

Patch is against 2.3 branch. I'm aware of #188 but still think this could be integrated already.

Attachments

pear_style_task_class.diff (1.0 kB) - added by Markus Fischer <markus@fischer.name> on 12/24/07 15:19:32.
Patch resolving classes with PEAR naming convention if traditional resolving fails
pear_style_filter_class.diff (0.7 kB) - added by Markus Fischer <markus@fischer.name> on 12/27/07 01:10:46.
Similiar to the other patch, this time Phing::import() to import PEAR-Style custom filters

Change History

12/24/07 15:19:32 changed by Markus Fischer <markus@fischer.name>

  • attachment pear_style_task_class.diff added.

Patch resolving classes with PEAR naming convention if traditional resolving fails

12/27/07 01:10:46 changed by Markus Fischer <markus@fischer.name>

  • attachment pear_style_filter_class.diff added.

Similiar to the other patch, this time Phing::import() to import PEAR-Style custom filters

02/06/08 20:37:10 changed by hans

  • priority changed from trivial to major.
  • status changed from new to assigned.

Yeah, we can do this, though I'd like to centralize this into a single place, if possible. I'll take a deeper look at this and get it in for 2.3.1


Add/Change #204 (Resolve task class names with PEAR/ZEND/etc. naming convention)