Skip to content

Instantly share code, notes, and snippets.

@crallen
Created June 21, 2010 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crallen/446976 to your computer and use it in GitHub Desktop.
Save crallen/446976 to your computer and use it in GitHub Desktop.
# Simple Ruby script to reset TeamCity build numbers
USER_DIR = ENV['USERPROFILE'].gsub('\\', '/')
# If the .BuildServer directory for TeamCity is located elsewhere on your machine, change this constant to match
TC_BUILDSERVER_CONFIG = File.join(USER_DIR, '.BuildServer', 'config', '**', '*.buildNumbers.properties')
Dir.glob(TC_BUILDSERVER_CONFIG).each do |file|
buffer = File.new(file, 'r').read.gsub(/next.build=\d+/, 'next.build=1')
File.open(file, 'w') { |f| f.write(buffer) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment