Guest User

Untitled

a guest
May 9th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. basic ruby script not working as expected
  2. def performCommandInDir(command, dir)
  3. old_dir = Dir.pwd
  4. Dir.chdir(dir)
  5. system(command)
  6. Dir.chdir(old_dir)
  7. end
  8.  
  9. performCommandInDir("git svn rebase", repo[:name])
  10.  
  11. fatal: /usr/libexec/git-core/git-rebase cannot be used without a working tree.
  12. rebase refs/remotes/git-svn: command returned error: 1
  13.  
  14. system("git --git-dir=#{repo[:name]}/.git --work-tree=#{repo[:name]} svn rebase")
  15.  
  16. def performCommandInDir(command, dir)
  17. system(command, :chdir => dir)
  18. end
  19.  
  20. Dir.chdir(dir) do
  21. # your actions
  22. end
  23. # back in the original directory
  24.  
  25. def performCommandInDir(command, dir)
  26. system("cd #{dir} && #{command}")
  27. end
Advertisement
Add Comment
Please, Sign In to add comment