Module: Versionator::Git

Included in:
Version
Defined in:
lib/versionator/git.rb

Instance Method Summary collapse

Instance Method Details

#git_checkout(branch = 'master') ⇒ Object



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

def git_checkout(branch = 'master')
  git_command("git checkout #{branch}")
end

#git_command(str) ⇒ Object



28
29
30
# File 'lib/versionator/git.rb', line 28

def git_command(str)
  systemu(str).drop(1).join(" ")
end

#git_commit(message = nil) ⇒ Object



19
20
21
22
# File 'lib/versionator/git.rb', line 19

def git_commit(message = nil)
  message = "tag new release v#{version_name}" if message.blank?
  git_command("git commit -a -m '#{message}'")
end

#git_current_branchObject



3
4
5
# File 'lib/versionator/git.rb', line 3

def git_current_branch
  git_command("git branch").split(/\n/).grep(/\*/).first.gsub('* ', '')
end

#git_pull(branch = 'master') ⇒ Object



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

def git_pull(branch = 'master')
  git_command("git pull origin #{branch}")
end

#git_push(branch = 'master') ⇒ Object



24
25
26
# File 'lib/versionator/git.rb', line 24

def git_push(branch = 'master')
  git_command("git push origin #{branch} --tags")
end

#git_tagObject



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

def git_tag
  git_command("git tag v#{version_name}")
end