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

Version Path
cap-util-1.4.0 lib/cap-util/git_branch.rb
cap-util-1.3.0 lib/cap-util/git_branch.rb
cap-util-1.2.0 lib/cap-util/git_branch.rb
cap-util-1.1.0 lib/cap-util/git_branch.rb
cap-util-1.0.1 lib/cap-util/git_branch.rb
cap-util-1.0.0 lib/cap-util/git_branch.rb
cap-util-1.0.0.rc1 lib/cap-util/git_branch.rb
cap-util-0.4.0 lib/cap-util/git_branch.rb