forked from Sage-Bionetworks/Synapse-Repository-Services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pomVersioner.py
24 lines (23 loc) · 836 Bytes
/
pomVersioner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os, sys, fileinput
'''
Walk the complete PLFM hierarchy and bring all the pom.xml files up to new minor version
'''
#Old and new minor versions
oldVersion = 'develop-SNAPSHOT'
newVersion = '1.2.0'
#Path to PLFM on your system
startPath = os.getcwd()
count = 0;
for root, subFolders, files in os.walk(startPath):
for file in files:
if file == 'pom.xml':
f = os.path.join(root, file)
print 'checking '+f
for line in fileinput.FileInput(f, inplace=1):
found = False
if line.find('<version>'+oldVersion+'</version>') >= 0 and not found:
line = line.replace(oldVersion,newVersion)
found = True
count += 1
print line.rstrip()
print 'updated: '+str(count)+' pom.xml files'