Class: Reviewr::PretendGit
- Inherits:
-
Git
- Object
- Git
- Reviewr::PretendGit
show all
- Defined in:
- lib/reviewr/pretend_git.rb
Instance Attribute Summary collapse
Attributes inherited from Git
#remote_repo
Instance Method Summary
collapse
Methods inherited from Git
#cherry, #current_branch, instance, instance=, #last_commit_body, #last_commit_sha, #last_commit_subject, #log, #origin_location, #origin_master_commit, #user_email
Constructor Details
#initialize(output) ⇒ PretendGit
Returns a new instance of PretendGit.
5
6
7
|
# File 'lib/reviewr/pretend_git.rb', line 5
def initialize(output)
@output = output
end
|
Instance Attribute Details
#output ⇒ Object
Returns the value of attribute output.
3
4
5
|
# File 'lib/reviewr/pretend_git.rb', line 3
def output
@output
end
|
Instance Method Details
#change_branch(branch_name) ⇒ Object
22
23
24
|
# File 'lib/reviewr/pretend_git.rb', line 22
def change_branch(branch_name)
pretend_execute("git checkout #{branch_name}")
end
|
#cherry_pick(commit) ⇒ Object
34
35
36
|
# File 'lib/reviewr/pretend_git.rb', line 34
def cherry_pick(commit)
pretend_execute("git cherry-pick -s #{commit}")
end
|
#commit(msg) ⇒ Object
18
19
20
|
# File 'lib/reviewr/pretend_git.rb', line 18
def commit(msg)
pretend_execute("git commit --allow-empty -m \"#{msg}\"")
end
|
#create_branch(branch_name, base) ⇒ Object
14
15
16
|
# File 'lib/reviewr/pretend_git.rb', line 14
def create_branch(branch_name, base)
pretend_execute("git branch #{branch_name} #{base}")
end
|
#execute(cmd) ⇒ Object
38
39
40
41
|
# File 'lib/reviewr/pretend_git.rb', line 38
def execute(cmd)
output.puts(cmd)
super(cmd)
end
|
#fetch(branch_name) ⇒ Object
26
27
28
|
# File 'lib/reviewr/pretend_git.rb', line 26
def fetch(branch_name)
pretend_execute("git fetch #{remote_repo} #{branch_name}")
end
|
#pretend_execute(cmd) ⇒ Object
43
44
45
|
# File 'lib/reviewr/pretend_git.rb', line 43
def pretend_execute(cmd)
output.puts(cmd)
end
|
#push_branch(branch_name) ⇒ Object
30
31
32
|
# File 'lib/reviewr/pretend_git.rb', line 30
def push_branch(branch_name)
pretend_execute("git push #{remote_repo} #{branch_name}")
end
|
#rebase(base, branch) ⇒ Object
9
10
11
12
|
# File 'lib/reviewr/pretend_git.rb', line 9
def rebase(base, branch)
pretend_execute("git rebase #{base} #{branch}")
true
end
|