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

template parameters are not applied to placeholders of the file path.(v1.9.0.1) #4344

Closed
phoityne opened this issue Oct 7, 2018 · 7 comments

Comments

@phoityne
Copy link

phoityne commented Oct 7, 2018

Steps to reproduce

D:\tmp>c:\tool\stack-1.9.0.1\stack.exe --version
Version 1.9.0.1, Git revision 4040130261deb6f9654edc2e7f5618043a1c4c7f (6124 c
ommits) x86_64 hpack-0.31.0

D:\tmp>c:\tool\stack-1.9.0.1\stack.exe new sample191 hspec.hsfiles
Downloading template "hspec" to create project "sample191" in sample191\ ...
...
cabal file path D:\tmp\sample191\{{name}}.cabal does not match the package nam
e it defines.
Please rename the file to: sample191.cabal
For more information, see: https://github.com/commercialhaskell/stack/issues/3
17

D:\tmp>dir sample191
...
2018/10/06  07:21             1,273 {{name}}.cabal   !!!!!
...
D:\tmp>

Expected

Same as ver1.7.
Parameters are applied to Mustache placeholders.

D:\tmp>stack --version
Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 com
mits) x86_64 hpack-0.28.2

D:\tmp>stack new sample171 hspec.hsfiles  --color never
Downloading template "hspec" to create project "sample171" in sample171\ ...
...
Writing configuration to file: sample171\stack.yaml
All done.

D:\tmp>dir sample171
...
2018/10/06  07:27             1,273 sample171.cabal
...
D:\tmp>

comments

I think, this is because of below steps order has changed.
Ver1.9 is not applying parameters to the file path.

  1. ProjectTemplate.unpackTemplate
  2. Mustache.compileTemplate
  1. Mustache.compileTemplate
  2. ProjectTemplate.unpackTemplate
@bhrgunatha
Copy link

I have the same issue on Linux:

$uname -a      
Linux archlinux 4.18.14-arch1-1-ARCH #1 SMP PREEMPT Sat Oct 13 13:42:37 UTC 2018 x86_64 GNU/Linux
$stack --version
Version 1.9.1, Git revision f9d0042c141660e1d38f797e1d426be4a99b2a3c (6168 commits) x86_64 hpack-0.31.0

I'm using the Arch User Repository version stack-static

$stack new simple-lib simple-library 



Downloading template "simple-library" to create project "simple-lib" in simple-lib/ ...

The following parameters were needed by the template but not provided: author-name
You can provide them in /home/bhrgunatha/.stack/config.yaml, like this:
templates:
  params:
    author-name: value
Or you can pass each one as parameters like this:
stack new simple-lib simple-library -p "author-name:value"


The following parameters were needed by the template but not provided: author-email, author-name, category, copyright, github-username
You can provide them in /home/bhrgunatha/.stack/config.yaml, like this:
templates:
  params:
    author-email: value
    author-name: value
    category: value
    copyright: value
    github-username: value
Or you can pass each one as parameters like this:
stack new simple-lib simple-library -p "author-email:value" -p "author-name:value" -p "category:value" -p "copyright:value" -p "github-username:value"

Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- simple-lib/

cabal file path /home/bhrgunatha/scratch/simple-lib/{{name}}.cabal does not match the package name it defines.
Please rename the file to: simple-lib.cabal
For more information, see: https://github.com/commercialhaskell/stack/issues/317

Also there is no stack.yaml file in the simple-lib directory.

@sir4ur0n
Copy link

sir4ur0n commented Nov 1, 2018

This is a major issue, the whole stack template feature is broken 😢

@sir4ur0n
Copy link

sir4ur0n commented Nov 2, 2018

I confirm the regression comes from commit 18c3e1f from PR #4134 to fix #4133.

I checked out previous commit (d21152a) and the feature worked fine.

@mihaimaruseac
Copy link
Contributor

Thank you for the bisection. Do you want to make a PR with the fix?

@sir4ur0n
Copy link

sir4ur0n commented Nov 3, 2018

I'm sorry, I'm a newbie in Haskell, I gave it a shot but it didn't manage to fix it 😞

@andrevdm
Copy link

I've submitted a PR that seems to fix this (#4397).

@dbaynard
Copy link
Contributor

Thanks, @andrevdm — as mentioned at your PR, this has already been fixed, in the next minor release (the stable branch).

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

Successfully merging a pull request may close this issue.

6 participants