Class: QMK::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/git.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo_path) ⇒ Git



3
4
5
# File 'lib/git.rb', line 3

def initialize(repo_path)
  @repo_path = repo_path
end

Instance Method Details

#checkout_latest_tagObject



24
25
26
# File 'lib/git.rb', line 24

def checkout_latest_tag
  `git checkout #{latest_tag}`
end

#cleanObject



32
33
34
35
# File 'lib/git.rb', line 32

def clean
  `git checkout .`
  `git clean -df`
end

#clone(repo) ⇒ Object



15
16
17
18
# File 'lib/git.rb', line 15

def clone(repo)
  ensure_path_exists
  `git clone #{repo} #{@repo_path}`
end

#ensure_path_existsObject



11
12
13
# File 'lib/git.rb', line 11

def ensure_path_exists
  `mkdir -p #{@repo_path}`
end

#fetch_originObject



20
21
22
# File 'lib/git.rb', line 20

def fetch_origin
  `git fetch origin master`
end

#in_repo(&block) ⇒ Object



37
38
39
# File 'lib/git.rb', line 37

def in_repo(&block)
  Dir.chdir @repo_path, &block
end

#latest_tagObject



28
29
30
# File 'lib/git.rb', line 28

def latest_tag
  `git describe --tags $(git rev-list --tags --max-count=1)`
end

#pathObject



7
8
9
# File 'lib/git.rb', line 7

def path
  @repo_path
end