|
# |
|
# pod_updatable_info.awk |
|
# |
|
# Created by Tomohiro Imaizumi on 5/18/20. |
|
# Copyright © 2017 Tomohiro Imaizumi. Licensed under MIT. |
|
# |
|
|
|
BEGIN { |
|
print "| Library | Current | Podfile Latest | Global Latest | `pod update` | Podfile Specification |" |
|
print "|:---:|:---:|:---:|:---:|:---:|:---:|" |
|
} |
|
{ |
|
if(NF>=5 && $5!="" && $1=="-") { |
|
gsub(/\)/, "", $8); |
|
name=$2; |
|
current=$3; |
|
podLatest=$5; |
|
latest=$8; |
|
|
|
split(current,currentVersion,/\./); |
|
split(podLatest,podLatestVersion,/\./); |
|
split(latest,latestVersion,/\./); |
|
|
|
# DON'T update to neither alpha nor beta version. |
|
match(latest, /(alpha|beta)/) |
|
|
|
canUpdatePodSpecification=""; |
|
canUpdateLocalPod=""; |
|
|
|
if(podLatest!=latest && podLatest!="(unused)" && RLENGTH<0) { |
|
# Check if Podfile specification update is neccesary. |
|
if(podLatestVersion[1]!=latestVersion[1]) { |
|
canUpdatePodSpecification=canUpdatePodSpecification"Need for Major Update"; |
|
} else if(podLatestVersion[2]!=latestVersion[2]) { |
|
canUpdatePodSpecification=canUpdatePodSpecification"Need for Minor Update"; |
|
} else if(podLatestVersion[3]!=latestVersion[3]) { |
|
canUpdatePodSpecification=canUpdatePodSpecification"Need for Patch Update"; |
|
} else { |
|
# Print nothing. |
|
} |
|
} |
|
|
|
if(current!=podLatest && podLatest!="(unused)") { |
|
# Check if running `pod update` is available. |
|
if(currentVersion[1]!=podLatestVersion[1]) { |
|
canUpdateLocalPod=canUpdateLocalPod"Available for Major Update"; |
|
} else if(currentVersion[2]!=podLatestVersion[2]) { |
|
canUpdateLocalPod=canUpdateLocalPod"Available for Minor Update"; |
|
} else if(currentVersion[3]!=podLatestVersion[3]) { |
|
canUpdateLocalPod=canUpdateLocalPod"Available for Patch Update"; |
|
} else { |
|
# Print nothing. |
|
} |
|
} |
|
printf("| %s | %s | %s | %s | %s | %s |\n", name, current, podLatest, latest, canUpdateLocalPod, canUpdatePodSpecification); |
|
} |
|
} |