class Buildr::HgRelease

Public Class Methods

applies_to?() click to toggle source
# File lib/buildr/core/build.rb, line 460
def applies_to?
  if File.exist? '.hg/requires'
    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 reository is not 'clean'; no content staged or unstaged
2. The repository is only a local repository and has no remote refs
Calls superclass method
# File lib/buildr/core/build.rb, line 476
def check
  super
  info "Working in branch '#{Hg.current_branch}'"
  uncommitted = Hg.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!" if Hg.remote.empty?
end
tag_release(tag) click to toggle source

Tag this release in Mercurial

# File lib/buildr/core/build.rb, line 485
def tag_release(tag)
  unless this_version == extract_version
    info "Committing buildfile with version number #{extract_version}"
    Hg.commit File.basename(version_file), message
    Hg.push if Hg.remote
  end
  info "Tagging release #{tag}"
  Hg.hg 'tag', tag, '-m', "[buildr] Cutting release #{tag}"
  Hg.push if Hg.remote
end
update_version_to_next() click to toggle source

Update buildfile with next version number

Calls superclass method
# File lib/buildr/core/build.rb, line 497
def update_version_to_next
  super
  info "Current version is now #{extract_version}"
  Hg.commit File.basename(version_file), message
  Hg.push if Hg.remote
end