I tend to set an "environment" or "profile" variable in my test(),
production() and similar commands:

def test():
   config.profile = "test"

And then check it in the commands where I need to make decisions based
on its value:

def  deploy():
   require("profile", provided_by=[test, production])
   if config.profile == "test":
      test_specific_stuff()
   ...

Or with a decorator:

@requires('profile', provided_by=[test, production])
def  deploy():
   if config.profile == "test":
      test_specific_stuff()
   ...


On Tue, Mar 17, 2009 at 11:19 AM, Gregory Tappero <[email protected]> wrote:
> Hi,
>
> I have a test() and production() function as well as a deploy()
> I would like deploy() to vary depending on the previous parameter (test or 
> prod)
> Should i use fab_mode = "test" in test and do a if check or there are
> some better way using decorators.
>
> Thanks.
>
> --
> o/
>
>
> _______________________________________________
> Fab-user mailing list
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/fab-user
>



-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.


_______________________________________________
Fab-user mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to