Class: GitProc::Process
- Inherits:
-
Object
show all
- Defined in:
- lib/git-process/git_process.rb
Instance Method Summary
collapse
Constructor Details
#initialize(gitlib, opts = {}) ⇒ Process
Returns a new instance of Process.
24
25
26
|
# File 'lib/git-process/git_process.rb', line 24
def initialize(gitlib, opts = {})
@gitlib = gitlib
end
|
Instance Method Details
#cleanup ⇒ Object
82
83
84
|
# File 'lib/git-process/git_process.rb', line 82
def cleanup
end
|
#config ⇒ Object
63
64
65
|
# File 'lib/git-process/git_process.rb', line 63
def config
gitlib.config
end
|
#fetch_remote_changes(remote_name = nil) ⇒ Object
87
88
89
90
91
92
93
|
# File 'lib/git-process/git_process.rb', line 87
def fetch_remote_changes(remote_name = nil)
if remote.exists?
gitlib.fetch(remote_name || remote.name)
else
logger.debug 'Can not fetch latest changes because there is no remote defined'
end
end
|
#gitlib ⇒ Object
29
30
31
|
# File 'lib/git-process/git_process.rb', line 29
def gitlib
@gitlib
end
|
#is_parked? ⇒ Boolean
96
97
98
99
|
# File 'lib/git-process/git_process.rb', line 96
def is_parked?
mybranches = gitlib.branches
mybranches.parking == mybranches.current
end
|
#logger ⇒ Object
58
59
60
|
# File 'lib/git-process/git_process.rb', line 58
def logger
gitlib.logger
end
|
#remote ⇒ Object
68
69
70
|
# File 'lib/git-process/git_process.rb', line 68
def remote
gitlib.remote
end
|
#run ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/git-process/git_process.rb', line 34
def run
begin
verify_preconditions
runner
rescue GitProc::GitProcessError => exp
puts exp.message
exit(-1)
ensure
cleanup
end
end
|
#runner ⇒ Object
48
49
50
|
# File 'lib/git-process/git_process.rb', line 48
def runner
end
|
#verify_preconditions ⇒ Object
73
74
75
76
77
78
79
|
# File 'lib/git-process/git_process.rb', line 73
def verify_preconditions
if should_remove_master?
if ask_about_removing_master
delete_master_branch!
end
end
end
|
#workdir ⇒ Object
53
54
55
|
# File 'lib/git-process/git_process.rb', line 53
def workdir
gitlib.workdir
end
|