moigagoo / norman

Migration manager for Norm
https://norman.nim.town
MIT License
31 stars 1 forks source link

Fails to read .nimble file after a seq #5

Closed matthiaswh closed 4 years ago

matthiaswh commented 4 years ago

Because it's using parsecfg to read the package's .nimble file, Norman will fail to read the srcDir if any line above it uses a seq. This would cause Norman to look for the model files at ./nimble/models instead of ./src/nimble/models.

bin = @["nimble"]`
srcDir = "src"
moigagoo commented 4 years ago

@matthiaswh Thanks for the report! Any suggestions on how to fix it?

matthiaswh commented 4 years ago

If I'm understanding right, a .nimble file is not actually the file format that parsecfg is looking for. So the fact that it sometimes works is possibly the surprising part here :)

The options then are maybe:

moigagoo commented 4 years ago

If I'm understanding right, a .nimble file is not actually the file format that parsecfg is looking for. So the fact that it sometimes works is possibly the surprising part here :)

Makes sense :-) In fact, I just looked at how Nimble interpreted .nimble file. They use a combination of parsecfg and parseutils. I didn't test it well enough, just had a quick look and copied the approach.

Anyway, I think the right way would be to run .nimble file as regular NimScript and get the values from that. Maybe, Nimble's parser could help, as you suggested.

Require a separate config file that can be fully read by parsecfg (or possibly the config.nims file?)

Well, I'd be silly to ask the user to set srcDir both in .nimble file and config.nims. I know I wouldn't like that from a software :-)

Ask the user for input when running init

Same here. The value is already there, why bother?

Manually parse the .nimble file for the variables you need

Oh man I'd hate to do that :-) Sounds like NimScript compilation with extra steps 😂


I'm currently more focused on rewriting Norm since it grew some unsolvable issues and as an adult with full-time job and a full-time family I'm in constant lack of spare time, so I'll be honest and tell you that I won't be able to tackle this issue anytime soon. Maybe some time later next week at best, although no guarantees there.

moigagoo commented 4 years ago

Norman 2.0.0 doesn't try to read .nimble file anymore, so this is probably not relevant anymore.