Class: GitHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-allowlist/helpers/git.rb

Overview

For execute git commands

Class Method Summary collapse

Class Method Details

.clone_from_branch(url, destination, branch) ⇒ Object

Download from a specific branch



6
7
8
9
# File 'lib/cocoapods-allowlist/helpers/git.rb', line 6

def self.clone_from_branch(url, destination, branch)
    _stdout, stderr, status = Allowlist::Command.execute("git clone --quiet --depth 1 -b #{branch} --single-branch #{url} #{destination}")
    raise "git clone failed (exit #{status.exitstatus}): #{stderr.strip}" unless status.success?
end

.get_latest_commit(directory) ⇒ Object

Get the latest commit hash



12
13
14
15
16
# File 'lib/cocoapods-allowlist/helpers/git.rb', line 12

def self.get_latest_commit(directory)
    Dir.chdir(directory) do
        Allowlist::Command.execute("git rev-parse HEAD").strip
    end
end