@@ -22,7 +22,7 @@ ONDEWO_NLU_API_VERSION=6.14.0
2222GITHUB_GH_TOKEN? =ENTER_YOUR_TOKEN_HERE
2323
2424CURRENT_RELEASE_NOTES =` cat RELEASE.md \
25- | sed -n ' /Release ONDEWO NLU API ${ONDEWO_NLU_API_VERSION}/, /\*\*/p ' `
25+ | perl -ne ' print if /Release ONDEWO NLU API ${ONDEWO_NLU_API_VERSION}/.. /\*\*/' `
2626
2727GH_REPO ="https://github.com/ondewo/ondewo-nlu-api"
2828DEVOPS_ACCOUNT_GIT ="ondewo-devops-accounts"
@@ -109,30 +109,30 @@ TEST:
109109
110110githubio_logic_pre :
111111 $(eval REPO_NAME:= $(shell echo ${GH_REPO} | cut -d "-" -f 2 ) )
112- $(eval REPO_NAME_UPPER:= $(shell echo ${GH_REPO} | cut -d "-" -f 2 | sed -e 's/\ (.* \ ) /\U\ 1/') )
112+ $(eval REPO_NAME_UPPER:= $(shell echo ${GH_REPO} | cut -d "-" -f 2 | perl -pe 's/(.* ) /\U$$ 1/') )
113113 $(eval DOCS_DIR:=ondewo.github.io/docs/ondewo-${REPO_NAME}-api/${ONDEWO_NLU_API_VERSION})
114- @sed -i " /{ number: '${ONDEWO_NLU_API_VERSION} ', link: 'ondewo-${REPO_NAME} -api\/${ONDEWO_NLU_API_VERSION} \/' },/d " ondewo.github.io/data.js
114+ @perl -i -ne " print unless /{ number: '${ONDEWO_NLU_API_VERSION} ', link: 'ondewo-${REPO_NAME} -api\/${ONDEWO_NLU_API_VERSION} \/' },/" ondewo.github.io/data.js
115115 @rm -rf ${DOCS_DIR}
116116 @mkdir " ${DOCS_DIR} "
117117 @cp docs/* ${DOCS_DIR}
118- @sed -i " s/h1>Protocol Documentation/h1>${REPO_NAME_UPPER} ${ONDEWO_NLU_API_VERSION} Documentation/" ${DOCS_DIR} /index.html
118+ @perl -i -pe " s/h1>Protocol Documentation/h1>${REPO_NAME_UPPER} ${ONDEWO_NLU_API_VERSION} Documentation/" ${DOCS_DIR} /index.html
119119
120120githubio_logic : | githubio_logic_pre
121121 $(eval REPO_NAME:= $(shell echo ${GH_REPO} | cut -d "-" -f 2 ) )
122- $(eval REPO_NAME_UPPER:= $(shell echo ${GH_REPO} | cut -d "-" -f 2 | sed -e 's/\ (.* \ ) /\U\ 1/') )
122+ $(eval REPO_NAME_UPPER:= $(shell echo ${GH_REPO} | cut -d "-" -f 2 | perl -pe 's/(.* ) /\U$$ 1/') )
123123 @git branch | grep " *" | grep -q " master" || (echo " Not on master branch" & rm -rf ondewo.github.io && exit 1)
124- @! cat ondewo.github.io/data.js | sed -n " /name\: '${REPO_NAME_UPPER} '/, /end\: ''/p " | grep -q " number: '${ONDEWO_NLU_API_VERSION} '" || (echo " Already Released" && exit 1)
125- $(eval VERSION_LINE:= $(shell cat -n ondewo.github.io/data.js | sed -n " /name\: '${REPO_NAME_UPPER}'/, /end\: ''/p " | grep "versions: " -A 1 | tail -1 | grep -o -E '[0-9]+' | head -1 | sed -e 's/^0\ +//') )
126- $(eval TEMP_TEXT:= $(shell cat ondewo.github.io/script_object.txt | sed -e "s/VERSION/${ONDEWO_NLU_API_VERSION}/g" -e " s/TECHNOLOGY/${REPO_NAME}/g") )
127- @sed -i " ${VERSION_LINE} i ${TEMP_TEXT} " ondewo.github.io/data.js
124+ @! cat ondewo.github.io/data.js | perl -ne " print if /name\: '${REPO_NAME_UPPER} '/.. /end\: ''/" | grep -q " number: '${ONDEWO_NLU_API_VERSION} '" || (echo " Already Released" && exit 1)
125+ $(eval VERSION_LINE:= $(shell cat -n ondewo.github.io/data.js | perl -ne "print if /name\: '${REPO_NAME_UPPER}'/.. /end\: ''/" | grep "versions: " -A 1 | tail -1 | grep -o -E '[0-9]+' | head -1 | perl -pe 's/^0+//') )
126+ $(eval TEMP_TEXT:= $(shell cat ondewo.github.io/script_object.txt | perl -pe "s/VERSION/${ONDEWO_NLU_API_VERSION}/g; s/TECHNOLOGY/${REPO_NAME}/g") )
127+ @perl -i -pe ' print "${TEMP_TEXT}\n" if $$. == ${VERSION_LINE} ' ondewo.github.io/data.js
128128 @npm install prettier && cd ondewo.github.io && npx prettier -w --single-quote data.js
129129 $(eval DOCS_DIR:=ondewo.github.io/docs/ondewo-${REPO_NAME}-api/${ONDEWO_NLU_API_VERSION})
130- $(eval HEADER_LINE:= $(shell cat ${DOCS_DIR}/index.html | grep -n "${REPO_NAME_UPPER} ${ONDEWO_NLU_API_VERSION} Documentation" | grep -o -E '[0-9]+' | head -1 | sed -e 's/^0\ +//') )
130+ $(eval HEADER_LINE:= $(shell cat ${DOCS_DIR}/index.html | grep -n "${REPO_NAME_UPPER} ${ONDEWO_NLU_API_VERSION} Documentation" | grep -o -E '[0-9]+' | head -1 | perl -pe 's/^0+//') )
131131 $(eval TEMP_IMG:= $(shell cat ondewo.github.io/script_image.txt) )
132132 $(eval TEMP_CALC:= $(shell expr ${HEADER_LINE} ) )
133- sed -i ' ${TEMP_CALC} i ${TEMP_IMG }' ${DOCS_DIR} /index.html
133+ perl -i -pe ' print "${TEMP_IMG}\n" if $$. == ${TEMP_CALC }' ${DOCS_DIR} /index.html
134134 head -30 ${DOCS_DIR} /index.html
135- cat ondewo.github.io/data.js | sed -n " /name\: '${REPO_NAME_UPPER} '/, /end\: ''/p "
135+ cat ondewo.github.io/data.js | perl -ne " print if /name\: '${REPO_NAME_UPPER} '/.. /end\: ''/"
136136 @git -C ondewo.github.io status
137137 @git -C ondewo.github.io add data.js
138138 @git -C ondewo.github.io add docs
@@ -205,24 +205,24 @@ GENERIC_RELEASE_NOTES="\n***************** \n\\\#\\\# Release ONDEWO NLU REPONAM
205205release_client : # # Generic Function to Release a Client
206206 $(eval REPO_NAME:= $(shell echo ${GENERIC_CLIENT} | cut -c 41- | cut -d '.' -f 1) )
207207 $(eval REPO_DIR:= $(shell echo "ondewo-nlu-client-${REPO_NAME}") )
208- $(eval UPPER_REPO_NAME:= $(shell echo ${REPO_NAME} | sed 's/.* /\u&/') )
208+ $(eval UPPER_REPO_NAME:= $(shell echo ${REPO_NAME} | perl -pe 's/.* /\u$$ &/') )
209209# Get newest Proto-Compiler Version
210210 $(eval PROTO_COMPILER:= $(shell curl https://api.github.com/repos/ondewo/ondewo-proto-compiler/tags | grep "\"name\"" | head -1 | cut -d '"' -f 4))
211211# Clone Repo
212212 rm -rf ${REPO_DIR}
213213 rm -f build_log_${REPO_NAME}.txt
214214
215- @echo ${GENERIC_RELEASE_NOTES} > temp-notes && sed -i 's/\\//g' temp-notes && sed -i 's/REPONAME/${UPPER_REPO_NAME}/g' temp-notes
215+ @echo ${GENERIC_RELEASE_NOTES} > temp-notes && perl -i -pe 's/\\//g' temp-notes && perl -i -pe 's/REPONAME/${UPPER_REPO_NAME}/g' temp-notes
216216 git clone ${GENERIC_CLIENT}
217217# Check if Client is already uptodate with API Version
218218 @! git -C ${REPO_DIR} branch -a | grep -q ${ONDEWO_NLU_API_VERSION} || (echo "Already Released ${ONDEWO_NLU_API_VERSION} \n\n\n" && rm -rf ${REPO_DIR} && rm -f temp-notes && exit 1)
219219
220220# Change Version Number and RELEASE NOTES
221- cd ${REPO_DIR} && sed -i -e ' /Release History/r ../temp-notes' ${RELEASEMD}
221+ cd ${REPO_DIR} && perl -i -ne 'print; if( /Release History/){open my $$fh,"<"," ../temp-notes"; print while <$$fh>; close $$fh} ' ${RELEASEMD}
222222 cd ${REPO_DIR} && head -20 ${RELEASEMD}
223- cd ${REPO_DIR} && sed -i -e 's/ONDEWO_NLU_VERSION.*=.*/ONDEWO_NLU_VERSION = ${ONDEWO_NLU_API_VERSION}/' Makefile
224- cd ${REPO_DIR} && sed -i -e 's/ONDEWO_PROTO_COMPILER_GIT_BRANCH.*=.*/ONDEWO_PROTO_COMPILER_GIT_BRANCH=tags\/${PROTO_COMPILER}/' Makefile
225- cd ${REPO_DIR} && sed -i -e 's/NLU_API_GIT_BRANCH.*=.*/NLU_API_GIT_BRANCH=tags\/${ONDEWO_NLU_API_VERSION}/' Makefile && head -30 Makefile
223+ cd ${REPO_DIR} && perl -i -pe 's/ONDEWO_NLU_VERSION.*=.*/ONDEWO_NLU_VERSION = ${ONDEWO_NLU_API_VERSION}/' Makefile
224+ cd ${REPO_DIR} && perl -i -pe 's/ONDEWO_PROTO_COMPILER_GIT_BRANCH.*=.*/ONDEWO_PROTO_COMPILER_GIT_BRANCH=tags\/${PROTO_COMPILER}/' Makefile
225+ cd ${REPO_DIR} && perl -i -pe 's/NLU_API_GIT_BRANCH.*=.*/NLU_API_GIT_BRANCH=tags\/${ONDEWO_NLU_API_VERSION}/' Makefile && head -30 Makefile
226226
227227# Release
228228 make -C ${REPO_DIR} ondewo_release | tee build_log_${REPO_NAME}.txt
0 commit comments