class Buildr::GitRelease

Public Class Methods

applies_to?() click to toggle source
# File lib/buildr/core/build.rb, line 508
def applies_to?
  if File.exist? '.git/config'
    true
  else
    curr_pwd = Dir.pwd
    Dir.chdir('..') do
      return false if curr_pwd == Dir.pwd # Means going up one level is not possible.
      applies_to?
    end
  end
end

Public Instance Methods

check() click to toggle source

Fails if one of these 2 conditions are not met:

1. the repository is clean: no content staged or unstaged
2. some remote repositories are defined but the current branch does not track any
Calls superclass method
# File lib/buildr/core/build.rb, line 524
def check
  super
  uncommitted = Git.uncommitted_files
  fail "Uncommitted files violate the First Principle Of Release!\n#{uncommitted.join("\n")}" unless uncommitted.empty?
  fail "You are releasing from a local branch that does not track a remote!" unless Git.remote
end
tag_release(tag) click to toggle source

Add a tag reference in .git/refs/tags and push it to the remote if any. If a tag with the same name already exists it will get deleted (in both local and remote repositories).

# File lib/buildr/core/build.rb, line 533
def tag_release(tag)
  unless this_version == extract_version
    info "Committing buildfile with version number #{extract_version}"
    Git.commit File.basename(version_file), message
    Git.push if Git.remote
  end
  info "Tagging release #{tag}"
  Git.git 'tag', '-d', tag rescue nil
  Git.git 'push', Git.remote, ":refs/tags/#{tag}" rescue nil if Git.remote
  Git.git 'tag', '-a', tag, '-m', "[buildr] Cutting release #{tag}"
  Git.git 'push', Git.remote, 'tag', tag if Git.remote
end
update_version_to_next() click to toggle source
Calls superclass method
# File lib/buildr/core/build.rb, line 546
def update_version_to_next
  super
  info "Current version is now #{extract_version}"
  Git.commit File.basename(version_file), message
  Git.push if Git.remote
end