Class: GitProc::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/git-process/git_process.rb

Direct Known Subclasses

NewFeatureBranch, PullRequest, RebaseToMaster, Sync

Instance Method Summary collapse

Constructor Details

#initialize(gitlib, opts = {}) ⇒ Process

Returns a new instance of Process.

Parameters:



24
25
26
# File 'lib/git-process/git_process.rb', line 24

def initialize(gitlib, opts = {})
  @gitlib = gitlib
end

Instance Method Details

#cleanupObject



87
88
89
# File 'lib/git-process/git_process.rb', line 87

def cleanup
  # extension point
end

#configObject



63
64
65
# File 'lib/git-process/git_process.rb', line 63

def config
  gitlib.config
end

#fetch_remote_changes(remote_name = nil) ⇒ Object



92
93
94
# File 'lib/git-process/git_process.rb', line 92

def fetch_remote_changes(remote_name = nil)
  gitlib.fetch_remote_changes(remote_name)
end

#gitlibObject



29
30
31
# File 'lib/git-process/git_process.rb', line 29

def gitlib
  @gitlib
end

#is_parked?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/git-process/git_process.rb', line 97

def is_parked?
  gitlib.is_parked?
end

#loggerObject



58
59
60
# File 'lib/git-process/git_process.rb', line 58

def logger
  gitlib.logger
end

#master_branchObject



68
69
70
# File 'lib/git-process/git_process.rb', line 68

def master_branch
  gitlib.config.master_branch
end

#remoteObject



73
74
75
# File 'lib/git-process/git_process.rb', line 73

def remote
  gitlib.remote
end

#runObject



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

#runnerObject



48
49
50
# File 'lib/git-process/git_process.rb', line 48

def runner
  # extension point - does nothing by default
end

#verify_preconditionsObject



78
79
80
81
82
83
84
# File 'lib/git-process/git_process.rb', line 78

def verify_preconditions
  if should_remove_master?
    if ask_about_removing_master
      delete_master_branch!
    end
  end
end

#workdirObject



53
54
55
# File 'lib/git-process/git_process.rb', line 53

def workdir
  gitlib.workdir
end