snapframework / snap

Top-level package for the official Snap Framework libraries, includes the snaplets API as well as infrastructure for sessions, auth, and templates.
http://snapframework.com/
BSD 3-Clause "New" or "Revised" License
455 stars 68 forks source link

snaplet.cfg is expected in the root directory and not at resources/snaplet.cfg as explained by the tutorial #23

Closed ozataman closed 12 years ago

ozataman commented 12 years ago

Our tutorial on http://snapframework.com/docs/tutorials/snaplets-tutorial indicates snaplet.cfg should reside in resources/ folder.

However, if put there, it does not currently get read properly. Moving it to the root folder, as stated in Snap.Snaplet source code fixes the problem:

> snaplet 
>   |-- snaplet.cabal
>   |-- log/
>   |-- src/
> ------------------------
>   |-- db.cfg
>   |-- snaplet.cfg
>   |-- public/
>       |-- stylesheets/
>       |-- images/
>       |-- js/
>   |-- snaplets
>       |-- subsnaplet1/
>       |-- subsnaplet2/
>   |-- templates/

Either the code or the documentation should be updated to fix the issue.

I am pretty neutral about which way to go, but seem to be slightly in favor of the version pasted above from source code. config files and sub-snaplets don't quite match "resources" in my mind, which is somewhat reserved for templates, css, js, and other similar assets.

mightybyte commented 12 years ago

Actually, it looks to me like this isn't a problem. The resources folder is just used as a conceptual way of keeping track of all the files that should be mentioned in the data-files section in your snaplet's .cabal. From the tutorial: "All of the files and directories listed above under foosnaplet/ will be in resources/." People who use the snaplet will still see snaplet.cfg in the snaplet's root. As a snaplet author, you don't have to put it in resources. But if you did, I guess you'd have to do your testing by running the snaplet from the resources directory.

ozataman commented 12 years ago

Right, and I don't disagree with that. But what I'm saying is that the tutorial reads as though one must put the snaplet.cfg into a mandatory resources/ folder, in which case the config file reading functionality doesn't work. This is because there is a snaplet.cfg file listed with stars in the tutorial that ends up directly under the resources folder if you trace the wording. This left me thinking that I needed to put my snaplet.cfg file for my webapp under the resources folder.

I suspect there may be some confusion for some people there and would suggest making the tutorial clearer on the issue.

Oz

On Tue, Jan 31, 2012 at 6:26 PM, mightybyte < reply@reply.github.com

wrote:

Actually, it looks to me like this isn't a problem. The resources folder is just used as a conceptual way of keeping track of all the files that should be mentioned in the data-files section in your snaplet's .cabal. From the tutorial: "All of the files and directories listed above under foosnaplet/ will be in resources/." People who use the snaplet will still see snaplet.cfg in the snaplet's root. As a snaplet author, you don't have to put it in resources. But if you did, I guess you'd have to do your testing by running the snaplet from the resources directory.


Reply to this email directly or view it on GitHub: https://github.com/snapframework/snap/issues/23#issuecomment-3743460

mightybyte commented 12 years ago

I updated the tutorial to clarify.