Class: EasyAuto::Git

Inherits:
Object
  • Object
show all
Extended by:
SystemHelper
Defined in:
lib/easy_auto/git.rb

Class Method Summary collapse

Methods included from SystemHelper

check_install, cli_send, os

Class Method Details

.abbrev_refObject



15
16
17
# File 'lib/easy_auto/git.rb', line 15

def self.abbrev_ref
  "rev-parse --abbrev-ref"
end

.checkout_masterObject



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_nameObject



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

.initObject



11
12
13
# File 'lib/easy_auto/git.rb', line 11

def self.init
  perform "init"
end

.perform(command) ⇒ Object



7
8
9
# File 'lib/easy_auto/git.rb', line 7

def self.perform command
  cli_send "git #{command}"
end

.pullObject



49
50
51
# File 'lib/easy_auto/git.rb', line 49

def self.pull
  perform "pull"
end

.remoteObject



41
42
43
# File 'lib/easy_auto/git.rb', line 41

def self.remote
  perform "remote"
end

.remote_branchObject



23
24
25
# File 'lib/easy_auto/git.rb', line 23

def self.remote_branch
  perform "#{abbrev_ref} --symbolic-full-name @{u}"
end