class ProcfileSplit::Git

Public Class Methods

add_and_commit(filename, message) click to toggle source
# File lib/procfile_split/git.rb, line 24
def self.add_and_commit(filename, message)
  system "git add '#{filename}'; git commit -m '#{message}'"
  if $? != 0
    raise "abort: git commit failed"
  end
end
checkout(branch) click to toggle source
# File lib/procfile_split/git.rb, line 17
def self.checkout(branch)
  system "git checkout -b \"#{branch}\""
  if $? != 0
    raise "abort: git checkout failed"
  end
end
checkout_master() click to toggle source
# File lib/procfile_split/git.rb, line 31
def self.checkout_master
  system "git checkout master"
end
list_branch() click to toggle source
# File lib/procfile_split/git.rb, line 5
def self.list_branch
  Open3.popen3("git branch") do |stdin, stdout, stderr, wait_thr|
    exit_status = wait_thr.value

    if exit_status == 0
      stdout.read.split("\n").collect(){|branch| branch.gsub(/\\*\W/, "") }
    else
      raise stderr.read
    end
  end
end