Skip to content

Commit

Permalink
Merge pull request spring-io#993 from swagger-api/phpReadmeOptions
Browse files Browse the repository at this point in the history
modify readme and sh file to allow full url
  • Loading branch information
gracekarina authored Nov 19, 2021
2 parents 386aa8e + f041b80 commit 6ae37b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/handlebars/php/README.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
14 changes: 11 additions & 3 deletions src/main/resources/handlebars/php/git_push.sh.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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}}}"
Expand All @@ -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

Expand All @@ -37,16 +43,18 @@ 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

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'

0 comments on commit 6ae37b1

Please sign in to comment.