Module: GitPivot::Git

Extended by:
Shared
Defined in:
lib/git-pivot/git.rb

Class Method Summary collapse

Methods included from Shared

input, out

Class Method Details

.branchObject



39
40
41
# File 'lib/git-pivot/git.rb', line 39

def branch
  @branch ||= repo.head.name
end

.config(param = nil) ⇒ Object



30
31
32
33
# File 'lib/git-pivot/git.rb', line 30

def config(param=nil)
  return repo.config unless param
  repo.config[param]
end

.deliverObject



26
27
28
# File 'lib/git-pivot/git.rb', line 26

def deliver
  `git push`
end

.finish(commit) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/git-pivot/git.rb', line 14

def finish(commit)
  if has_changes? && commit
    out "Please enter your commit message: ", false
    close_commit input
  elsif has_changes?
    exit out "Please commit changes before closing ticket."
  end

  merge_branch
  out "Merged changes back to master."
end

.infoObject



48
49
50
51
52
53
# File 'lib/git-pivot/git.rb', line 48

def info
"""
-- Git Info --
Branch name: #{branch}
"""
end

.last_story(id = nil) ⇒ Object



43
44
45
46
# File 'lib/git-pivot/git.rb', line 43

def last_story(id=nil)
  return config['pivotal.last-story'] unless id
  config['pivotal.last-story'] = id
end

.repoObject



35
36
37
# File 'lib/git-pivot/git.rb', line 35

def repo
  @repo ||= Grit::Repo.new(`pwd`.strip)
end

.start(id, type) ⇒ Object



8
9
10
11
12
# File 'lib/git-pivot/git.rb', line 8

def start(id, type)
  branch_name = create_branch(id, type)
  last_story(id)
  "Switched to branch #{branch_name}..."
end