The route maker''s job is basically two things: - Make sure that all controllers includes the right mixins - If any controllers doesn''t respond to "urls" (aka. haven''t been inherited from R) define "urls" as ClassName.downcase The first point can be accomplished within R, but not the latter. But it should be noted that the latter also can cause some troubles. It''s assuming all constants under Controllers are class and all should be publicly accessible: module Camping::Controllers LIMIT = 6 # Ops! Crashing time! class HiddenStuff;end # Ops! Hacking time! end By removing the route maker you must explicitly define controllers by inherited it from R: module Camping::Controllers class Posts end # No longer working! # Stick with this: class Posts < R ''/posts'' end end What do you think? (It''s also 135 bytes smaller). Code available here: http://github.com/judofyr/camping/tree/no_route_maker -- Magnus Holm
Hey, why not. I''d much prefer to at least allow a "class Name < R; end" construct Longer answer : The constants problem can also be avoided by checking it''s type. I never encountered that problem because that Controllers module is exactly there to separate the code logic. Other constants must go one level higher. Otherwise, we could scrap the modules all together an build our apps on a 1 module level. The real problem, I believe, is the late module inclusion. It makes it harder to build plugins and such. While developing the "Equipment" library, I had a weird inclusion mechanism I wish I didn''t had to do. Ruby also has some quirks regarding module inclusion into other modules and late method definition in reopened parent module. So while your patch might fix the most cases, I believe there is more work to be done here. Anyways, keep up the good work. Cheers, zimbatm
Yeah, I had to move the internal controller to the bottom, so it would include Models too. I''ve never liked the route maker, and if we can do almost the same without (and 135 bytes) it I would be happy. Do you have any plans on making Equipment Camping 2.0 ready? Is there much to do? Perhaps you could push it to GitHub? On Mon, Jun 23, 2008 at 12:17 PM, zimbatm <zimbatm at oree.ch> wrote:> Hey, why not. I''d much prefer to at least allow a "class Name < R; > end" construct > > Longer answer : > > The constants problem can also be avoided by checking it''s type. I > never encountered that problem because that Controllers module is > exactly there to separate the code logic. Other constants must go one > level higher. Otherwise, we could scrap the modules all together an > build our apps on a 1 module level. > > The real problem, I believe, is the late module inclusion. It makes it > harder to build plugins and such. While developing the "Equipment" > library, I had a weird inclusion mechanism I wish I didn''t had to do. > Ruby also has some quirks regarding module inclusion into other > modules and late method definition in reopened parent module. So while > your patch might fix the most cases, I believe there is more work to > be done here. Anyways, keep up the good work. > > Cheers, > zimbatm > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Magnus Holm
On Mon, Jun 23, 2008 at 12:16:35AM +0200, Magnus Holm wrote:> The route maker''s job is basically two things: > - Make sure that all controllers includes the right mixins > - If any controllers doesn''t respond to "urls" (aka. haven''t been inherited > from R) define "urls" as ClassName.downcase > > The first point can be accomplished within R, but not the latter. But it > should be noted that the latter also can cause some troubles.Or, maybe, instead of getting rid of #2 we could make it go a bit beyond just downcasing to help steer us away from regexps. module Blog::Controllers class Index # automatically ''/'' def get; end end class ViewN # automatically ''/view/(\d+)'' def get id; end end class ViewX # automatically ''/view/(\w+)'' def get name; end end class ViewYMD # automatically ''/view/(\d+)/(\d+)/(\d+)'' def get time; end end end _why
Man, that''s way better than removing 135 bytes! I *love* the implementation! Alright! What about releasing 2.0? I''ve closed a lot of tickets on the tracker, and I don''t think we need more for a 2.0. There is no point of waiting anymore, IMO! On Tue, Jun 24, 2008 at 12:14 AM, _why <why at whytheluckystiff.net> wrote:> On Mon, Jun 23, 2008 at 12:16:35AM +0200, Magnus Holm wrote: >> The route maker''s job is basically two things: >> - Make sure that all controllers includes the right mixins >> - If any controllers doesn''t respond to "urls" (aka. haven''t been inherited >> from R) define "urls" as ClassName.downcase >> >> The first point can be accomplished within R, but not the latter. But it >> should be noted that the latter also can cause some troubles. > > Or, maybe, instead of getting rid of #2 we could make it go a bit > beyond just downcasing to help steer us away from regexps. > > module Blog::Controllers > class Index # automatically ''/'' > def get; end > end > > class ViewN # automatically ''/view/(\d+)'' > def get id; end > end > > class ViewX # automatically ''/view/(\w+)'' > def get name; end > end > > class ViewYMD # automatically ''/view/(\d+)/(\d+)/(\d+)'' > def get time; end > end > end > > _why > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Magnus Holm
Does that mean we are losing the possinility for multiple routes per controller and such? Or should I return something magic from self.urls to make controllers function the pre-2.0 way? On Jun 24, 2008, at 1:05 PM, Magnus Holm wrote:> Alright! What about releasing 2.0? I''ve closed a lot of tickets on the > tracker, and I don''t think we need more for a 2.0. There is no point > of waiting anymore, IMO!-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20080624/6e33fd98/attachment.html>
R isn''t gone! Feel free to use both (and if you use R, it would not add more routes: module Camping::Controllers class Index;end class Advanced < R ''/(some regex'';end # /advanced will NOT route to Advanced end On Tue, Jun 24, 2008 at 3:09 PM, Julik Tarkhanov <julian.tarkhanov at gmail.com> wrote:> Does that mean we are losing the possinility for multiple routes per > controller and such? > Or should I return something magic from self.urls to make controllers > function the pre-2.0 way? > > On Jun 24, 2008, at 1:05 PM, Magnus Holm wrote: > > Alright! What about releasing 2.0? I''ve closed a lot of tickets on the > > tracker, and I don''t think we need more for a 2.0. There is no point > > of waiting anymore, IMO! > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Magnus Holm
Then I''m +1. Can''t wait to see my tests fail with 2.0 (I will obviously have to update Mosquito for the new version, although if we still have .run it should work unmodified). On Jun 24, 2008, at 3:14 PM, Magnus Holm wrote:> R isn''t gone! Feel free to use both (and if you use R, it would not > add more routes: > > module Camping::Controllers > class Index;end > class Advanced < R ''/(some regex'';end > # /advanced will NOT route to Advanced > end > > On Tue, Jun 24, 2008 at 3:09 PM, Julik Tarkhanov > <julian.tarkhanov at gmail.com> wrote: >> Does that mean we are losing the possinility for multiple routes per >> controller and such? >> Or should I return something magic from self.urls to make controllers >> function the pre-2.0 way? >> >> On Jun 24, 2008, at 1:05 PM, Magnus Holm wrote: >> >> Alright! What about releasing 2.0? I''ve closed a lot of tickets on >> the >> >> tracker, and I don''t think we need more for a 2.0. There is no point >> >> of waiting anymore, IMO! >> >> _______________________________________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/listinfo/camping-list >> > > > > -- > Magnus Holm > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list
On Tue, Jun 24, 2008 at 01:05:54PM +0200, Magnus Holm wrote:> Man, that''s way better than removing 135 bytes! I *love* the implementation!I have always wanted to use Method#to_proc in Camping.> Alright! What about releasing 2.0? I''ve closed a lot of tickets on the > tracker, and I don''t think we need more for a 2.0. There is no point > of waiting anymore, IMO!I have two things left: I need to figure out if I want to merge zimbatm''s Markaby patch. And I''d like to go through Rack a bit more myself and see if I can cut down the work we''re doing. Hopefully today or tomorrow, though! _why
Nice! You should also go through the documentation, it''s pretty bad at the moment... On Tue, Jun 24, 2008 at 5:07 PM, _why <why at whytheluckystiff.net> wrote:> On Tue, Jun 24, 2008 at 01:05:54PM +0200, Magnus Holm wrote: >> Man, that''s way better than removing 135 bytes! I *love* the implementation! > > I have always wanted to use Method#to_proc in Camping. > >> Alright! What about releasing 2.0? I''ve closed a lot of tickets on the >> tracker, and I don''t think we need more for a 2.0. There is no point >> of waiting anymore, IMO! > > I have two things left: I need to figure out if I want to merge > zimbatm''s Markaby patch. And I''d like to go through Rack a bit more > myself and see if I can cut down the work we''re doing. Hopefully > today or tomorrow, though! > > _why > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Magnus Holm
2008/6/24 _why <why at whytheluckystiff.net>:> I need to figure out if I want to merge zimbatm''s Markaby patch.These are the reasons behind the patch : * Historically Markaby was expurged to attain the 0 dependencies walhalla. Rack has changed it all * Camping apps are really nice in a 1 file setup. Markaby is the perfect match * (minor) Object#meta_def is not into camping''s source, making the code clearer One contra argument is that markaby is pretty old. Last time I checked the trunk it was in a weird state. If I remember well, it has been made Camping incompatible in favor of some Rails (!) goodness. Cheers, zimbatm
On Jun 25, 2008, at 3:18 PM, zimbatm wrote:> One contra argument is that markaby is pretty old. Last time I checked > the trunk it was in a weird state. If I remember well, > it has been made Camping incompatible in favor of some Rails (!) > goodness.Yeah, I removed Markaby from one of our Rails projects because it seemed to be leaking memory like crazy when I updated Rails. I don''t have any empirical evidence unfortunately, but I think Markaby needs a refresh in order to work properly with either Camping > 1.0 or Rails > 1.0. Manfred
I''m using Markaby a lot at present (with waves 0.7.3 currently). If it is meaningful to do so, I will gladly instrument my setup to check for memory leaks, but someone will have to tell me how to do so or point me in the right direction. Just a thought, Jerry Manfred Stienstra wrote: On Jun 25, 2008, at 3:18 PM, zimbatm wrote: One contra argument is that markaby is pretty old. Last time I checked the trunk it was in a weird state. If I remember well, it has been made Camping incompatible in favor of some Rails (!) goodness. Yeah, I removed Markaby from one of our Rails projects because it seemed to be leaking memory like crazy when I updated Rails. I don''t have any empirical evidence unfortunately, but I think Markaby needs a refresh in order to work properly with either Camping > 1.0 or Rails > 1.0. Manfred _______________________________________________ Camping-list mailing list Camping-list-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org http://rubyforge.org/mailman/listinfo/camping-list _______________________________________________ Camping-list mailing list Camping-list-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org http://rubyforge.org/mailman/listinfo/camping-list
On Jun 26, 2008, at 9:20 AM, Jerry West wrote:> I''m using Markaby a lot at present (with waves 0.7.3 currently). If > it is meaningful to do so, I will gladly instrument my setup to > check for memory leaks, but someone will have to tell me how to do > so or point me in the right direction.Cool, I meant that I noticed leaks under Rails, and haven''t checked if it was actually Markaby. If you still want to check for leaks, Evan has a pretty nice writeup about Valgrind and Ruby: http://blog.evanweaver.com/articles/2008/02/05/valgrind-and-ruby/ Manfred
On Tue, Jun 24, 2008 at 5:07 PM, _why <why at whytheluckystiff.net> wrote:> On Tue, Jun 24, 2008 at 01:05:54PM +0200, Magnus Holm wrote: > > Man, that''s way better than removing 135 bytes! I *love* the > implementation! > > I have always wanted to use Method#to_proc in Camping. > > > Alright! What about releasing 2.0? I''ve closed a lot of tickets on the > > tracker, and I don''t think we need more for a 2.0. There is no point > > of waiting anymore, IMO! > > I have two things left: I need to figure out if I want to merge > zimbatm''s Markaby patch. And I''d like to go through Rack a bit more > myself and see if I can cut down the work we''re doing. Hopefully > today or tomorrow, though! > > _why > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >Come on, you lazy interrogative! Are your shoes too heavy? :-( -- Magnus Holm -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20080703/327d6bfe/attachment.html>
On Thu, Jul 03, 2008 at 02:52:41AM +0200, Magnus Holm wrote:> Come on, you lazy interrogative! Are your shoes too heavy? :-(Bzzt! (Drawing on backup camping power grids...) Very sorry to be bad about this. Yeah, lots of Shoes stuff going on this week as we''re shooting for a July 31st release and there many bothersome bugs to smash. You''ve all done a lot of fanastic work and I say we keep working a bit longer. I just merged zimbatm''s week-old patches and I think it would be great if we could get more campers to mess with judofyr''s gems, as I think camping 2.0 will inspire some breakages. Augusttime would be better for me, but let''s talk about what you guys want to do. _why
Sure, you''re the boss. Camping is ready when you are ready! Well, I don''t have any new ideas. We just need to clean up the documentation! On Mon, Jul 7, 2008 at 6:46 PM, _why <why at whytheluckystiff.net> wrote:> On Thu, Jul 03, 2008 at 02:52:41AM +0200, Magnus Holm wrote: >> Come on, you lazy interrogative! Are your shoes too heavy? :-( > > Bzzt! (Drawing on backup camping power grids...) Very sorry to be > bad about this. Yeah, lots of Shoes stuff going on this week as > we''re shooting for a July 31st release and there many bothersome bugs > to smash. > > You''ve all done a lot of fanastic work and I say we keep working a > bit longer. I just merged zimbatm''s week-old patches and I think it > would be great if we could get more campers to mess with judofyr''s > gems, as I think camping 2.0 will inspire some breakages. > > Augusttime would be better for me, but let''s talk about what you > guys want to do. > > _why > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-- Magnus Holm