Sha256: b73a3f5ebbdcf19572bcd02be904ac11360779d0782d27749c9882536b5961a2

Contents?: true

Size: 639 Bytes

Versions: 2

Compression:

Stored size: 639 Bytes

Contents

require 'grit'

module Amiba
  module Repo

    def init(dir)
      Grit::Repo.init(dir)
    end

    def repo
      Grit::Repo.new(Dir.pwd)
    rescue
      raise "No repo exists at #{Dir.pwd}"
    end

    def add_and_commit(filename, msg=nil)
      repo.add(filename)
      repo.commit_index(msg || "Added a new entry at #{filename}")
    end

    def last_commit_date(filename)
      repo.log(filename).first.committed_date
    end

    def last_commit_dates(*filenames)
      filenames.map {|fn| last_commit_date(fn)}
    end
    
    def push(remote=nil,branch=nil,args={}) 
      repo.git.push(args,remote,branch)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
amiba-0.0.9 lib/amiba/repo.rb
amiba-0.0.8 lib/amiba/repo.rb