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
Post a Comment