ruby - Temporarily change current directory in Rake -


i run multiple commands need (or easier be) in directory, once they're done, return previous working directory.

i'm envisioning similar fabric's with cd(path):, e.g.:

cd('.git')    file.unlink('config') end 

is there inbuilt way of doing in rake, or should writing custom method accepts block, etc.?

it inbuilt dir#chdir call:

dir.chdir('.git')   file.unlink('config') end 

excerpt docs:

if block given, passed name of new current directory, , block executed current directory. original working directory restored when block exits.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -