> asked. what do you think?
I mused, and thought some sort of global option would be appropriate.
Thus the ~/.doit.py I did in the patch.
Buut--
> > That's a good point. Not everyone has my workflow, after all. :) Wouldn't
> > it need to be an environment variable (or ~/.doit.py config-file), or
> > something similar?
>
> I guess this option is better suited as project specific instead of being
> enabled for all dodo.py i.e.
>
> ~/work/dodo.py (some management stuff that i dont want to be executed by
> mistake
> ~/work/project_a/dodo.py (project with sub-folders where i want this dodo.py
> to be used...
Hmm. That's a point. Okay, how is this for a solution: instead of a
global
~/.doit.py file, "doit" will scan up from the current directory
looking for a
non-invisible "doitcfg.py" file; it would override whatever would have
been set
in ~/.doit.py
So you could do per-project configuration by just putting "doitcfg.py"
at the
base of whatever your project is.
For me, I'd probably just set ~/.doit.py -- because the way I work I'd
almost
always want that. But for others, they could set the whole 'find
dodo_file
in parents' setting on a per-project basis if they'd like.
> > Because I'm not sure if its a good idea to traverse to parent directories
> > and execute the dodo.py to look for its DOIT_CONFIG, just to see if it
> > should be allowed to search up the tree.
>
> dodo.py dont need to be "executed" it just need to be "imported". if the
> tasks should not be execute, these will only be called by "mistake" so it
> doesnt really matter if we are searching up the tree to do nothing...
[tweaking order of replies]
> > Since this feature is about finding a dodo file, it can't use the
> > existing DOIT_CONFIG mechanism for configuration
>
> yes it can. the config is not used to describe the mechanism to find the
> dodo.py file. dodo.py is found by looking up in the directory. the config is
> used to decide if the dodo.py found by looking up is allowed to execute its
> tasks or not. agree?
Well, that's a question of semantics of what "executed" means.
Importing
does in fact execute the file, it just doesn't call any functions in
it. I'm
personally a bit wary about importing files that I don't actually
intend on
using: importing a module can have side-effects -- even if its a good
idea
for one to code in such a way that said side-effects are safe.
But if you don't think that concern is warranted, I can fold the above
idea
into dodo.py: instead of looking for a "doitcfg.py", just search up
from the
current directory always and import any dodo.py's we find, looking for
one
which has DOIT_CONFIG["allow_seek_dodo_file"] (or whatever) set to
True.
I'm a bit wary about that, but only a bit: if you think that's better
I can tweak
the patch/branch. It may be I'm being paranoid.
> > Here's my attempt -- I tried to follow the style and methodology of
> > the existing package.
>
> sorry. i didnt reply before you've done this... you were too fast :D
No worries :D
It was a slow day, and was an excuse to dig into doit's internals and
learn
how things are done.
Yeah, I'm doing that.
I basically have
DOIT_CONFIG = {"default_tasks": ["build"]}
def task_build():
return {"task_dep": ["headjs", "mootools", "blueprintcss"]}
and the like.
Then a similar, 'task_test' which builds out the website and launches
the test-server; then a task_push that its its own group, building out
a production version of the website, adding it to git and pushing it
off.
And thanks for the great tool :)
--matt