Deb Lewis
2007-Nov-19 22:44 UTC
[Masterview-devel] Contemplating an additional masterview rake task
Jeff - greetings from the swamps of endless kruft, I''m actually crawling out a bit and (finally!!!) getting back into some rails work and masterview. Got a partial fix for my long-standing bug that a parse failure needs to log better error report so you at least know what template file to fix. I''ve tested, but should see try to put together a unit test for this before I submit. Got a more ambitious fix in mind, but need to explore the implementation a bit further. Right now if you have an invalid xhtml file you''re just wedged, nothing gets generated. I''d like to add a backstop which produces a simple error-report page so when developer looks at their site they get a stubbed-out page saying "hey, go fix your template!!" rather than a missing page error. The trick is locate the mv:generate spec(s) in a page that by definition we can''t parse properly - can probably do something with regex matching, but might be interesting to allow for trying to parse with a less strict parser (say, hpricot) to produce a better broken-page placeholder. Worth exploring or not worth the effort, what do you think? How about an additional rake task mv:list_errors or mv:list_problems that specifically reports bad templates - I think that''d be useful, it''s what I think I want more often than the other flavors of list tasks I think, and it''s quite trivial to add. Quick and easy to run after you''ve done some editing and gives you immediate feedback w/out having to launch your server and watch the log. And I still owe you conversation on RailsConf proposals, now that my brain is getting ruby-ized again. One of the SDRuby guys gave a talk on haml a few weeks ago; interesting contrast, it''s off on the "let''s turn everything in the universe into ruby code" track and very diff from mv approach. ~ Deb
Jeff Barczewski
2007-Nov-20 21:56 UTC
[Masterview-devel] Contemplating an additional masterview rake task
On Nov 19, 2007 4:44 PM, Deb Lewis <djlewis at acm.org> wrote:> Jeff - greetings from the swamps of endless kruft, I''m actually > crawling out a bit and (finally!!!) getting back into some rails work > and masterview.Yay! Glad to hear it! Been swamped over here but things are looking up too :-)> > > Got a partial fix for my long-standing bug that a parse failure needs > to log better error report so you at least know what template file to > fix. I''ve tested, but should see try to put together a unit test for > this before I submit.Wonderful!!> > > Got a more ambitious fix in mind, but need to explore the > implementation a bit further. Right now if you have an invalid xhtml > file you''re just wedged, nothing gets generated. I''d like to add a > backstop which produces a simple error-report page so when developer > looks at their site they get a stubbed-out page saying "hey, go fix > your template!!" rather than a missing page error. The trick is locate > the mv:generate spec(s) in a page that by definition we can''t parse > properly - can probably do something with regex matching, but might be > interesting to allow for trying to parse with a less strict parser > (say, hpricot) to produce a better broken-page placeholder. Worth > exploring or not worth the effort, what do you think?Yeah, I can see what you mean, something that will clue them into the problem and provide as much info as possible about where the problem is at. I am going to need some css selector type functionality for the external directives work I am planning. I was originally going to look at scrapi which uses tidy under the covers, but that requires a person to have tidy installed and configured, so maybe I should look at hpricot. It appears to have much of the same selector functionality too. Is it pure ruby?, portable C? It looks like it installs from gem and has a jruby version too. I''ll try playing around with hpricot over the holidays and see if it will do what I need. It looks like it will from the documentation, but I should try some simple things to be sure. If it works out then this will be better than scrapi since tidy won''t be required or need to be configured. I am planning on using css selector semantics to be able to hook up external directives with the pure html files. So I need to locate things using that, make the changes to the element (adding masterview directive attributes) and then serialize it back to a string. This will be much better than the regex solution I was originally planning and much more powerful. So if you want to take the approach that we use hpricot to find the problem spots better, then I think that shouldn''t be a problem. Hopefully hpricot will be the solution for my css selector needs as well.> > > How about an additional rake task mv:list_errors or mv:list_problems > that specifically reports bad templates - I think that''d be useful, > it''s what I think I want more often than the other flavors of list > tasks I think, and it''s quite trivial to add. Quick and easy to run > after you''ve done some editing and gives you immediate feedback w/out > having to launch your server and watch the log.Absolutely! That would be a great idea! James Britt had some additional things that he would do to find problems in advance so we might borrow some of his ideas. He''s supposed to send me the script of things he would do. I''ll forward it when I get it.> > > And I still owe you conversation on RailsConf proposals, now that my > brain is getting ruby-ized again. One of the SDRuby guys gave a talk > on haml a few weeks ago; interesting contrast, it''s off on the "let''s > turn everything in the universe into ruby code" track and very diff > from mv approach.Yeah, we actually had a guy do it last month at our Ruby meeting. If I was going to be coding up html from scratch, haml looks like a decent way to go, but boy I would not want to hand code up anything very complicated these days. (and the reverse engineering to haml works for simple things but has issues when getting into complicated html and javascript) So different things for different approaches. I''d certainly consider using it for hand building simple html. Yeah, lets start working up the ideas for RailsConf. So let''s think about it and discuss further when we have a chance. Have a blessed Thanksgiving!! Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/masterview-devel/attachments/20071120/e1026a61/attachment.html