Sha256: 2f156fa2007a5851c3072cffbfde0df37621e88564f8e7db8881b74262bef573
Contents?: true
Size: 810 Bytes
Versions: 7
Compression:
Stored size: 810 Bytes
Contents
# -*- coding: utf-8 -*- module GitObjectBrowser module Dumper class IndexDumper def initialize(root, outdir) @root = root @outdir = outdir end def dump index_file = File.join(@root, "index") out_file = File.join(@outdir, "index.json") return unless File.exist?(index_file) puts "Write: index\n" File.open(index_file) do |input| File.open(out_file, "w") do |output| dump_object(input, output) end end end def dump_object(input, output) obj = GitObjectBrowser::Models::Index.new(input).parse wrapped = GitObjectBrowser::Models::WrappedObject.new(nil, 'index', obj) output << JSON.pretty_generate(wrapped.to_hash) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems