Class: GitHelper
- Inherits:
-
Object
show all
- Defined in:
- lib/git_chain/git_helper.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(path, git) ⇒ GitHelper
Returns a new instance of GitHelper.
5
6
7
8
|
# File 'lib/git_chain/git_helper.rb', line 5
def initialize(path, git)
@path = path
@git = git
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
10
11
12
|
# File 'lib/git_chain/git_helper.rb', line 10
def method_missing(method, *args)
git.send(method, *args)
end
|
Instance Attribute Details
#git ⇒ Object
Returns the value of attribute git.
4
5
6
|
# File 'lib/git_chain/git_helper.rb', line 4
def git
@git
end
|
#path ⇒ Object
Returns the value of attribute path.
4
5
6
|
# File 'lib/git_chain/git_helper.rb', line 4
def path
@path
end
|
Instance Method Details
#clean? ⇒ Boolean
26
27
28
29
30
31
32
33
34
|
# File 'lib/git_chain/git_helper.rb', line 26
def clean?
git_command("status -s").empty?
end
|
#current_branch ⇒ Object
14
15
16
|
# File 'lib/git_chain/git_helper.rb', line 14
def current_branch
git_command "rev-parse --abbrev-ref HEAD"
end
|
#merge_base(branch_1, branch_2) ⇒ Object
18
19
20
|
# File 'lib/git_chain/git_helper.rb', line 18
def merge_base(branch_1, branch_2)
git_command "merge-base #{branch_1} #{branch_2}"
end
|
#rebase_onto(new_base:, old_base:, branch:) ⇒ Object
22
23
24
|
# File 'lib/git_chain/git_helper.rb', line 22
def rebase_onto(new_base:, old_base:, branch:)
git_command "rebase --onto #{new_base} #{old_base} #{branch}"
end
|