Skip to content
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

Closed
mgsloan opened this issue Jan 3, 2016 · 4 comments
Closed

Clone stack templates repo instead of using github API #1595

mgsloan opened this issue Jan 3, 2016 · 4 comments

Comments

@mgsloan
Copy link
Contributor

mgsloan commented Jan 3, 2016

In order to resolve #1251, and support #1571, we need to clone the templates repository. Here's how this would work:

  1. If it doesn't exist yet, clone the templates repo to some location in ~/.stack/.

  2. 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.

  3. 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 #1594

  4. Load 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.

@normenmueller
Copy link

Want to stack new foobar new-template w/o an internet connection but get failed internet connection while stack tries to download new-template. I already created several projects w/ stack, so the template is already there. Is there an option to run stack in offline mode or is what this issue is about? Is there a workaround w/ the current version?

@mgsloan
Copy link
Contributor Author

mgsloan commented Mar 11, 2016

There is not, this issue is tracking the resolution of that problem.

PRs appreciated :)

@mgsloan
Copy link
Contributor Author

mgsloan commented Mar 31, 2016

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.

@snoyberg
Copy link
Contributor

The new approach to templates does not require git commands or API calls, but downloads from raw.githubusercontent.com instead. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants