Skip to content

Commit

Permalink
update for cube
Browse files Browse the repository at this point in the history
  • Loading branch information
liaohuqiu committed Mar 6, 2015
1 parent 3bc5d0c commit 9040bf4
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions update-project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import os
vars = {
'ptr_lib_version': '1.0.8.1-SNAPSHOT',
'ptr_lib_stable_version': '1.0.7',
'cube_sdk_version': '1.0.44.14-SNAPSHOT'
}

files = [
'README.md',
'README-cn.md',
'ptr-lib/pom.xml',
'ptr-lib/gradle.properties',
'ptr-demo/pom.xml',
'ptr-demo/build.gradle',
]

current_dir = os.path.dirname(os.path.realpath(__file__))
print current_dir
src_dir = current_dir + '/template/'
dst_dir = current_dir + '/'

def update_var_for_file(file, vars):
src_file = src_dir + file
dst_file = dst_dir + file
print "update_var_for_file: %s => %s" % (src_file, dst_file)
infile = open(src_file)
outfile = open(dst_file, 'w')

for line in infile:
for src, target in vars.iteritems():
line = line.replace(src, target)
outfile.write(line)
infile.close()
outfile.close()

real_vars = {}
for src, target in vars.iteritems():
real_vars['{' + src + '}'] = target

for f in files:
update_var_for_file(f, real_vars)

0 comments on commit 9040bf4

Please sign in to comment.