Question, from the Cordova Hooks doc:
"This directory used to exist at .cordova/hooks, but has now been
moved to the project root." -> doesn't this imply that .cordova/hooks
does not work anymore, you should use hooks/ ?

On Wed, Jul 9, 2014 at 9:24 AM, Sergey Grebnov (Akvelon)
<v-seg...@microsoft.com> wrote:
> I've just sent a PR with unified hooks implementation for both cordova app 
> and plugins developers.  Please review
> https://github.com/apache/cordova-lib/pull/55
>
> More details
> https://github.com/MSOpenTech/cordova-lib/commit/952690b7d7b42962b4e246c2b84c309846bf8750?short_path=8c918a9#diff-8c918a9f452feb5e3ef3339749806fc3
>
> * Hooks can be defined in .cordova/hooks/hook_type, hooks/hook_type 
> directories, config.xml (by application developers) and 
> plugins/.../plugin.xml (by plugins developers)
> * Javascript hooks retrieved from config.xml and plugins/.../plugin.xml will 
> be run via new module loader with special Context argument passed. This 
> object represents current hook script execution context including hook type, 
> cordova version, paths, plugin info and other special utility modules.
> * Introduced before_plugin_install, after_plugin_install and 
> before_plugin_uninstall hooks.
>
> Thx!
> Sergey
> -----Original Message-----
> From: Sergey Grebnov (Akvelon) [mailto:v-seg...@microsoft.com]
> Sent: Friday, May 16, 2014 4:08 AM
> To: dev@cordova.apache.org
> Subject: RE: Proposal: hooks support for plugins
>
> Addressed code review notes, added spec tests, moved to cordova-lib repo.
> https://github.com/apache/cordova-lib/pull/12
>
> Thx!
> Sergey
> -----Original Message-----
> From: Sergey Grebnov (Akvelon) [mailto:v-seg...@microsoft.com]
> Sent: Wednesday, April 30, 2014 2:08 PM
> To: dev@cordova.apache.org
> Subject: RE: Proposal: hooks support for plugins
>
> Updated code as per latest notes. Do we ready to merge this?
>
> https://github.com/apache/cordova-plugman/pull/74
>
> Thx!
> Sergey
> -----Original Message-----
> From: mmo...@google.com [mailto:mmo...@google.com] On Behalf Of Michal Mocny
> Sent: Tuesday, April 22, 2014 10:39 AM
> To: dev
> Subject: Re: Proposal: hooks support for plugins
>
> Passing in a reference is not a bad idea, though that implies that there is a 
> single top-level `cordova` object to reference.  Not sure if thats the plan 
> so far.. though it could be.
>
> Probably easier to just support require() of cordova bits, but I'm not sure 
> how to get that to work.
>
>
> On Tue, Apr 22, 2014 at 1:32 PM, Brian LeRoux <b...@brian.io> wrote:
>
>> shhh
>>
>>
>> On Tue, Apr 22, 2014 at 10:18 AM, purplecabbage
>> <purplecabb...@gmail.com
>> >wrote:
>>
>> > If you need a shell script, that can be easily hidden behind the
>> > node module.
>> >
>> > Sent from my iPhone
>> >
>> > > On Apr 22, 2014, at 9:34 AM, Brian LeRoux <b...@brian.io> wrote:
>> > >
>> > > Maybe harsh but I'm in favor of abandoning shell scripts
>> > > altogether and forcing modules as the way for hooks. Cross platform yada 
>> > > yada.
>> > >
>> > >
>> > >> On Tue, Apr 22, 2014 at 9:23 AM, Andrew Grieve
>> > >> <agri...@chromium.org>
>> > wrote:
>> > >>
>> > >> Very good point. Seen at least one other bug report that
>> > >> struggled
>> with
>> > >> this use-case.
>> > >>
>> > >> I *think* hooks-as-a-module makes it easier.
>> > >>
>> > >> Just to be clear - I am also in favour of allowing hooks to be
>> > >> npm
>> > modules.
>> > >> Possible there's use in continuing to support bash scripts as
>> > >> hooks,
>> but
>> > >> there are definitely advantages to allowing modules.
>> > >>
>> > >>
>> > >> On Tue, Apr 22, 2014 at 12:15 PM, Michal Mocny
>> > >> <mmo...@chromium.org>
>> > >> wrote:
>> > >>
>> > >>> I was recently trying to solve a problem with hooks: how do I
>> require()
>> > >>> cordova itself?  (I was trying to call "cordova plugin ls" and
>> > >>> ended
>> up
>> > >>> just writing my own crude inline implementation instead).  If
>> > >>> the
>> hooks
>> > >>> themselves are being require()-ed, does it simplify that problem?
>> > >>>
>> > >>> -Michal
>> > >>>
>> > >>>
>> > >>> On Tue, Apr 22, 2014 at 12:04 PM, Andrew Grieve <
>> agri...@chromium.org
>> > >>>> wrote:
>> > >>>
>> > >>>> There are some *disadvantages* to not sub-shelling out for hooks:
>> > >>>> - Harder to capture their stdio (certainly do-able though by
>> swapping
>> > >> out
>> > >>>> system.std* for the duration of the hook)
>> > >>>> - Harder to handle script failures (e.g. if they throw an
>> > >>>> uncaught exception, we would like to be able to say "This hook script 
>> > >>>> failed:
>> > >>>> foo.js")
>> > >>>>  - Maybe this is doable, by storing a global
>> > >>>> exception-was-thrown callback?
>> > >>>> - Gives hooks the ability to mess up cordova's environment
>> > >>>> (although
>> > >>> maybe
>> > >>>> the vm thing addresses this?)
>> > >>>>
>> > >>>> Would like to see tests for these things added before we launch
>> > >>>> this feature.
>> > >>>>
>> > >>>>
>> > >>>>
>> > >>>> On Tue, Apr 22, 2014 at 10:40 AM, Sergey Grebnov (Akvelon) <
>> > >>>> v-seg...@microsoft.com> wrote:
>> > >>>>
>> > >>>>> +1, I will name it as 'context'
>> > >>>>>
>> > >>>>> Thx!
>> > >>>>> Sergey
>> > >>>>> -----Original Message-----
>> > >>>>> From: Jonathan Bond-Caron [mailto:jbo...@gdesolutions.com]
>> > >>>>> Sent: Tuesday, April 22, 2014 7:34 AM
>> > >>>>> To: dev@cordova.apache.org
>> > >>>>> Subject: RE: Proposal: hooks support for plugins
>> > >>>>>
>> > >>>>>> On Mon Apr 21 03:39 PM, Sergey Grebnov (Akvelon) wrote:
>> > >>>>>> module.exports = function(platform, projectDir, pluginDir,
>> > >> cmdLine) {
>> > >>>>>>    console.log('hook.js: ' + platform);
>> > >>>>>>    console.log('hook.js: ' + projectDir);
>> > >>>>>>    console.log('hook.js: ' + pluginDir);
>> > >>>>>>    console.log('hook.js: ' + cmdLine);
>> > >>>>>
>> > >>>>> Personnaly prefer:
>> > >>>>>
>> > >>>>>> module.exports = function(hookApi) {
>> > >>>>>>    console.log('hook.js: ' + hookApi.platform);
>> > >>>>>>    console.log('hook.js: ' + hookApi.projectDir);
>> > >>>>>>    console.log('hook.js: ' + hookApi.pluginDir);
>> > >>>>>>    console.log('hook.js: ' + hookApi.cmdLine);}
>> > >>>>>
>> > >>>>> Make it easier to pass other stuff in the future & using a
>> > >>>>> sandoxed hookApi object.
>> > >>
>> >
>>

Reply via email to