Class: GitUtils

Inherits:
Object show all
Defined in:
lib/cocoapods-podspec-binary/utils/git_utils.rb

Overview

git utils

Instance Method Summary collapse

Constructor Details

#initialize(repository_path) ⇒ GitUtils

git utils



8
9
10
# File 'lib/cocoapods-podspec-binary/utils/git_utils.rb', line 8

def initialize(repository_path)
  @repository = open_git_repository(repository_path)
end

Instance Method Details

#clone(remote_url, destination_path) ⇒ Object



16
17
18
# File 'lib/cocoapods-podspec-binary/utils/git_utils.rb', line 16

def clone(remote_url, destination_path)
  Git.clone(remote_url, destination_path)
end

#commit(message) ⇒ Object



24
25
26
27
# File 'lib/cocoapods-podspec-binary/utils/git_utils.rb', line 24

def commit(message)
  @repository.add(all: true)
  @repository.commit(message)
end

#open_git_repository(repository_path) ⇒ Object



12
13
14
# File 'lib/cocoapods-podspec-binary/utils/git_utils.rb', line 12

def open_git_repository(repository_path)
  Git.open(repository_path)
end

#pullObject



20
21
22
# File 'lib/cocoapods-podspec-binary/utils/git_utils.rb', line 20

def pull
  @repository.pull
end

#push(remote_name = 'origin', branch_name = 'master') ⇒ Object



29
30
31
# File 'lib/cocoapods-podspec-binary/utils/git_utils.rb', line 29

def push(remote_name = 'origin', branch_name = 'master')
  @repository.push(remote_name, branch_name)
end

#statusObject



33
34
35
# File 'lib/cocoapods-podspec-binary/utils/git_utils.rb', line 33

def status
  @repository.status
end