Sha256: 6679c2c154b0ff3e65e8a0c3cf586563fdc82960cf01082bcd35877ed411957d

Contents?: true

Size: 681 Bytes

Versions: 3

Compression:

Stored size: 681 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

    def pull
      repo.git.pull
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
amiba-1.0.2 lib/amiba/repo.rb
amiba-1.0.1 lib/amiba/repo.rb
amiba-1.0.0 lib/amiba/repo.rb