Class: YMDP::GitHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/ymdp/compiler/git_helper.rb

Instance Method Summary collapse

Instance Method Details

#do_commit(message) ⇒ Object



20
21
22
23
24
# File 'lib/ymdp/compiler/git_helper.rb', line 20

def do_commit(message)
  repo = Repo.new(".")
  repo.add(".")
  $stdout.puts F.execute("git commit -am \"#{message}\"", :return => true)
end

#get_current_branchObject



13
14
15
16
17
18
# File 'lib/ymdp/compiler/git_helper.rb', line 13

def get_current_branch
  result = F.execute("git status", :return => true)
  if result =~ /# On branch (.*)/
    return $1
  end
end

#get_hash(branch) ⇒ Object



7
8
9
10
11
# File 'lib/ymdp/compiler/git_helper.rb', line 7

def get_hash(branch)
  branch = get_current_branch || "master"
  repo = Repo.new("#{BASE_PATH}/.")
  repo.commits(branch).first.id
end