[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fab-user] Fabric parameter to load fabfile.py recursive (up in folders)
From: |
Domen Kožar |
Subject: |
[Fab-user] Fabric parameter to load fabfile.py recursive (up in folders) |
Date: |
Wed, 30 Dec 2009 16:48:37 +0100 |
Hello!
Let me explain my usecase for idea.
I have a directory where all my programming projects lie. Lets call
it /home/user/code. Inside that folder I want to have fabfile.py which
provides me with utility commands common to all projects.
Now, I also have a fabfile.py in every project
(/home/user/code/project/fabfile.py).
Problem:
I want to override some env settings and maybe add additional functions
to /home/user/code/fabfile.py in each projects
Current solution:
Import my "global project fabfile" from /home/user/code/fabfile.py in
every project.
I'm proposing to let Fabic be even more project-oriented tool to support
loading fabfiles recursively up in directories. This would make it more
dynamic.
Before I explain the implementation details let me emphasize what would
I gain with this behaviour:
- if I *ever* decide to migrate /home/user/code folder I would not need
to update all project fabfiles
- no boilerplate code
- easier common-project management
Implementation (with example):
current directory:
/home/user/code/project/templates/
1. User launches fabric like this: fab --recursive -l
2. Fabric would then search first for /fabfile.py, continue
to /home/fabfile.py, /home/user/code/fabfile.py ...
3. Use cases on loading fabfile:
- not found: skip one directory down
- found: update all variables from found fabfile and override them with
current ones (if we have a previous fabfile)
4. In the end Fabric would display list of commands joined from all
fabfiles.
I don't know the current status of internal code around loading fabric
files, but if you feel such behaviour is reasonable I am willing to
provide a basic working patch.
Greetings and a happy New Year, Domen
- [Fab-user] Fabric parameter to load fabfile.py recursive (up in folders),
Domen Kožar <=