From 1c3251bc939b13f86cd6d8f0dcd57c17bfdf56a2 Mon Sep 17 00:00:00 2001 From: gracekarina Date: Fri, 19 Nov 2021 12:28:46 -0500 Subject: [PATCH] modify readme and sh file to allow full url --- src/main/resources/handlebars/php/README.mustache | 2 +- .../resources/handlebars/php/git_push.sh.mustache | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/resources/handlebars/php/README.mustache b/src/main/resources/handlebars/php/README.mustache index 0dd35fa58e..aa14f464c2 100644 --- a/src/main/resources/handlebars/php/README.mustache +++ b/src/main/resources/handlebars/php/README.mustache @@ -31,7 +31,7 @@ To install the bindings via [Composer](http://getcomposer.org/), add the followi "repositories": [ { "type": "git", - "url": "http://{{gitRepoBaseURL}}.com/{{#composerVendorName}}{{.}}{{/composerVendorName}}{{^composerVendorName}}{{gitUserId}}{{/composerVendorName}}/{{#composerProjectName}}{{.}}{{/composerProjectName}}{{^composerProjectName}}{{gitRepoId}}{{/composerProjectName}}.git" + "url": "{{gitRepoBaseURL}}/{{#composerVendorName}}{{.}}{{/composerVendorName}}{{^composerVendorName}}{{gitUserId}}{{/composerVendorName}}/{{#composerProjectName}}{{.}}{{/composerProjectName}}{{^composerProjectName}}{{gitRepoId}}{{/composerProjectName}}.git" } ], "require": { diff --git a/src/main/resources/handlebars/php/git_push.sh.mustache b/src/main/resources/handlebars/php/git_push.sh.mustache index dd518fc96d..130b3986ec 100755 --- a/src/main/resources/handlebars/php/git_push.sh.mustache +++ b/src/main/resources/handlebars/php/git_push.sh.mustache @@ -6,6 +6,7 @@ git_user_id=$1 git_repo_id=$2 release_note=$3 +git_repo_base_url=$4 if [ "$git_user_id" = "" ]; then git_user_id="{{{gitUserId}}}" @@ -22,6 +23,11 @@ if [ "$release_note" = "" ]; then echo "[INFO] No command line input provided. Set \$release_note to $release_note" fi +if [ "$git_repo_base_url" = "" ]; then + git_repo_base_url="{{{gitRepoBaseURL}}}" + echo "[INFO] No command line input provided. Set \$git_repo_base_url to $git_repo_base_url" +fi + # Initialize the local directory as a Git repository git init @@ -37,9 +43,11 @@ if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_repo_base_url}.com/${git_user_id}/${git_repo_id}.git + git remote add origin ${git_repo_base_url}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_repo_base_url}.com/${git_user_id}/${git_repo_id}.git + git_repo_base_url=${git_repo_base_url#*//} + git_repo_base_url=${git_repo_base_url%%.*} + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_repo_base_url}/${git_user_id}/${git_repo_id}.git fi fi @@ -47,6 +55,6 @@ fi git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_repo_base_url}.com/${git_user_id}/${git_repo_id}.git" +echo "Git pushing to ${git_repo_base_url}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https'