Class: EasyAuto::Git
Class Method Summary
collapse
check_install, cli_send, os
Class Method Details
.abbrev_ref ⇒ Object
15
16
17
|
# File 'lib/easy_auto/git.rb', line 15
def self.abbrev_ref
"rev-parse --abbrev-ref"
end
|
.checkout_master ⇒ Object
45
46
47
|
# File 'lib/easy_auto/git.rb', line 45
def self.checkout_master
perform "checkout master"
end
|
.create_and_switch_to(branch_name, tracking_branch = nil) ⇒ Object
53
54
55
|
# File 'lib/easy_auto/git.rb', line 53
def self.create_and_switch_to branch_name, tracking_branch = nil
perform "checkout -b #{branch_name} #{tracking_branch}"
end
|
.current_branch_name ⇒ Object
19
20
21
|
# File 'lib/easy_auto/git.rb', line 19
def self.current_branch_name
perform "#{abbrev_ref} HEAD"
end
|
.delete_local_and_remote_branch(branch_name) ⇒ Object
32
33
34
35
|
# File 'lib/easy_auto/git.rb', line 32
def self.delete_local_and_remote_branch branch_name
delete_local_branch branch_name
delete_remote_branch branch_name
end
|
.delete_local_branch(branch_name) ⇒ Object
27
28
29
30
|
# File 'lib/easy_auto/git.rb', line 27
def self.delete_local_branch branch_name
checkout_master
perform "branch -D #{branch_name}"
end
|
.delete_remote_branch(branch_name) ⇒ Object
37
38
39
|
# File 'lib/easy_auto/git.rb', line 37
def self.delete_remote_branch branch_name
perform "push origin :#{branch_name}"
end
|
.init ⇒ Object
11
12
13
|
# File 'lib/easy_auto/git.rb', line 11
def self.init
perform "init"
end
|
7
8
9
|
# File 'lib/easy_auto/git.rb', line 7
def self.perform command
cli_send "git #{command}"
end
|
.pull ⇒ Object
49
50
51
|
# File 'lib/easy_auto/git.rb', line 49
def self.pull
perform "pull"
end
|
.remote ⇒ Object
41
42
43
|
# File 'lib/easy_auto/git.rb', line 41
def self.remote
perform "remote"
end
|
.remote_branch ⇒ Object
23
24
25
|
# File 'lib/easy_auto/git.rb', line 23
def self.remote_branch
perform "#{abbrev_ref} --symbolic-full-name @{u}"
end
|