Class: KnapsackPro::RepositoryAdapters::GitAdapter
- Inherits:
-
BaseAdapter
- Object
- BaseAdapter
- KnapsackPro::RepositoryAdapters::GitAdapter
- Defined in:
- lib/knapsack_pro/repository_adapters/git_adapter.rb
Instance Method Summary collapse
- #branch ⇒ Object
- #branches ⇒ Object
- #build_author ⇒ Object
- #commit_authors ⇒ Object
- #commit_hash ⇒ Object
Instance Method Details
#branch ⇒ Object
10 11 12 |
# File 'lib/knapsack_pro/repository_adapters/git_adapter.rb', line 10 def branch `git -C "#{working_dir}" rev-parse --abbrev-ref HEAD`.strip end |
#branches ⇒ Object
14 15 16 17 |
# File 'lib/knapsack_pro/repository_adapters/git_adapter.rb', line 14 def branches str_branches = `git rev-parse --abbrev-ref --branches` str_branches.split("\n") end |
#build_author ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/knapsack_pro/repository_adapters/git_adapter.rb', line 35 def = KnapsackPro::MaskString.call(.strip) raise if .empty? rescue Exception "no git <no.git@example.com>" end |
#commit_authors ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/knapsack_pro/repository_adapters/git_adapter.rb', line 19 def = .split("\n") .map { |line| line.strip } .map { |line| line.split("\t") } .map do |commits, | { commits: commits.to_i, author: KnapsackPro::MaskString.call() } end raise if .empty? rescue Exception [] end |
#commit_hash ⇒ Object
6 7 8 |
# File 'lib/knapsack_pro/repository_adapters/git_adapter.rb', line 6 def commit_hash `git -C "#{working_dir}" rev-parse HEAD`.strip end |