Sha256: fc58f3fa545ecf00c1947e66042f18f82a0a0fc440a629d7b7b732f7ab424510
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require 'rugged' module Incr module Service class Git def initialize(path) @repository = Rugged::Repository.new(path) @index = @repository.index @author = @repository.head.target.author end def add(filename) @index.add(filename) @index.write end def commit(message) options = {} options[:tree] = @index.write_tree(@repository) author = @author.clone author[:time] = Time.now options[:author] = author options[:committer] = author options[:message] ||= message options[:parents] = @repository.empty? ? [] : [ @repository.head.target ].compact options[:update_ref] = 'HEAD' Rugged::Commit.create(@repository, options) end def tag(name, target) author = @author.clone author[:time] = Time.now # annotation = { # tagger: author, # message: 'a message?' # } # @repository.tags.create(name, target, annotation) @repository.tags.create(name, target) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
incr-0.2.0 | lib/incr/service/git.rb |
incr-0.1.2 | lib/incr/service/git.rb |