Module PhingBundle review

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Module PhingBundle review

basz
Hi,


As an useful exercise I wrote a PhingModule for ZF2, to run build.xml files with phing.

I took some inspiration from modules such as AsseticBundle and ZfcUser, but would like to ask you to review this and provide some feedback.

What you think missing, incorrect or confusing, on any subject, architectural, ZF2 best practises, general API. etc.


Thank you!

https://github.com/basz/zf2-bundle-phing

Bas

Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Artur Bodera
On Thu, Mar 29, 2012 at 2:40 PM, Bas Kamer <[hidden email]> wrote:
Hi,
 As an useful exercise I wrote a PhingModule for ZF2, to run build.xml files with phing.
 I took some inspiration from modules such as AsseticBundle and ZfcUser, but would like to ask you to review this and provide some feedback.
 What you think missing, incorrect or confusing, on any subject, architectural, ZF2 best practises, general API. etc.


Hey Bas.

Modules in Symfony 2 are called "bundles"
Modules in Zend Framework 2 are called "modules".

It'd be best if you called your ZF2 modules "modules" to avoid confusion (you even used the word "PhingModule" in this email, but then sprinkled "bundle" all over your code).


You could also take a look at my Console branch to make your module console-ready. 

For example:
  1) Your could provide a console-aware controller that performs building.
  2) Define console routes to handle all common phing tasks, i.e.:  ./zf phing build foo outputdir
  


-- 
      __
     /.)\   +48 695 600 936
     \(./   [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

basz
Hi thanks



On 29 mrt. 2012, at 16:00, Artur Bodera wrote:

On Thu, Mar 29, 2012 at 2:40 PM, Bas Kamer <[hidden email]> wrote:
Hi,
 As an useful exercise I wrote a PhingModule for ZF2, to run build.xml files with phing.
 I took some inspiration from modules such as AsseticBundle and ZfcUser, but would like to ask you to review this and provide some feedback.
 What you think missing, incorrect or confusing, on any subject, architectural, ZF2 best practises, general API. etc.


Hey Bas.

Modules in Symfony 2 are called "bundles"
Modules in Zend Framework 2 are called "modules".

It'd be best if you called your ZF2 modules "modules" to avoid confusion (you even used the word "PhingModule" in this email, but then sprinkled "bundle" all over your code).

Purely semantics? Comes from the AsseticBundle which 'bundles' the assetic library. Since I bundle phing, i saw some logic to it.

Regardless the name, would you be able to explain 'vendor' vs 'modules'? Again the AsseticBundle goes into 'modules', which feels wrong...

You could also take a look at my Console branch to make your module console-ready. 

Have a link?

For example:
  1) Your could provide a console-aware controller that performs building.
  2) Define console routes to handle all common phing tasks, i.e.:  ./zf phing build foo outputdir

As for your console suggestions, I am not sure it is really useful to put in the effort to provide console-aware controllers as one can simply run phing manually from the cli.


 

-- 
      __
     /.)\   +48 695 600 936
     \(./   [hidden email]




bushbaby
bushbaby multimedia 
ontwerp & uitvoering
[hidden email] | +31(0)6 2897 7426 | kvk 34125878

Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

basz
In reply to this post by Artur Bodera
Hello?

What would be your preferred name for this module - as PhingBundle is deemed not ZF2?

'Phing'
'PhingModule'
'PhingRunner' (vote+1)





Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Artur Bodera
In reply to this post by basz
On Thu, Mar 29, 2012 at 8:20 PM, Bas Kamer <[hidden email]> wrote:
Purely semantics? Comes from the AsseticBundle which 'bundles' the assetic library. Since I bundle phing, i saw some logic to it.

_The_ semantics :-)

I've found that asseticbundle module you are referring to, but that's just poor naming. I believe its author wanted to do a 1:1 conversion of https://github.com/symfony/AsseticBundle for S2. It's also not the only ZF2 module that "bundles" submodules from other projects (see http://modules.zendframework.com/ )

"Bundles" in S2 are equal in purpose to "Modules" in ZF2. We just call them "Modules" consistently in docs, sites, discussions etc.

 
Regardless the name, would you be able to explain 'vendor' vs 'modules'? Again the AsseticBundle goes into 'modules', which feels wrong...

/modules/ is meant to hold current application modules (including the main Application module).
/vendor/ is meant to hold external modules and libraries (usually fetched via a git submodule, or extracted from an archive).

Modules dir is permutable and usually reflects app-specific functionality. It Co

Vendor dir is static as it contains 3rd party modules. One should not change files inside vendor subdirs, but rather download newer versions of modules/libs from source and configure/extend them in other modules.

Have a link?


Clone it out recursively, then go to one of subfolders and execute the script from console.

As for your console suggestions, I am not sure it is really useful to put in the effort to provide console-aware controllers as one can simply run phing manually from the cli.

Well, I didn't fully understand the purpose of your module then :-) I thought it interfaces with phing and executes stuff, but now I believe I know what you were up to.


A.
Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Artur Bodera
In reply to this post by basz
It doesn't have to have a "Module" suffix.


You could call it:
      1) Your Personal Prefix + main name slug. 
      2) Zf prefix + main name slug


I.e. 
  * ZfPhing
  * BasPhing
  * ZfBasPhing
  * BasZfPhing



--
      __
     /.)\   +48 695 600 936
     \(./   [hidden email]



On Thu, Mar 29, 2012 at 8:28 PM, Bas Kamer <[hidden email]> wrote:
Hello?

What would be your preferred name for this module - as PhingBundle is deemed not ZF2?

'Phing'
'PhingModule'
'PhingRunner' (vote+1)






Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

basz
On 29 mrt. 2012, at 20:34, Artur Bodera wrote:

> It doesn't have to have a "Module" suffix.
>
> Take a look at:  http://modules.zendframework.com/ 
>
> You could call it:
>       1) Your Personal Prefix + main name slug.
>       2) Zf prefix + main name slug
>
> I.e.
>   * ZfPhing
neh, suggests it is from or by ZF
>   * BasPhing
neh, dont need to plug Bas
>   * ZfBasPhing
>   * BasZfPhing

I like it when the name expresses its functionality

So still PhingRunner +1 for me.

> 'Phing'
> 'PhingModule'
> 'PhingRunner' (vote+1)

bushbaby multimedia ontwerp & uitvoering
[hidden email] | +31(0)6 2897 7426 | kvk 34125878

Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Stewart Lord
In reply to this post by basz
For what it's worth I like 'Phing'.


On 12-03-29 11:28 AM, Bas Kamer wrote:

> Hello?
>
> What would be your preferred name for this module - as PhingBundle is deemed not ZF2?
>
> 'Phing'
> 'PhingModule'
> 'PhingRunner' (vote+1)
>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

basz
In reply to this post by Artur Bodera

On 29 mrt. 2012, at 20:31, Artur Bodera wrote:

> On Thu, Mar 29, 2012 at 8:20 PM, Bas Kamer <[hidden email]> wrote:
>> Regardless the name, would you be able to explain 'vendor' vs 'modules'? Again the AsseticBundle goes into 'modules', which feels wrong...
>
> /modules/ is meant to hold current application modules (including the main Application module).
> /vendor/ is meant to hold external modules and libraries (usually fetched via a git submodule, or extracted from an archive).

clear

> Modules dir is permutable and usually reflects app-specific functionality. It Co

It Co?....

(permutable? - order of each module can be changed?)

> Vendor dir is static as it contains 3rd party modules. One should not change files inside vendor subdirs, but rather download newer versions of modules/libs from source and configure/extend them in other modules.

>> As for your console suggestions, I am not sure it is really useful to put in the effort to provide console-aware controllers as one can simply run phing manually from the cli.
> Well, I didn't fully understand the purpose of your module then :-) I thought it interfaces with phing and executes stuff, but now I believe I know what you were up to.

