Sha256: d4b632b506a7f299030d9d9156c8eb100d42ab0a0f29ebdb8b8b80ca8ac0165f
Contents?: true
Size: 743 Bytes
Versions: 32
Compression:
Stored size: 743 Bytes
Contents
# frozen_string_literal: true module CiToolkit # Utility class to provide information about git related data class Git def initialize(dir = nil, env = CiToolkit::BitriseEnv.new) @branch = env.git_branch @dir = dir end def latest_tag describe = "git describe --abbrev=0" return `#{describe}`.gsub("\n", "") unless @dir `cd #{@dir} && #{describe}`.gsub("\n", "") end def branch return @branch unless @branch.nil? git_branch_cmd = "git branch --show-current" return `cd #{@dir} && #{git_branch_cmd}`.gsub(/\s+/, "") unless @dir.nil? `#{git_branch_cmd}`.gsub(/\s+/, "") end def infrastructure_branch? !(branch =~ %r{infra/}).nil? end end end
Version data entries
32 entries across 32 versions & 1 rubygems