Class: QMK::Git
- Inherits:
-
Object
- Object
- QMK::Git
- Defined in:
- lib/git.rb
Instance Method Summary collapse
- #checkout_latest_tag ⇒ Object
- #clean ⇒ Object
- #clone(repo) ⇒ Object
- #ensure_path_exists ⇒ Object
- #fetch_origin ⇒ Object
- #in_repo(&block) ⇒ Object
-
#initialize(repo_path) ⇒ Git
constructor
A new instance of Git.
- #latest_tag ⇒ Object
- #path ⇒ Object
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_tag ⇒ Object
24 25 26 |
# File 'lib/git.rb', line 24 def checkout_latest_tag `git checkout #{latest_tag}` end |
#clean ⇒ Object
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_exists ⇒ Object
11 12 13 |
# File 'lib/git.rb', line 11 def ensure_path_exists `mkdir -p #{@repo_path}` end |
#fetch_origin ⇒ Object
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_tag ⇒ Object
28 29 30 |
# File 'lib/git.rb', line 28 def latest_tag `git describe --tags $(git rev-list --tags --max-count=1)` end |
#path ⇒ Object
7 8 9 |
# File 'lib/git.rb', line 7 def path @repo_path end |