Future of Hook Names

47 views
Skip to first unread message

noazark

unread,
Apr 17, 2012, 6:49:33 PM4/17/12
to hoo...@googlegroups.com
I'd like to pry for some input on the future of hook names. I'm fine with the whole convention over configuration approach to the names and spawning, but it's currently lacking the configuration side (see https://github.com/hookio/hook.io/blob/master/lib/hookio/spawn.js#L97). I've had a few cases where a single application uses multiple private hooks and spawning is a pain because you're forced to use the src parameter if you hook isn't prefixed with 'hook.io-'. It seems like the conventional prefix is great fort public hooks, but not so much for the private ones. I am afraid to pollute my code with a bunch of prefixed files.

Will/should this be changing in the future? Please feel free to set me straight, if this is a desired practice I will start following the rules even on my private hooks.

Marak Squires

unread,
Apr 17, 2012, 7:06:04 PM4/17/12
to hoo...@googlegroups.com
The idea of appending "hook.io-" to hooks is being deprecated in favor of a proper hook type system. You should not be using it.

What is wrong with using the src parameter in Hook.spawn? Let's try to fix that API so it can do what you need?

On Tue, Apr 17, 2012 at 3:49 PM, noazark <no...@rendergardenmedia.com> wrote:
I'd like to pry for some input on the future of hook names. I'm fine with the whole convention over configuration approach to the names and spawning, but it's currently lacking the configuration side (see https://github.com/hookio/hook.io/blob/master/lib/hookio/spawn.js#L97). I've had a few cases where a single application uses multiple private hooks and spawning is a pain because you're forced to use the src parameter if you hook isn't prefixed with 'hook.io-'. It seems like the conventional prefix is great fort public hooks, but not so much for the private ones. I am afraid to pollute my code with a bunch of prefixed files.

Will/should this be changing in the future? Please feel free to set me straight, if this is a desired practice I will start following the rules even on my private hooks.



--
-- 
Marak Squires
Co-founder and Chief Evangelist
Nodejitsu, Inc.

noazark

unread,
Apr 17, 2012, 7:38:52 PM4/17/12
to hoo...@googlegroups.com
That's good to know, I'm glad to hear it. My issue with the src parameter is it's scope. It calls from the Hook.io module, so the call of require.resolve() gets all weird. I end up writing the path like this:

hook.spawn({ src: '../../../../lib/harvester' });

Which is super dumb. Or else I can get the same (better) result with:

hook.spawn({ src: path.resolve('./lib/harvester.js') });

I really don't mind that solution, but it still feels like too much. I'm going to look and see if my problem is a lack of understanding of require(). This doesn't seem like a Hook.io problem and I'm probably just too easily annoyed with local path resolution.

Marak Squires

unread,
Apr 17, 2012, 7:41:12 PM4/17/12
to hoo...@googlegroups.com
I think there is a bug with the spawn api src. Probably a few line patch.

noazark

unread,
Apr 17, 2012, 7:53:23 PM4/17/12
to hoo...@googlegroups.com
I'll take a deeper look at it.

noazark

unread,
Apr 18, 2012, 5:06:43 AM4/18/12
to hoo...@googlegroups.com
I've opened up issue #191 to continue discussion.
Reply all
Reply to author
Forward
0 new messages