Week one :grit

We tried to read and understand parts of grit
RDoc can be found here: grit.rubyforge.org

As it seems, its doesn’t encompass all of git’s functionality, but is infact just a wrapper over git
What it essentially does is, give us a OO wrapper over all Git’s objects,and access to change or retrieve data from them, which
is what was desired in the first place

So to move forward, we came up with two ways
1. Create a solution on top of grit { Useful and easy for now, also makes sense to not disturb what grit does}
2. Create an integrated solution as part of grit {would be useful later}

We are going ahead with [1]

Examples for creating a commit
=====================
require ‘../lib/grit’

count = 1
Dir.chdir(“/home/sward/project/testrepo”) do
r = Grit::Repo.new(‘.’)
while(count < 1) do
fname = Time.now.to_i.to_s + count.to_s
File.open(fname, 'w') { |f| f.write('hellor ' + fname) }
r.add(fname)
count += 1
end

r.commit_index('my commit')

end

======
To read data and other info we would just need the handle to Repo object, which encompasses
all of git's other objects which are essentially these

=====

From rubyforge you can find important objects we are interested, some being Commit, Merge, Repo, Git, etc

But for us to torrent we are interested in Blob object which contains dumps of data from file and doesnt always match
the data to a unique file, meaning if there were to be two files with same data,only a single blob would be created as the
hash of both would be same.

blob gives us data that we could piece and then torrent, as with the state of the git database, we are yet to confirm how to approach that as well.

[1] Send out a pretty good hash containing all of gits object we may read from grit
[2] Send the .git repo's files we are interested in wrapped together.

[2] one being more easy but [1] being logical for us to do now.

Along the same time, I happened to look over at ruby-torrent

Previously we were under the impression that this would host a tracker solution as well. It appears its just a client in ruby. Similarly librubytorrent also doesnt help in case of a tracker.

There were other project attempting this, which were but Rails and sinatra
[1] https://github.com/shurikk/bttrack
[2] http://code.google.com/p/hydraproject/

This one was of particular interest
https://github.com/shaggyone/ruby-tracker

So we will be going ahead with the last solution and start studying is this week.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s