-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use cached template if template download fails #4173
Conversation
@@ -0,0 +1,284 @@ | |||
{-# START_FILE {{name}}.cabal #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file needed somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No! I left that by accident because I needed it for the first implementation of the integration test. I'll remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks really good, except that question on the simple.hsfiles
template
I feel like I could do some more testing (trying with a I believe I should add this to the |
The only relevant place in the docs on a quick scan seems to be https://docs.haskellstack.org/en/stable/GUIDE/#stack-new but even there it would be offtopic to talk about using cached templates. |
I stumbled upon some issues that made stack build the whole project every time I made a change in the tests, so I needed more time than expected to finish the PR. I'm not sure what it was but I fixed it by removing the Anyway, tell me if there's anything missing. I will try to be quick. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks
I saw that issue #3850 was newcomer friendly and so I'm trying to fix it.
I intend to add tests once I make sure I'm doing things properly. For the time being, I have manually tested the feature by:
$ stack new tmp https://raw.githubusercontent.com/stesta/haskell-templates/master/snap-basic-websockets.hsfiles
tmp
directory:$ rm -r tmp
.And it works as I intended. I haven't tried yet with a
TemplatePath
using theRepoPath
constructor but that should be quick to try. I haven't seen what would happen ifredownload
throws aRedownloadInvalidResponse
instead of aRedownloadHttpError
either, but the worst thing that I could see happening is a log error badly formatted. I'll take a look at that case too anyway.I have tried to make sure nobody was catching a
HttpException
when callingredownload
from any part of the codebase. That could be slightly problematic because, as I'm catching that exception myself atredownload
, it would never propagate to the formerHttpException
catchers, which could have been doing something useful with the exception. I've greppedredownload
and there is no function calling it that catches the exception, but I can't be sure about functions higher in the call stack. I would say this is not going to be a problem, but wanted to find out what you think about it.