Class: Buildr::HgRelease
Constant Summary
Constants inherited from Release
Class Method Summary collapse
Instance Method Summary collapse
-
#check ⇒ Object
Fails if one of these 2 conditions are not met: 1.
-
#tag_release(tag) ⇒ Object
Tag this release in Mercurial.
-
#update_version_to_next ⇒ Object
Update buildfile with next version number.
Methods inherited from Release
add, #extract_version, find, list, #make
Class Method Details
.applies_to? ⇒ Boolean
450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/buildr/core/build.rb', line 450 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
#check ⇒ Object
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
466 467 468 469 470 471 472 |
# File 'lib/buildr/core/build.rb', line 466 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
475 476 477 478 479 480 481 482 483 484 |
# File 'lib/buildr/core/build.rb', line 475 def tag_release(tag) unless this_version == extract_version info "Committing buildfile with version number #{extract_version}" Hg.commit File.basename(version_file), 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 ⇒ Object
Update buildfile with next version number
487 488 489 490 491 492 |
# File 'lib/buildr/core/build.rb', line 487 def update_version_to_next super info "Current version is now #{extract_version}" Hg.commit File.basename(version_file), Hg.push if Hg.remote end |