[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] how to change present working directory?
From: |
Bryan Berry |
Subject: |
Re: [Fab-user] how to change present working directory? |
Date: |
Tue, 14 Oct 2008 06:52:05 +0545 |
On Mon, 2008-10-13 at 09:36 -0400, Jeff Forcier wrote:
> Hi Bryan,
>
> Fabric (and similar tools) don't actually keep a persistent shell open
> on the remote machine; instead, each call to run() invokes a single
> remote command. As such, interactive shell session commands such as
> 'cd' don't make any sense; what happens is you're simply opening a
> shell, cd-ing to /var/myapp, and then closing the shell.
Thanks for your quick reply Jeff!
> I can't think of a single Unix command that actually cares what
> directory you're in, however, save for poorly written scripts and such
> that source files based on where you're executing from instead of
> where the script itself is ;) so you should always be able to work
> around this limitation.
Hopefully this is the not the problem w/ git. You're right I can up put
a script on the remote server and put cd's w/ in it.
> In your case, going by what I'm seeing in 'git help clone', you should
> be able to simply do:
>
> run('git clone git://myserver/foo.git /var/myapp/foo')
>
> and that should create the new Git checkout/clone in /var/myapp/foo
> (so the git folder would end up at /var/myapp/foo/.git, with the top
> level of that Git repo at the same level).
>
> Finally, apologies if this is obvious to you :) but you can also
> "emulate" the usefulness of 'cd' by storing the directory name(s) you
> wish to work in as Python vars or Fab vars in your Fabfile, and then
> using them in your run commands to avoid repetition.
>
> Regards,
> Jeff
>
> On Mon, Oct 13, 2008 at 8:32 AM, Bryan Berry <address@hidden> wrote:
> > hey guys,
> >
> > I just started playing w/ Fabric, awesome tool! I am having trouble
> > changing the working directory w/ run("cd /var/myapp") . I need to
> > change the current directory before performing my code checkout w/ git.
> >
> > run("cd /var/myapp") works w/ out errors but all following run()
> > commands operate in my /root directory
> >
> > Is there an easy way to change this? perhaps w/ the fab_shell variable?
> >
> > thanks again for the great tool. I may ask some basic questions as I am
> > new to Python.
> >
> > --
> > Bryan W. Berry
> > Technology Director
> > OLE Nepal, http://www.olenepal.org
> >
> >
> >
> > _______________________________________________
> > Fab-user mailing list
> > address@hidden
> > http://lists.nongnu.org/mailman/listinfo/fab-user
> >
--
Bryan W. Berry
Technology Director
OLE Nepal, http://www.olenepal.org