Class: Borg::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/borg/borg_git.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/borg/borg_git.rb', line 6

def status
  @status
end

Instance Method Details

#current_branchObject



7
8
9
10
11
# File 'lib/borg/borg_git.rb', line 7

def current_branch
  cmd_output = `git symbolic-ref HEAD`
  branch_name = cmd_output.strip.split("/")[-1]
  branch_name
end

#updateObject



13
14
15
16
17
# File 'lib/borg/borg_git.rb', line 13

def update
  FileUtils.cd(Rails.root) do
    @status = system("git reset --hard HEAD && git fetch && git rebase origin/#{current_branch} && git submodule init && git submodule update")
  end
end