Sha256: 52d78e285e570e40fb12866a3a2b23ed3e05caf99c8f8944d73ec10188544321

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

module Dk; end
module Dk::ABDeploy; end
module Dk::ABDeploy::Utils

  module CurrentGitBranch

    def self.new(&block)
      git_cmd_str = "git symbolic-ref HEAD"

      # returns the cmd str if no block given
      return git_cmd_str if block.nil?

      # to get the value pass a block that runs the yielded cmd_str cmd, ex:
      # current_branch_name = CurrentGitBranch.new do |cmd_str|
      #   log_info "Fetching current git branch from HEAD"
      #   cmd! cmd_str
      # end
      cmd = block.call(git_cmd_str)
      cmd.stdout.split('/').last.strip
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dk-abdeploy-0.1.0 lib/dk-abdeploy/utils/current_git_branch.rb