Re:Renee, the friendly rack-based framework
by acangiano on Friday October 14, 2011 @11:25PM
(#3113887)
Josh, I have not looked into the details of your framework, but why not simplify the DSL to:
path 'blog' do |id|
@blog = Blog.get(id)
get { halt @blog }
put { @blog.update(request.params); halt :ok}
end
Why do you need the var call within the block? Also, you seem to break the ruby convention of using do end for blocks larger than one line, in many of your examples.(Again, I spent three seconds on your site, so you may have a solid reason for this and have explained it already as well.)
Re:Renee, the friendly rack-based framework
by joshbuddy on Friday October 14, 2011 @11:30PM
(#3113898)
This very well might be the next iteration in fact. There is no "good reason" aside from simplicity. One of the reasons against this is var can take validation. So, you can do the following.
var Integer do |id|
this will only continue if it matches against an Integer (and it will also cast it for you). The argument list might get hella complicated if you allow munging like that.I am considering allowing chaining though, so,
path('blog').var do |id|
What would you think of that?
Re:Renee, the friendly rack-based framework
by nesquena on Friday October 14, 2011 @11:33PM
(#3113908)
Yeah this is an early release. I can think of several ways to enhance the DSL even more with ideas similar to this to cleanup common cases.
Re:Renee, the friendly rack-based framework
by joshbuddy on Friday October 14, 2011 @11:41PM
(#3113931)
Yeah, exactly. I wanna get a better handle on what these common cases are, so, comments like this are wonderful.
Re:Renee, the friendly rack-based framework
by themgt on Friday October 14, 2011 @11:18PM
(#3113867)
I'll definitely give this a try for my next would-be Sinatra/Padrino project. The code looks great and so does the site. Thanks for this!
Re:Renee, the friendly rack-based framework
by keen on Saturday October 15, 2011 @12:16AM
(#3114005)
Ah, cool.
I love Sinatra, and I'm big on DRY, so I'll definitely give Renee a shot.
BTW, noticed the 'GITHUB FORK YOU', nice haha.
Re:Renee, the friendly rack-based framework
by seanp2k2 on Saturday October 15, 2011 @01:43PM
(#3115298)
Yeah, the "GITHUB FORK YOU" thing made me laugh too. Thanks for another viable option for a Ruby DSL! I might use it if I wanted to mess around with HTTP response headers -- looks like it'd be good for that.
Renee is my gf's name, and she's very patient with me when I wanna work on open source, so, it's a nod to her.
The inspiration for it came from Railsconf 2009 when one of the Sinatra guys said how get "/:id" do |id| was a smell because of the id repeat. I had been working on a new routing DSL for Goliath, when I got an itch to start making simple, useful rack apps.