Module: Twingly::Git

Defined in:
lib/capistrano/twingly/current_git_branch.rb

Class Method Summary collapse

Class Method Details

.current_branchObject



16
17
18
# File 'lib/capistrano/twingly/current_git_branch.rb', line 16

def current_branch
  `git symbolic-ref HEAD 2> /dev/null`.strip.gsub(/^refs\/heads\//, '')
end

.infoObject



12
13
14
# File 'lib/capistrano/twingly/current_git_branch.rb', line 12

def info
  "branch #{red(fetch(:branch))} to stage #{red(fetch(:stage))}"
end

.red(str) ⇒ Object

Colors are pretty!



8
9
10
# File 'lib/capistrano/twingly/current_git_branch.rb', line 8

def red(str)
  "\e[31m#{str}\e[0m"
end