-
Notifications
You must be signed in to change notification settings - Fork 55
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
Nanoc 4 upgrade guide: some pitfalls #202
Comments
A first draft for (part of) nanoc#202. (I'm not sure if I got the formatting right as I have no way to test DMark, and the language could be improved ...) Signed-off-by: Thomas Hochstein <thh@inter.net>
Some rough thoughts:
It might be worth adding commonly-used functions from The Troubleshooting section could explicitly mention “Undefined method … on Nanoc::Identifier” so that it is easier to search for.
This is indeed icky, especially because I believe it to be possible to detect whether a string represents a full or legacy identifier (if it ends with a slash, it’s legacy, otherwise it is not). |
Another thought: |
Ah! Just learned something about Nanoc again. :-)
Sounds like a good idea!
I didn't try the example from the guide - I encountered that problem in one of my sites. |
What I meant to say is that |
Here’s the PR that will raise an error when constructing invalid full identifiers: nanoc/nanoc/pull/1206 |
And more documentation for the new error: #204 |
@th-h I believe that this issue can now be closed. Can you verify that I’ve tackled all the problems mentioned in this issue? |
Yes, I think you got everything. (And most people will have upgraded to 4.x long before :-)). I cross-checked the updated upgrade guide with the entry in my (German language) blog about my upgrade experience, and AFAIS all issues I ran into are covered. So I think the issue can be closed now. |
Excellent! Thanks for your input. |
I have - very much belatedly - upgraded my site to Nanoc 4, using your outstanding upgrade guide, mostly without difficulties - but it took me a disproportionately long time to figure out two changes:
Identifiers are no longer strings, so using string functions like
item.identifier.split
will not work anymore. That is indeed covered in the "Troubleshooting" section of the upgrade guide, but it escaped me, so I had to google and search through the Nanoc group on Google Groups for hours. :-) I would suggest to point that out much more prominently, perhaps even in the "Quick upgrade guide".If the third argument to
#new_item
or#new_layout
is a string, it will be converted to a full identifier. When using your own data source, it's not enough to switch to#new_item
fromNanoc::Item.new
and addidentifier_type: legacy
to the configuration (which will have no effect at all) - you have to use aNanoc::Identifier
instance of thelegacy
type for#new_item
. That's not mentioned at all, as far as I can see; I had to piece that together from the source, the Data sources documentation and some examples from the Identifiers and patterns docs.Perhaps the upgrade guide could be improved still further.
The text was updated successfully, but these errors were encountered: