Project

rrdiff

0.02
No commit activity in last 3 years
No release in over 3 years
Ruby bindings to librsync which provides rdiff.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
 Project Readme

rrdiff - Ruby bindings to librsync/rdiff.

Lets say you have two files oldfile and newfile where newfile is a modified version of oldfile. We want to be able to apply the change to oldfile such that it becomes newfile.

The first process is to create a signature for the oldfile. The parameters are the original file and where you want to store the signature file.

RRDiff.signature("oldfile", "sigfile")

Then from the newfile and the sigfile generate a delta. Deltafile is where the delta is stored.

RRDiff.delta("newfile", "sigfile", "deltafile")

Finally, apply the deltafile to the oldfile to create the patchedfile which should be equivalent to newfile.

RRDiff.patch("oldfile", "deltafile", "patchedfile")

There is also a File interface, that you can pass File instances. It will return Tempfiles.

RRDiff::File.signature(oldfile) #=> <File>

RRDiff::File.delta(sigfile, newfile) #=> <File>

RRDiff::File.diff(oldfile, newfile) #=> <File>

RRDiff::File.patch(oldfile, deltafile) #=> <File>