Sha256: cc18908fee58de0f3cc7739769abdc2ef21e9f915062fec07d18b6db80ccff13
Contents?: true
Size: 405 Bytes
Versions: 8
Compression:
Stored size: 405 Bytes
Contents
require 'cap-util' module CapUtil class GitBranch include CapUtil def self.current(action=:run) git_cmd = "git symbolic-ref HEAD" if action == :run say "Fetching #{color "current git branch", :bold, :cyan} from HEAD" (r = run_locally(git_cmd)).success? ? r.stdout.split('/').last.strip : halt elsif action == :cmd git_cmd end end end end
Version data entries
8 entries across 8 versions & 1 rubygems