Class: Buildr::GitRelease
Constant Summary
Constants inherited from Release
Class Method Summary collapse
Instance Method Summary collapse
-
#check ⇒ Object
Fails if one of theses 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
382 383 384 385 386 387 388 389 390 |
# File 'lib/buildr/core/build.rb', line 382 def applies_to? if File.exist? '.git/config' true else File.(Dir.pwd) != '/' && Dir.chdir('..') do applies_to? end end end |
Instance Method Details
#check ⇒ Object
Fails if one of theses 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
396 397 398 399 400 |
# File 'lib/buildr/core/build.rb', line 396 def check 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).
404 405 406 407 408 409 410 411 412 413 |
# File 'lib/buildr/core/build.rb', line 404 def tag_release(tag) info "Committing buildfile with version number #{extract_version}" Git.commit File.basename(Buildr.application.buildfile.to_s), Git.push if Git.remote 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 |