-
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
Clone stack templates repo instead of using github API #1595
Comments
Want to |
There is not, this issue is tracking the resolution of that problem. PRs appreciated :) |
One downside of this is that it would cause us to really require git. Stack doesn't currently require git - it's just used as an optimized way of fetching the hackage index, if available. |
The new approach to templates does not require |
In order to resolve #1251, and support #1571, we need to clone the templates repository. Here's how this would work:
If it doesn't exist yet, clone the templates repo to some location in
~/.stack/
.If the repo is dirty, complain to the user about it and skip step (3). This allows you to easily modify existing templates / add new ones.
Fetch and reset to the latest master. If the user passes
--offline
, then errors while running these git commands will be ignored. When--offline
isn't passed and an error occurs, the exception will mention that you can use--offline
. See also this issue about-offline
: Global--offline
flag to prevent internet access #1594Load the template from the file in the cloned repo.
Another detail here is windows newline normalization, as recently mentioned by Lokathor in the #haskell-stack IRC channel. Since we're using the github API to fetch the file, we currently get
\n
rather than\r\n
. This is something that git can deal with, at least if we prefer using\r\n
on windows.The text was updated successfully, but these errors were encountered: