
Untitled
By: a guest on
May 9th, 2012 | syntax:
None | size: 0.67 KB | hits: 18 | expires: Never
basic ruby script not working as expected
def performCommandInDir(command, dir)
old_dir = Dir.pwd
Dir.chdir(dir)
system(command)
Dir.chdir(old_dir)
end
performCommandInDir("git svn rebase", repo[:name])
fatal: /usr/libexec/git-core/git-rebase cannot be used without a working tree.
rebase refs/remotes/git-svn: command returned error: 1
system("git --git-dir=#{repo[:name]}/.git --work-tree=#{repo[:name]} svn rebase")
def performCommandInDir(command, dir)
system(command, :chdir => dir)
end
Dir.chdir(dir) do
# your actions
end
# back in the original directory
def performCommandInDir(command, dir)
system("cd #{dir} && #{command}")
end