I do see some advantage to do this eventually - as it would be easy to define the environment and build.properties coming from an (ZF2) app.

> A.



bushbaby multimedia ontwerp & uitvoering
[hidden email] | +31(0)6 2897 7426 | kvk 34125878

Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Artur Bodera
On Thu, Mar 29, 2012 at 8:52 PM, Bas Kamer <[hidden email]> wrote:
> Modules dir is permutable and usually reflects app-specific functionality. It Co
(permutable? - order of each module can be changed?)

Permutable - as in "dynamic". You put your own code in /modules/ and fetch external deps into /vendor/.
If you want to reuse one of your modules across several apps, then it also flies to /vendor/

 
I do see some advantage to do this eventually - as it would be easy to define the environment and build.properties coming from an (ZF2) app.


Of course. Being run from within a zf2 controller gives you access to the whole application, so you can perform variety of tasks on a real installation.

Cheers. 



-- 
      __
     /.)\   +48 695 600 936
     \(./   [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Artur Bodera
In reply to this post by Stewart Lord
On Thu, Mar 29, 2012 at 8:52 PM, Stewart Lord <[hidden email]> wrote:
For what it's worth I like 'Phing'.


"Phing" is already a project name.

Here we consider a zf-specific module, so "ZfPhing" seems like best fit.


-- 
      __
     /.)\   +48 695 600 936
     \(./   [hidden email]


 
Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Tomáš Fejfar
What's the use-case of having Phing module? 

On Thu, Mar 29, 2012 at 8:58 PM, Artur Bodera <[hidden email]> wrote:
On Thu, Mar 29, 2012 at 8:52 PM, Stewart Lord <[hidden email]> wrote:
For what it's worth I like 'Phing'.


"Phing" is already a project name.

Here we consider a zf-specific module, so "ZfPhing" seems like best fit.


-- 
      __
     /.)\   <a href="tel:%2B48%20695%20600%20936" value="+48695600936" target="_blank">+48 695 600 936
     \(./   [hidden email]


 

Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

basz
On 29 mrt. 2012, at 22:44, Tomáš Fejfar wrote:

> What's the use-case of having Phing module?

'Lo

My specific use is the following :

I have a build.xml that
- creates a unique build dir
- downloads some jpg files
- builds a .mov from them (ffmpeg)
- copies a skeleton static website into the tmp dir
- places the jpg's into the webproject
- replaces ##tokens## in an html file
- set javascript options
- zips tmp dir
- moves the zip to special dir
- removes tmp dir

This needs to be run from the browser.

Yes I could have done this with 50 lines of PHP code, but I did not :-)
Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Kyle Spraggs

Please DO NOT use ZfPhing. This implies it is part of the Zf (official) namespace. Unless, or course, it is official and I missed it while skimming this thread.

On Mar 29, 2012 4:02 PM, "Bas Kamer" <[hidden email]> wrote:
On 29 mrt. 2012, at 22:44, Tomáš Fejfar wrote:

> What's the use-case of having Phing module?

'Lo

My specific use is the following :

I have a build.xml that
- creates a unique build dir
- downloads some jpg files
- builds a .mov from them (ffmpeg)
- copies a skeleton static website into the tmp dir
- places the jpg's into the webproject
- replaces ##tokens## in an html file
- set javascript options
- zips tmp dir
- moves the zip to special dir
- removes tmp dir

This needs to be run from the browser.

Yes I could have done this with 50 lines of PHP code, but I did not :-)
Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

David Muir-2
In reply to this post by Tomáš Fejfar
My understanding is that it runs Phing tasks from within ZF. So you can set up controllers that trigger various phing tasks natively, rather than make system calls. Bas, am I correct?

David

On 30/03/12 07:44, Tomáš Fejfar wrote:
What's the use-case of having Phing module? 

On Thu, Mar 29, 2012 at 8:58 PM, Artur Bodera <[hidden email]> wrote:
On Thu, Mar 29, 2012 at 8:52 PM, Stewart Lord <[hidden email]> wrote:
For what it's worth I like 'Phing'.


"Phing" is already a project name.

Here we consider a zf-specific module, so "ZfPhing" seems like best fit.


-- 
      __
     /.)\   <a moz-do-not-send="true" href="tel:%2B48%20695%20600%20936" value="+48695600936" target="_blank">+48 695 600 936
     \(./   [hidden email]


 


Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Artur Bodera
In reply to this post by Kyle Spraggs
On Thu, Mar 29, 2012 at 11:46 PM, Kyle Spraggs <[hidden email]> wrote:

Please DO NOT use ZfPhing. This implies it is part of the Zf (official) namespace. Unless, or course, it is official and I missed it while skimming this thread.

I don't see such assumption. Zf means "for zend framework" while "Phing" points at the tech we're integrating with.

If you go through the list at http://modules.zendframework.com/ you'll see the following patterns:

  * just a name  (Bacon)
  * author's prefix + name (mwGearman)
  * name + "module"  (DoctrineModule)
  * "zf" + hyphen + name + hyphen + module (zf-facebook-module)
  * "zf" + name (ZfTwig).

We do not have any naming revision authority (yet?) and we proposed against erecting one, so actually the name can be anything. The only "recommendation" I remember (on this ML) was:
  * author's prefix + name (remember Evan? :-)

ps: not saying a "stronger recommendation" (with Paddy's Ninja Assasin's handy) wouldn't be a good idea ...

-- 
      __
     /.)\   +48 695 600 936
     \(./   [hidden email]


 
Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

weierophinney
Administrator
-- Artur Bodera <[hidden email]> wrote
(on Friday, 30 March 2012, 06:57 AM +0200):

> On Thu, Mar 29, 2012 at 11:46 PM, Kyle Spraggs <[hidden email]> wrote:
>     Please DO NOT use ZfPhing. This implies it is part of the Zf (official)
>     namespace. Unless, or course, it is official and I missed it while skimming
>     this thread.
>
> I don't see such assumption. Zf means "for zend framework" while "Phing" points
> at the tech we're integrating with.
>
> If you go through the list at http://modules.zendframework.com/ you'll see the
> following patterns:
>
>   * just a name  (Bacon)
>   * author's prefix + name (mwGearman)
>   * name + "module"  (DoctrineModule)
>   * "zf" + hyphen + name + hyphen + module (zf-facebook-module)
>   * "zf" + name (ZfTwig).
>
> We do not have any naming revision authority (yet?) and we proposed
> against erecting one, so actually the name can be anything. The only
> "recommendation" I remember (on this ML) was:
>   * author's prefix + name (remember Evan? :-)
>
> ps: not saying a "stronger recommendation" (with Paddy's Ninja Assasin's handy)
> wouldn't be a good idea ...

I think the point Kyle is making, however, is that "Zf" implies that
Zend Framework ships it, or that it has "official sanction."
Additionally, choosing such a prefix is likely to lead to naming
collisions (who chose "ZfTwig" first -- developer A or developer B? and
which is the one I was just recommended?), as well as to confusion as to
where to obtain the code ("ZF... that means Zend Framework, right? why
can't I find the code in their packages?").

I'm definitely of the mind that we should name with unique vendor
prefixes -- be it a company name, personal name/initials, or otherwise,
but something that can be easily traced back to the originator.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Derek Miranda

On Mar 30, 2012, at 9:04 AM, Matthew Weier O'Phinney wrote:

> -- Artur Bodera <[hidden email]> wrote
> (on Friday, 30 March 2012, 06:57 AM +0200):
>> On Thu, Mar 29, 2012 at 11:46 PM, Kyle Spraggs <[hidden email]> wrote:
>>    Please DO NOT use ZfPhing. This implies it is part of the Zf (official)
>>    namespace. Unless, or course, it is official and I missed it while skimming
>>    this thread.
>>
>> I don't see such assumption. Zf means "for zend framework" while "Phing" points
>> at the tech we're integrating with.
>>
>> If you go through the list at http://modules.zendframework.com/ you'll see the
>> following patterns:
>>
>>  * just a name  (Bacon)
>>  * author's prefix + name (mwGearman)
>>  * name + "module"  (DoctrineModule)
>>  * "zf" + hyphen + name + hyphen + module (zf-facebook-module)
>>  * "zf" + name (ZfTwig).
>>
>> We do not have any naming revision authority (yet?) and we proposed
>> against erecting one, so actually the name can be anything. The only
>> "recommendation" I remember (on this ML) was:
>>  * author's prefix + name (remember Evan? :-)
>>
>> ps: not saying a "stronger recommendation" (with Paddy's Ninja Assasin's handy)
>> wouldn't be a good idea ...
>
> I think the point Kyle is making, however, is that "Zf" implies that
> Zend Framework ships it, or that it has "official sanction."
> Additionally, choosing such a prefix is likely to lead to naming
> collisions (who chose "ZfTwig" first -- developer A or developer B? and
> which is the one I was just recommended?), as well as to confusion as to
> where to obtain the code ("ZF... that means Zend Framework, right? why
> can't I find the code in their packages?").
>
> I'm definitely of the mind that we should name with unique vendor
> prefixes -- be it a company name, personal name/initials, or otherwise,
> but something that can be easily traced back to the originator.
>

I completely agree. Furthermore, if you don't have some relatively strict naming conventions in place, as the available modules grow, it will be a series of alphabet soup and just a mess. I don't think "zf" needs to appear in the name at all. After all, if someone is downloading a module off of the Zend modules site I think it is clear it is for Zend Framework. Even if they aren't, it will be a developer downloading it and if they aren't sure which framework they are using, well, they shouldn't be developers. My personal preference would be:

function_company_version  

Examples:
Cart_ClickLogical_2
PhotoAlbum_ClickLogical_1.1
PhotoAlbum_AwesomeCoder_4


> --
> Matthew Weier O'Phinney
> Project Lead            | [hidden email]
> Zend Framework          | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Marc Bennewitz (private)
In reply to this post by weierophinney
 

> -- Artur Bodera <[hidden email]> wrote
> (on Friday, 30 March 2012, 06:57 AM +0200):
> > On Thu, Mar 29, 2012 at 11:46 PM, Kyle Spraggs <[hidden email]>
> wrote:
> >     Please DO NOT use ZfPhing. This implies it is part of the Zf
> (official)
> >     namespace. Unless, or course, it is official and I missed it while
> skimming
> >     this thread.
> >
> > I don't see such assumption. Zf means "for zend framework" while "Phing"
> points
> > at the tech we're integrating with.
> >
> > If you go through the list at http://modules.zendframework.com/ you'll see
> the
> > following patterns:
> >
> >   * just a name  (Bacon)
> >   * author's prefix + name (mwGearman)
> >   * name + "module"  (DoctrineModule)
> >   * "zf" + hyphen + name + hyphen + module (zf-facebook-module)
> >   * "zf" + name (ZfTwig).
> >
> > We do not have any naming revision authority (yet?) and we proposed
> > against erecting one, so actually the name can be anything. The only
> > "recommendation" I remember (on this ML) was:
> >   * author's prefix + name (remember Evan? :-)
> >
> > ps: not saying a "stronger recommendation" (with Paddy's Ninja Assasin's
> handy)
> > wouldn't be a good idea ...
>
> I think the point Kyle is making, however, is that "Zf" implies that
> Zend Framework ships it, or that it has "official sanction."
> Additionally, choosing such a prefix is likely to lead to naming
> collisions (who chose "ZfTwig" first -- developer A or developer B? and
> which is the one I was just recommended?), as well as to confusion as to
> where to obtain the code ("ZF... that means Zend Framework, right? why
> can't I find the code in their packages?").
>
> I'm definitely of the mind that we should name with unique vendor
> prefixes -- be it a company name, personal name/initials, or otherwise,
> but something that can be easily traced back to the originator.
I think it's up to the author naming his module until it will be published on a official (modules.zendframework.com) site but than it should a name saying what it is doing only.
That it is a ZF module, which user published it or what ever should be addressed by the official site were it was published.

Btw. modules should be verified / signed before publishing to make sure it follows licenses and doesn't mean ill.

>
> --
> Matthew Weier O'Phinney
> Project Lead            | [hidden email]
> Zend Framework          | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>
Reply | Threaded
Open this post in threaded view
|

Re: Module PhingBundle review

Matus Zeman
I've been following this discussion... but now I have to say my thoughts as I believe it has gone a bit wild.

I don't think there should be some restriction on module name apart of:
  • it should be prefixed by author/company name - to eliminate as much as possible name collisions.
  • second part can but does not have to indicate what the module is about... but obviously developers will choose meaningful names - why should they not anyway?
I don't see the reason renaming modules once they are "somewhere"....
Module aggregating websites should have own categorization which will filter out modules a user is looking for - e.g. looking in "authentication/user management" category returns "ZfcUser" and "KapitchiIdentity" modules...  

Cheers and happy Friday!
Matus

On Fri, Mar 30, 2012 at 2:40 PM, Marc Bennewitz <[hidden email]> wrote:

> -- Artur Bodera <[hidden email]> wrote
> (on Friday, 30 March 2012, 06:57 AM +0200):
> > On Thu, Mar 29, 2012 at 11:46 PM, Kyle Spraggs <[hidden email]>
> wrote:
> >     Please DO NOT use ZfPhing. This implies it is part of the Zf
> (official)
> >     namespace. Unless, or course, it is official and I missed it while
> skimming
> >     this thread.
> >
> > I don't see such assumption. Zf means "for zend framework" while "Phing"
> points
> > at the tech we're integrating with.
> >
> > If you go through the list at http://modules.zendframework.com/ you'll see
> the
> > following patterns:
> >
> >   * just a name  (Bacon)
> >   * author's prefix + name (mwGearman)
> >   * name + "module"  (DoctrineModule)
> >   * "zf" + hyphen + name + hyphen + module (zf-facebook-module)
> >   * "zf" + name (ZfTwig).
> >
> > We do not have any naming revision authority (yet?) and we proposed
> > against erecting one, so actually the name can be anything. The only
> > "recommendation" I remember (on this ML) was:
> >   * author's prefix + name (remember Evan? :-)
> >
> > ps: not saying a "stronger recommendation" (with Paddy's Ninja Assasin's
> handy)
> > wouldn't be a good idea ...
>
> I think the point Kyle is making, however, is that "Zf" implies that
> Zend Framework ships it, or that it has "official sanction."
> Additionally, choosing such a prefix is likely to lead to naming
> collisions (who chose "ZfTwig" first -- developer A or developer B? and
> which is the one I was just recommended?), as well as to confusion as to
> where to obtain the code ("ZF... that means Zend Framework, right? why
> can't I find the code in their packages?").
>
> I'm definitely of the mind that we should name with unique vendor
> prefixes -- be it a company name, personal name/initials, or otherwise,
> but something that can be easily traced back to the originator.
I think it's up to the author naming his module until it will be published on a official (modules.zendframework.com) site but than it should a name saying what it is doing only.
That it is a ZF module, which user published it or what ever should be addressed by the official site were it was published.

Btw. modules should be verified / signed before publishing to make sure it follows licenses and doesn't mean ill.

>
> --
> Matthew Weier O'Phinney
> Project Lead            | [hidden email]
> Zend Framework          | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>

12