class Versi::Interfaces::GitInterface

Constants

DEFAULT_REMOTE
GIT_FETCH_TAGS_COMMAND
GIT_LAST_COMMIT_MSG_COMMAND
GIT_TAG_LIST_COMMAND

Public Class Methods

new(remote: DEFAULT_REMOTE) click to toggle source
# File lib/versi/interfaces/git_interface.rb, line 11
def initialize(remote: DEFAULT_REMOTE)
  remote ||= DEFAULT_REMOTE
  @remote = remote
end

Public Instance Methods

create_branch(branch_name) click to toggle source
# File lib/versi/interfaces/git_interface.rb, line 50
def create_branch(branch_name)
  Versi::LOG.info("Creating branch #{branch_name}.. ")
  System.call!("git checkout -b #{branch_name}")
end
create_tag(tag, message=nil) click to toggle source
# File lib/versi/interfaces/git_interface.rb, line 16
def create_tag(tag, message=nil)
  Versi::LOG.info("Generating git tag \"#{tag}\".. ")
  System.call!("git tag -a \"#{tag}\" -m \"#{message}\"")
end
delete_tag(tag) click to toggle source
# File lib/versi/interfaces/git_interface.rb, line 21
def delete_tag(tag)
  Versi::LOG.info("Deleting git tag \"#{tag}\".. ")
  System.call!("git tag -d \"#{tag}\"")
end
delete_tag_remote(tag) click to toggle source
# File lib/versi/interfaces/git_interface.rb, line 26
def delete_tag_remote(tag)
  Versi::LOG.info("Deleting git tag \"#{tag}\" on remote (#{@remote}).. ")
  System.call!("git push #{@remote} --delete \"#{tag}\"")
end
fetch_tags() click to toggle source
# File lib/versi/interfaces/git_interface.rb, line 36
def fetch_tags
  Versi::LOG.info("Updating local git tags.. ")
  System.call!(GIT_FETCH_TAGS_COMMAND)
end
last_commit_message() click to toggle source
# File lib/versi/interfaces/git_interface.rb, line 46
def last_commit_message
  System.call!(GIT_LAST_COMMIT_MSG_COMMAND).stdout.join("\n")
end
list_tags() click to toggle source
# File lib/versi/interfaces/git_interface.rb, line 41
def list_tags
  response = System.call!(GIT_TAG_LIST_COMMAND)
  response.stdout
end
push_tag(tag) click to toggle source
# File lib/versi/interfaces/git_interface.rb, line 31
def push_tag(tag)
  Versi::LOG.info("Pushing \"#{tag}\" git tag.. ")
  System.call!("git push #{@remote} #{tag}")
end