git_dump
Distributed versioned store using git.
Installation
gem install git_dump
Usage
Init:
dump = GitDump.new('dump.git', :create => true)
Create version:
version = dump.new_version
version['a/b/c'] = 'string'
version.store('b/c/d', StringIO.new('string'), 0o644)
version.store('d/e', File.open('path'), 0o755)
version.store_from('e/f', 'path')
version.commit(:tags => 'test')
Read version:
version = dump.versions.last
version['a/b/c'].open{ |f| f.read }
version['a/b/c'].read
version['a/b/c'].write_to('new_path')
version.each do |path_object|
path_object.path
end
version.each_recursive do |entry|
entry.read
end
Versions:
dump.versions.each do |version|
puts [version.id, version.time, version.commit_time].join(' ')
end
dump.versions.first.remove
Remote (url in any syntax supported by git including local paths):
ids = GitDump.remote_version_ids(url)
dump.versions.last.push(url)
dump.fetch(url, ids.first)
Copyright
Copyright (c) 2012-2019 Ivan Kuchin. See LICENSE.txt for details.