gruntwork-io / boilerplate

A tool for generating files and folders ("boilerplate") from a set of templates
https://www.gruntwork.io
Mozilla Public License 2.0
157 stars 12 forks source link

Attempt to provide more helpful error message when git URL may be misspelled #121

Closed yorinasub17 closed 1 year ago

yorinasub17 commented 1 year ago

Description

Attempts to fix https://github.com/gruntwork-io/boilerplate/issues/120

Since it's impossible to catch all misspelled URL formats, this is a best effort attempt to catch the most common misspelling of using git@github.com/ORG/REPO instead of git@github.com:ORG/REPO.

TODOs

Read the Gruntwork contribution guidelines.

Release Notes (draft)

yorinasub17 commented 1 year ago

Sample error message output from test:

[boilerplate] 2022/08/08 14:33:33 Loading boilerplate config from ../test-fixtures/regression-test/misspelled-git/boilerplate.yml
[boilerplate] 2022/08/08 14:33:33 Loading boilerplate config from ../test-fixtures/regression-test/misspelled-git/boilerplate.yml
[boilerplate] 2022/08/08 14:33:33 Processing dependency guestbook, with template folder ../test-fixtures/regression-test/misspelled-git/git@github.com/JDoe/guestbook.git/nginx?ref=v0.1.0 and output folder /var/folders/36/ljcx66pj73zd3sq1r1tsr_300000gn/T/boilerplate-test-output1090859506/guestbook
[boilerplate] 2022/08/08 14:33:33 Loading boilerplate config from ../test-fixtures/regression-test/misspelled-git/boilerplate.yml
ERROR: Could not find boilerplate.yml in ../test-fixtures/regression-test/misspelled-git/git@github.com/JDoe/guestbook.git/nginx?ref=v0.1.0/boilerplate.yml and the missing-config-action flag is set to exit. Template URL looks like a git repo. Did you misspell the URL? Should be one of the following: git::`ssh://git@github.com/ORG/Repo`, `github.com/ORG/Repo`, or `git@github.com:ORG/Repo`.