Release Project

If you are using Subversion as your version control system, and ANT as your build system, then the following script will release a project. Note how you don’t have to check the return value of the commands being carried out becausee BuildMaster will check it for you and throw an exception if it is not 0.

require 'buildmaster/project'

# Normally you would put release script at the root of the project
cotta = BuildMaster::Cotta.new
root = cotta.file(__FILE__).parent

# BuildMaster can look into svn files to figure out the svn information
svn = BuildMaster::SvnDriver.from_path(root)

# Load Ant Driver uses the ANT build file
ant = BuildMaster::AntDriver.from_file(root.file('build.xml'))

# Java Manifest file that contains version and build information
manifest = BuildMaster::JavaManifest.from_file(root.file('src//META-INF/MANIFEST.MF'))

puts 'updating working directory just in case'
svn.update

puts 'increase build number'
manifest.increase_build

puts 'building application with the updated build number'
ant.target('all')

puts 'check-in build number change'
svn.commit("releasing #{manifest.version.number} build #{manifest.version.build}")

puts 'tagging into <repository-path>/tags/<tag-name>'
svn.tag("project-#{manifest.version}b#{manifest.version.build}")

For more information, see Full References

Document Source (History)