faustinoaq changed the topic of #amber to: Welcome to Amber Framework community! | https://amberframework.org | Developer happiness, productivity and bare metal performance | GH: https://github.com/amberframework | Docs: https://docs.amberframework.org | Gitter: https://gitter.im/amberframework/amber | IRC Logger: https://irclog.whitequark.org/amber | Amber::Server.start
<FromGitter> <drujensen> restructuring the generators
<FromGitter> <dwightwatson> hey everyone
<FromGitter> <dwightwatson> thanks for the help getting all those bootstrap prs through
_whitelogger has joined #amber
<FromGitter> <Willyboar> I totally agree with the plugin system you mention
<FromGitter> <Willyboar> IMHO the best combination is "batteries doesn’t included but offered"
<FromGitter> <Willyboar> This is what i liked a lot in Flask
<FromGitter> <Willyboar> of course if you implement a plugin generator i think the next thing is to separate the cli from the framework
feepbot has quit [Ping timeout: 244 seconds]
feepbot has joined #amber
<FromGitter> <dwightwatson> out of curiousity, what's with the separation between amber/router and the amber_router shard?
<FromGitter> <drujensen> @dwightwatson There are several routers available. We started with radix (luislavena/radix) which is used by Kemal
<FromGitter> <drujensen> But it doesn’t support 2 different named paths
<FromGitter> <dwightwatson> is there reason that the amber_router shard wasn't just merged into the main amber repo?
<FromGitter> <dwightwatson> i could be wrong but it looks like they both pop code into the Amber::Router namespace, and that seems weird to me
<FromGitter> <drujensen> @robacarp created a drop in replacement
<FromGitter> <dwightwatson> ah ok
<FromGitter> <drujensen> it can be used by any of the other frameworks if they want that capability
<FromGitter> <drujensen> we thought about renaming it
<FromGitter> <drujensen> but we think its something worth sharing
<FromGitter> <dwightwatson> so amber/router in the main repo is just a glue between amber_router and the framework?
<FromGitter> <drujensen> correct
<FromGitter> <dwightwatson> gotcha
<FromGitter> <Blacksmoke16> :0 neat, i might have to look into that as well :p
<FromGitter> <drujensen> the replacement uses a tree structure instead of a radix one. There are some performance differences based on different scenarios
<FromGitter> <dwightwatson> ok, that helps, thanks
<FromGitter> <dwightwatson> was trying to have a crack at implementing route helpers
<FromGitter> <dwightwatson> but was thrown by the fact both were working with the same namespace
<FromGitter> <drujensen> 👍 much needed
<FromGitter> <drujensen> yeah, we could rename it
<FromGitter> <drujensen> I agree that would be confusing
<FromGitter> <dwightwatson> another question if you don't mind
<FromGitter> <dwightwatson> is it common in crystal to include multiple class definitions in a single file, vs breaking them out into individual files
<FromGitter> <dwightwatson> for example
<FromGitter> <drujensen> no, you shouldn’t have multiple class definitions in one file IMO
<FromGitter> <dwightwatson> a file called `cookies.cr` contains definitions for Amber::Router:::Cookies::Store, Amber::Router::Cookies::JsonSerializer etc
<FromGitter> <dwightwatson> is that a sort of PR you might be open to, breaking those definitions up?
<FromGitter> <drujensen> looks like `Cookies` should be a module?
<FromGitter> <dwightwatson> yeah doesn't really look like anything is going on in there
<FromGitter> <drujensen> good question. We have been avoiding major breaking changes for stability but I think it depends. If you are just moving them to files to simplify the code, i’m ok with that.
<FromGitter> <dwightwatson> but found it very easy to get lost in that file when there was so much going on
<FromGitter> <drujensen> yup, agree
<FromGitter> <drujensen> can you open an enhancement ticket?
<FromGitter> <dwightwatson> sure
<FromGitter> <dwightwatson> also, granite doesn't have any sort of eager loading does it?
<FromGitter> <dwightwatson> nothing like Post.include(:user)
<FromGitter> <drujensen> no, not yet. another thing on the list to do
<FromGitter> <dwightwatson> cool, just checking i hadn't missed anything there
<FromGitter> <dwightwatson> thanks :)
<FromGitter> <drujensen> @dwightwatson you have been cranking out PR’s. 🔩
<FromGitter> <drujensen> thanks!
<FromGitter> <dwightwatson> no worries, glad to be able to help out
<FromGitter> <dwightwatson> still new to crystal but it's a lot of fun
<FromGitter> <Blacksmoke16> 💯 🚀
<FromGitter> <Willyboar> It is possible to reproduce error logs in browser like rails or pretty errors
<FromGitter> <Willyboar> ?
<FromGitter> <drujensen> we added an error page recently
<FromGitter> <drujensen> i
<FromGitter> <drujensen> compilation errors will show in the terminal
<FromGitter> <drujensen> anyway, i think that is how it works. lol
vivus has joined #amber
<FromGitter> <drujensen> @dwightwatson Seems like the new `li.nav-links` is not working properly
<FromGitter> <drujensen> they are stacking
<FromGitter> <Blacksmoke16> @drujensen thanks for that router, is pretty slick, am using that one now
<FromGitter> <Blacksmoke16> im a fan of the optional params
<FromGitter> <drujensen> 👍
<FromGitter> <drujensen> @Blacksmoke16 do you think your `Athena` project is something we can use in Amber?
<FromGitter> <Blacksmoke16> possibly
<FromGitter> <drujensen> replace the `config/routes.cr`?
<FromGitter> <drujensen> compile time checking?
<FromGitter> <Blacksmoke16> checking of what?
<FromGitter> <Blacksmoke16> im not too sure how amber routing works, but it's prob doable
<FromGitter> <drujensen> nm, I’m thinking of the `link_to` helper that could verify the path exists
<FromGitter> <drujensen> we could create helpers using the annotations
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <drujensen> then it would make sure the path exists in your templates
<FromGitter> <Blacksmoke16> next crystal version there is a read_file or something macro method
<FromGitter> <Blacksmoke16> which you could feed it path and if it returns nil, raise compile time exception
<FromGitter> <drujensen> interesting.
<FromGitter> <Blacksmoke16> atm the routing for athena is using the amber router, and exists as a http server handler
<FromGitter> <drujensen> so in theory, you could drop in the shard and replace the routes with annotations?
<FromGitter> <Blacksmoke16> so in theory it shouldnt be too hard to at least modify it to do what you want
<FromGitter> <drujensen> would it just work?
<FromGitter> <Blacksmoke16> :shrug: maybe?
<FromGitter> <Blacksmoke16> minus the param conversion stuff, that is most of the logic
<FromGitter> <drujensen> that would be fun to try. I may spend some time on that
<FromGitter> <Blacksmoke16> and would have to have the routes inherit from some like `Amber::Controller` class to be able to get a list of classes, to get to the methods with the annoations
<FromGitter> <drujensen> hhmm, yeah
<FromGitter> <drujensen> ok
<FromGitter> <Blacksmoke16> so wouldnt be a 1-1 seamless transition,
<FromGitter> <Blacksmoke16> but its been a quite fun project, pretty happy with how its coming along
<FromGitter> <drujensen> yes, I’m excited to see someone work on the idea
<FromGitter> <drujensen> its pretty cool
<FromGitter> <Blacksmoke16> next thing i want to do is something like
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c293c968d31aa78b1214f37]
<FromGitter> <Blacksmoke16> where would auto resolve/inject the user with the given id from db, or throw 404
<FromGitter> <drujensen> so automatically load the User
<FromGitter> <drujensen> cool
<FromGitter> <Blacksmoke16> ye
<FromGitter> <Blacksmoke16> 💯
<FromGitter> <Blacksmoke16> well thats done
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c293edf8d31aa78b1215f15]
<FromGitter> <Blacksmoke16> prob should say `item` not the class name for security reasons
<FromGitter> <Blacksmoke16> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5c293f7a0b7fc97caac3fd87]
<FromGitter> <Blacksmoke16> easy enough
<FromGitter> <drujensen> 👍
<FromGitter> <noahlh> @Blacksmoke16 this looks extremely cool but I have to admit I’m slightly lost. Could you ELI5 how the annotations work / why they’re cool / etc? I’m just missing a slight bit of context I think.
<FromGitter> <Blacksmoke16> they're basic a way to add context to a method/property
<FromGitter> <Blacksmoke16> that can be accessed at compile time in macros
<FromGitter> <Blacksmoke16> https://github.com/Blacksmoke16/CrSerializer/tree/master/docs#example-usage is an example of how im using them in another project
<FromGitter> <Blacksmoke16> compared to writing out custom code like ⏎ ⏎ ``` validate :title, "can't be blank" do |post| ⏎ !post.title.to_s.blank? ⏎ end``` [https://gitter.im/amberframework/amber?at=5c29549e09b80668498d3d39]
<FromGitter> <Blacksmoke16> (which is how you do it in granite for example)
<FromGitter> <Blacksmoke16> @noahlh ^^