Class: BetweenMeals::Repo::Git::Cmd

Inherits:
Cmd
  • Object
show all
Defined in:
lib/between_meals/repo/git/cmd.rb

Instance Attribute Summary

Attributes inherited from Cmd

#bin

Instance Method Summary collapse

Methods inherited from Cmd

#cmd, #initialize

Constructor Details

This class inherits a constructor from BetweenMeals::Cmd

Instance Method Details

#clone(url, repo_path) ⇒ Object



31
32
33
# File 'lib/between_meals/repo/git/cmd.rb', line 31

def clone(url, repo_path)
  cmd("clone #{url} #{repo_path}", '/tmp')
end

#config(key) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/between_meals/repo/git/cmd.rb', line 23

def config(key)
  s = cmd("config #{key}", nil, true)
  unless [0, 1].include?(s.exitstatus)
    s.error!
  end
  s
end

#diff(start_ref, end_ref) ⇒ Object



35
36
37
# File 'lib/between_meals/repo/git/cmd.rb', line 35

def diff(start_ref, end_ref)
  cmd("diff --name-status #{start_ref} #{end_ref}")
end

#merge_base(rev, master) ⇒ Object



43
44
45
# File 'lib/between_meals/repo/git/cmd.rb', line 43

def merge_base(rev, master)
  cmd("merge-base #{rev} #{master}")
end

#pullObject



39
40
41
# File 'lib/between_meals/repo/git/cmd.rb', line 39

def pull
  cmd('pull --rebase')
end

#statusObject



47
48
49
# File 'lib/between_meals/repo/git/cmd.rb', line 47

def status
  cmd('status --porcelain 2>&1')
end