Module: Amiba::Repo

Instance Method Summary collapse

Instance Method Details

#add_and_commit(filename, msg = nil) ⇒ Object



16
17
18
19
# File 'lib/amiba/repo.rb', line 16

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

#init(dir) ⇒ Object



6
7
8
# File 'lib/amiba/repo.rb', line 6

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

#last_commit_date(filename) ⇒ Object



21
22
23
# File 'lib/amiba/repo.rb', line 21

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

#last_commit_dates(*filenames) ⇒ Object



25
26
27
# File 'lib/amiba/repo.rb', line 25

def last_commit_dates(*filenames)
  filenames.map {|fn| last_commit_date(fn)}
end

#pullObject



33
34
35
# File 'lib/amiba/repo.rb', line 33

def pull
  repo.git.pull
end

#push(remote = nil, branch = nil, args = {}) ⇒ Object



29
30
31
# File 'lib/amiba/repo.rb', line 29

def push(remote=nil,branch=nil,args={}) 
  repo.git.push(args,remote,branch)
end

#repoObject



10
11
12
13
14
# File 'lib/amiba/repo.rb', line 10

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