Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best ruby api to git?

I would like to implement a Rake task that automates some of the tasks I have to do to move my changes from development to production (and yes, I know there is something out like Capistrano, and it is way too much for me). In the center, there are some interactive commands like git add -i and a series of commit and push. On the production side, there will be pulls and assets tasks to do.

It is tedious to type in all the time the same commands so I would like to automate it completely. What I have not found is the Ruby API for Git.

It should work under Windows 7, and allow at least the following commands: git add, git status, git commit, git push, git pull.

like image 733
mliebelt Avatar asked Mar 03 '12 09:03

mliebelt


1 Answers

I know, bad habit, but I would like to document the experiences of this weekend:

  • There is a similar question on https://softwareengineering.stackexchange.com/questions/62843/best-ruby-git-library that names the 3 relevant candidates: Git, Grit and Rugged.
  • Git and Grit are not developed further, Rugged is currently developed, but not finished.
  • Git works out of the box, but has some deficiencies:
    • There are known shortcomings (see the issues).
    • I had the problem, that added and changed items are not well matched, they can be in only one of the 2 states (which is not true for Git currently).
    • The API is reasonable, and works well in console, Ruby script or Rake task.
  • Grit did not work for me at all, and I did not found the reason. I got stack traces (low level ones), and tried a few patches that could be relevant for usage under Windows 7, but with no success.
  • Rugged is not installable for me, so I filed a bug to rugged which got some feedback. The problem seems to be that rugged only works for POSIX systems, so it is not compilable with DevKit for Ruby.

So I will try to find a compiled version of libgit2.dll for Windows 7, and will try to use that. I have done that in the past with sqlite3.dll, so perhaps that is the best try. For me, rugged is the most sensible solution, because there are people behind that project, they are interested to provide a solution that works cross platform.

like image 141
mliebelt Avatar answered Nov 15 '22 07:11

mliebelt