Class: Buildr::GitRelease
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
Add a tag reference in .git/refs/tags and push it to the remote if any.
- #update_version_to_next ⇒ Object
Methods inherited from Release
add, #extract_version, find, list, #make, #tag_name=
Class Method Details
.applies_to? ⇒ Boolean
508 509 510 511 512 513 514 515 516 517 518 |
# 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 |
Instance Method Details
#check ⇒ Object
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
524 525 526 527 528 529 |
# 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) ⇒ Object
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).
533 534 535 536 537 538 539 540 541 542 543 544 |
# 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), 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 |