dmulholl / ark

A static website generator for people who enjoy the simpler things in life.
https://www.dmulholl.com/docs/ark/master/
The Unlicense
118 stars 7 forks source link

Preventing actions for specific commands #13

Closed gvwilson closed 2 years ago

gvwilson commented 2 years ago

I have a event handler registered for ivy.events.Event.EXIT that copies figure files from src/*/whatever to docs/*/whatever. I want it to run for ivy build and ivy watch, but not for ivy clear. What's the right way to ensure this?

dmulholl commented 2 years ago

Probably best to register it on the EXIT_BUILD event:

https://github.com/dmulholl/ivy/blob/64ab5c1dbc58c5cacefa365a07ce06ff7ddfbb2f/ivy/cli/build.py#L56

gvwilson commented 2 years ago

:+1: I'll give it a try.

dmulholl commented 2 years ago

Good stuff. The build command fires its own set of build events: INIT_BUILD, MAIN_BUILD, and EXIT_BUILD. They're the ones you want to use for anything purely related to building the site.

The watch command ultimately calls the build command so it fires the same set of hooks for each build.

gvwilson commented 2 years ago

thanks. BTW, I'm with http://deepgenomics.com these days, and we're hiring Python programmers... :-)

gvwilson commented 2 years ago

works - thank you

dmulholl commented 2 years ago

Ooooh, that's a really interesting area to work in, pet interest of mine. I've just accepted an offer from a self-driving car company in Berlin, otherwise I'd be all over that. I'll keep an eye on you guys for future opportunities :)