Class: Buildr::HgRelease

Inherits:
Release show all
Defined in:
lib/buildr/core/build.rb

Constant Summary

Constants inherited from Release

Release::THIS_VERSION_PATTERN

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Release

add, #extract_version, find, list, #make, #tag_name=

Class Method Details

.applies_to?Boolean

Returns:

  • (Boolean)


460
461
462
463
464
465
466
467
468
469
470
# 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

Instance Method Details

#checkObject

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


476
477
478
479
480
481
482
# 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) ⇒ Object

Tag this release in Mercurial



485
486
487
488
489
490
491
492
493
494
# 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_nextObject

Update buildfile with next version number



497
498
499
500
501
502
# 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