@@ -290,19 +290,19 @@ def modify_pod_file(pod_file, pod_version_map, dryrun=True):
290
290
291
291
292
292
RE_README_POD_VERSION = re .compile (
293
- r"<br> (?P<pod_name>. +) Cocoapod \((?P<version>.+ )\)" )
293
+ r"Firebase/ (?P<product_pod_name>\w +) Cocoapod \((?P<version>([0-9.]+) )\)" )
294
294
295
295
def modify_readme_file_pods (readme_filepath , version_map , dryrun = True ):
296
296
"""Modify a readme Markdown file to reference correct cocoapods versions.
297
297
298
298
Looks for lines like:
299
- <br>Firebase/AdMob Cocoapod (7.11.0)
299
+ <br>Firebase/AdMob Cocoapod (7.11.0)<br>Firebase/Auth Cocoapod (8.1.0)
300
300
for pods matching the ones in the version map, and modifies them in-place.
301
301
302
302
Args:
303
303
readme_filepath: Path to readme file to edit.
304
304
version_map: Dictionary of packages to version numbers, e.g. {
305
- 'FirebaseAuth': '15.0.0' }
305
+ 'FirebaseAuth': '15.0.0', 'FirebaseDatabase': '14.0.0' }
306
306
dryrun (bool, optional): Just print the substitutions.
307
307
Do not write to file. Defaults to True.
308
308
"""
@@ -317,18 +317,20 @@ def modify_readme_file_pods(readme_filepath, version_map, dryrun=True):
317
317
output_lines = []
318
318
319
319
# Replacement function, look up the version number of the given pkg.
320
- def replace_module_line (m ):
321
- if not m .group ('pod_name ' ):
320
+ def replace_pod_line (m ):
321
+ if not m .group ('product_pod_name ' ):
322
322
return m .group (0 )
323
- pod_key = m .group ('pod_name' ). replace ( '/' , ' ' )
323
+ pod_key = 'Firebase' + m .group ('product_pod_name ' )
324
324
if pod_key not in version_map :
325
325
return m .group (0 )
326
- repl = '%s Cocoapod (%s)' % (m .group ('pod_name' ), version_map [pod_key ])
327
- return '<br>{0}' .format (repl )
326
+ repl = 'Firebase/%s Cocoapod (%s)' % (m .group ('product_pod_name' ),
327
+ version_map [pod_key ])
328
+ return repl
328
329
329
330
substituted_pairs = []
331
+ to_update = False
330
332
for line in lines :
331
- substituted_line = re .sub (RE_README_ANDROID_VERSION , replace_module_line ,
333
+ substituted_line = re .sub (RE_README_POD_VERSION , replace_pod_line ,
332
334
line )
333
335
output_lines .append (substituted_line )
334
336
if substituted_line != line :
@@ -415,6 +417,7 @@ def replace_dependency(m):
415
417
quote_type )
416
418
417
419
substituted_pairs = []
420
+ to_update = False
418
421
for line in lines :
419
422
substituted_line = re .sub (RE_GENERIC_DEPENDENCY_MODULE , replace_dependency ,
420
423
line )
@@ -438,7 +441,7 @@ def replace_dependency(m):
438
441
r"<br>(?P<pkg>[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+):([0-9.]+)<br>" )
439
442
440
443
441
- def modify_readme_file (readme_filepath , version_map , dryrun = True ):
444
+ def modify_readme_file_android (readme_filepath , version_map , dryrun = True ):
442
445
"""Modify a readme Markdown file to reference correct module versions.
443
446
444
447
Looks for lines like:
@@ -458,7 +461,8 @@ def modify_readme_file(readme_filepath, version_map, dryrun=True):
458
461
with open (readme_filepath , "r" ) as readme_file :
459
462
lines = readme_file .readlines ()
460
463
if not lines :
461
- logging .fatal ('Could not read contents of file %s' , readme_filepath )
464
+ logging .fatal ('Update failed. ' +
465
+ 'Could not read contents from file {0}.' .format (readme_filepath ))
462
466
463
467
output_lines = []
464
468
@@ -469,10 +473,11 @@ def replace_module_line(m):
469
473
pkg = m .group ('pkg' ).replace ('-' , '_' ).replace (':' , '.' )
470
474
if pkg not in version_map :
471
475
return m .group (0 )
472
- repl = '%s:%s' % (m .group ('pkg' ), version_map [pkg ])
473
- return '<br>{0}<br>' . format ( repl )
476
+ repl = '<br> %s:%s<br> ' % (m .group ('pkg' ), version_map [pkg ])
477
+ return repl
474
478
475
479
substituted_pairs = []
480
+ to_update = False
476
481
for line in lines :
477
482
substituted_line = re .sub (RE_README_ANDROID_VERSION , replace_module_line ,
478
483
line )
@@ -545,7 +550,9 @@ def main():
545
550
file_name = 'readme' )
546
551
if not args .skip_ios :
547
552
#latest_pod_versions_map = get_latest_pod_versions(args.specs_repo, PODS)
548
- latest_pod_versions_map = {'FirebaseAuth' : '8.0.0' , 'FirebaseRemoteConfig' :'9.9.9' }
553
+ latest_pod_versions_map = {'FirebaseAuth' : '8.0.0' ,
554
+ 'FirebaseRemoteConfig' :'9.9.9' ,
555
+ 'FirebaseDatabase' : '11.11.11' }
549
556
pod_files = get_files (args .podfiles , file_extension = '' , file_name = 'Podfile' )
550
557
for pod_file in pod_files :
551
558
modify_pod_file (pod_file , latest_pod_versions_map , args .dryrun )
@@ -556,6 +563,7 @@ def main():
556
563
#latest_android_versions_map = get_latest_maven_versions()
557
564
latest_android_versions_map = {
558
565
'com.google.firebase.firebase_auth' : '6.6.6' ,
566
+ 'com.google.firebase.firebase_analytics' : '8.8.8' ,
559
567
'com.google.firebase.firebase_database' : '9.9.9' ,
560
568
}
561
569
0 commit comments