From kingdon at panix.com Sun Jun 1 01:19:15 2008 From: kingdon at panix.com (Jim Kingdon) Date: Sun, 1 Jun 2008 01:19:15 -0400 (EDT) Subject: [Erector-devel] Going to switch @doc to use an IO stream In-Reply-To: <1d7ddd110805311546y66dcb8f6ud71dcb727c7c6480@mail.gmail.com> (brian.takita@gmail.com) References: <1d7ddd110805311428i1183afd5o4628e6118acb2c2a@mail.gmail.com> <1d7ddd110805311546y66dcb8f6ud71dcb727c7c6480@mail.gmail.com> Message-ID: <20080601051915.BA638241F8@panix5.panix.com> > > FYI, I'd like to switch @doc to be an IO stream. > > I hope there aren't breakages from this. :) Other than needing to add rr to geminstaller.yml (which I have done), I haven't noticed problems yet (not that I've done more than run the erector tests and glance over some of the code, though). From kingdon at panix.com Sun Jun 1 17:46:30 2008 From: kingdon at panix.com (Jim Kingdon) Date: Sun, 1 Jun 2008 17:46:30 -0400 (EDT) Subject: [Erector-devel] current status of Erector In-Reply-To: <7a93bd340805310658n2970e992xa60762ada05e76c2@mail.gmail.com> (alex@pivotallabs.com) References: <8d0d70270805281413y4fc10f02i72289260a65728fb@mail.gmail.com> <1d7ddd110805281625j6a054c7emc11188d9ee7a38fb@mail.gmail.com> <7a93bd340805281654p69feb18ak19b98c28dc546c98@mail.gmail.com> <8d0d70270805281824q15c305cal7b3ab1dca93308f1@mail.gmail.com> <7a93bd340805290958t36b04fdfu19628766d97b2ec2@mail.gmail.com> <20080531055132.9F787241FF@panix5.panix.com> <7a93bd340805310658n2970e992xa60762ada05e76c2@mail.gmail.com> Message-ID: <20080601214630.249F6241B5@panix5.panix.com> > Here's all the docs we have on mixing layouts and templates from different > systems: > http://erector.rubyforge.org/userguide.html#layoutinheritance Thanks for reminding me of that. I have tried this (by having erect turn "yield" into "@content" - my changes are checked in but commented out as they didn't work). I ran erect on Rails 2.0.2 scaffolding. But content seemed to be empty (that is, the layout rendered but not app/views//show.rb). I tried both @content and "content" (combined with attr_accessor :content further up the file) and got the same result. I haven't further tried to debug what is going on. From kingdon at panix.com Sun Jun 1 18:07:37 2008 From: kingdon at panix.com (Jim Kingdon) Date: Sun, 1 Jun 2008 18:07:37 -0400 (EDT) Subject: [Erector-devel] layouts Message-ID: <20080601220737.84DE0241B5@panix5.panix.com> > http://erector.rubyforge.org/userguide.html#layoutinheritance Oh, now that I look at this more closely I sort of see what I'm supposed to do. I'm supposed to change something else (I'm not sure I followed where) to set .content. Sounds like a workaround as much as a fix, although I'm not sure I understand it well enough to really say. From kingdon at panix.com Mon Jun 2 00:25:52 2008 From: kingdon at panix.com (Jim Kingdon) Date: Mon, 2 Jun 2008 00:25:52 -0400 (EDT) Subject: [Erector-devel] Erector bug (... don't know how else to submit it) In-Reply-To: <82c457760805311627t4c12cb9ei622cd7d5b8f747c3@mail.gmail.com> (nick@pivotalsf.com) References: <7a93bd340805300821i7f3d9f2aie4bf100ce3db9236@mail.gmail.com> <1d7ddd110805301717u135198d5j9b5428d731473f44@mail.gmail.com> <20080531033548.1D1FE241FF@panix5.panix.com> <1d7ddd110805311220r3f63c61eh1bc8a462f9ea3ff9@mail.gmail.com> <82c457760805311627t4c12cb9ei622cd7d5b8f747c3@mail.gmail.com> Message-ID: <20080602042552.C4990241B5@panix5.panix.com> Nick writes: > Perhaps you guys are unaware of the various deliberations that were > had that motivated some of the original designs of Erector? The goal of this discussion is to get those things properly recorded, for example in documentation, specs, and examples. If it isn't already obvious, I'll proclaim it loudly: I don't understand all the rationales, and want clarification not just for me, but for potential users of erector too. > Subwidgets are done by composition largely because they may need to maintain > state, form builders are the principal example; > > form_for @user do > textarea :name > end What state does this maintain? The version I'm familiar with looks like: form_for @user do |form_builder| form_builder.textarea :name end (does this one maintain state other than via the form_builder object? I've had good results passing around the form_builder to whereever it makes sense to pass it). > A disadvantage of your block example is that you can put a 'block' outside > of a block; Do you mean outside of a "blocks"? How does the #widget solution prevent this? block outside blocks seems to work fine in the following #widget example: Index: examples/blocks-via-widget.rb =================================================================== --- examples/blocks-via-widget.rb (revision 135) +++ examples/blocks-via-widget.rb (working copy) @@ -43,6 +43,14 @@ end end end + + div :class => 'a_div_to_contain_block' do + widget Block, :title => "Block 3", :behaviors => 'other_buttons' do + div do + text "and here is a Block not in Blocks" + end + end + end end > And you can't namespace these things; a block in another context can't have > another meaning. Sorry, I'm not getting what "namespace" and "context" mean here. I can think of a lot of ways to namespace methods which don't involve #widget (inheritance hierarchies, mixing in different mixins different places, and more complicated tricks), but there might be some advantage of #widget which I'm not seeing. > I'm not married to any particular technique... if the > metaprogramming is too sophisticated to maintain, let's remove it. As for what I don't like about #widget, it isn't just the (already mentioned) downsides of method_missing, there is also the @parent instance variable, and the way that "super" is hacked ^W abused ^W cleverly employed. But I haven't formed any firm opinion. I don't have enough clarity (yet) about what #widget gets us. From kingdon at panix.com Tue Jun 3 01:21:40 2008 From: kingdon at panix.com (Jim Kingdon) Date: Tue, 3 Jun 2008 01:21:40 -0400 (EDT) Subject: [Erector-devel] regressions Message-ID: <20080603052140.819FB241B5@panix5.panix.com> Sorry, Nick, I wanted to respond to your interesting message, but instead I got bogged down in the following problems trying to come up with examples and specs and such for various #widget cases. 1. Sometime between revision 118 and revision 136, the widget method stopped working (the symptom seems to vary a bit depending on what I do, but in examples/blocks-via-widget.rb the ul start and end tags get output at the end, instead of producing the same output as examples/blocks-via-methods.rb). 2. If I update to revision 141 and run "ruby spec/spec_suite.rb" I get the following error: ./spec/erector/widget_spec.rb:26:in `send': undefined method `invokes #render and returns the string representation of the rendered widget' for Test::Unit::TestCase::Subclass_11:Class (NoMethodError) from ./spec/erector/widget_spec.rb:26 from /usr/lib/ruby/gems/1.8/gems/rspec-1.1.3/lib/spec/example/example_group_methods.rb:40:in `module_eval' [many more lines of stack trace omitted] Does #2 have something to do with rspec versions or something? #2 also happens if I run the tests via the command "rake" (with no arguments). 3. More minor (I think), but based on reading the commit messages, the build seems to have been broken between revisions 138 and 140. The reason I think this is minor is that it looks like an artifact of git-svn, although it would appear that there was a 30 second window during which someone could have gotten a bad update. From brian.takita at gmail.com Tue Jun 3 03:10:01 2008 From: brian.takita at gmail.com (Brian Takita) Date: Tue, 3 Jun 2008 00:10:01 -0700 Subject: [Erector-devel] regressions In-Reply-To: <20080603052140.819FB241B5@panix5.panix.com> References: <20080603052140.819FB241B5@panix5.panix.com> Message-ID: <1d7ddd110806030010m39314a45vc66471ecac26e4c@mail.gmail.com> On Mon, Jun 2, 2008 at 10:21 PM, Jim Kingdon wrote: > Sorry, Nick, I wanted to respond to your interesting message, but > instead I got bogged down in the following problems trying to come up > with examples and specs and such for various #widget cases. > > 1. Sometime between revision 118 and revision 136, the widget method > stopped working (the symptom seems to vary a bit depending on what > I do, but in examples/blocks-via-widget.rb the ul start and end > tags get output at the end, instead of producing the same output > as examples/blocks-via-methods.rb). This probably has to do with the change from the array approach to using an IO stream. > > 2. If I update to revision 141 and run "ruby spec/spec_suite.rb" > I get the following error: > > ./spec/erector/widget_spec.rb:26:in `send': undefined method `invokes > #render and returns the string representation of the rendered widget' > for Test::Unit::TestCase::Subclass_11:Class (NoMethodError) > from ./spec/erector/widget_spec.rb:26 > from > /usr/lib/ruby/gems/1.8/gems/rspec-1.1.3/lib/spec/example/example_group_methods.rb:40:in > `module_eval' > [many more lines of stack trace omitted] I'm not sure why its failing for you. Try upgrading rspec. > > Does #2 have something to do with rspec versions or something? #2 > also happens if I run the tests via the command "rake" (with no > arguments). > > 3. More minor (I think), but based on reading the commit messages, > the build seems to have been broken between revisions 138 and > 140. The reason I think this is minor is that it looks like an > artifact of git-svn, although it would appear that there was a 30 > second window during which someone could have gotten a bad update. I checked in a broken build for a couple of revisions. I didn't merge the commits before committing it back to svn. I can try to do that next time. > _______________________________________________ > Erector-devel mailing list > Erector-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/erector-devel > From brian.takita at gmail.com Tue Jun 3 03:36:50 2008 From: brian.takita at gmail.com (Brian Takita) Date: Tue, 3 Jun 2008 00:36:50 -0700 Subject: [Erector-devel] regressions In-Reply-To: <1d7ddd110806030010m39314a45vc66471ecac26e4c@mail.gmail.com> References: <20080603052140.819FB241B5@panix5.panix.com> <1d7ddd110806030010m39314a45vc66471ecac26e4c@mail.gmail.com> Message-ID: <1d7ddd110806030036i2fb88ba4yb50d741ec053dc2b@mail.gmail.com> On Tue, Jun 3, 2008 at 12:10 AM, Brian Takita wrote: > On Mon, Jun 2, 2008 at 10:21 PM, Jim Kingdon wrote: >> Sorry, Nick, I wanted to respond to your interesting message, but >> instead I got bogged down in the following problems trying to come up >> with examples and specs and such for various #widget cases. >> >> 1. Sometime between revision 118 and revision 136, the widget method >> stopped working (the symptom seems to vary a bit depending on what >> I do, but in examples/blocks-via-widget.rb the ul start and end >> tags get output at the end, instead of producing the same output >> as examples/blocks-via-methods.rb). > This probably has to do with the change from the array approach to > using an IO stream. This should be fixed in rev. 145. >> >> 2. If I update to revision 141 and run "ruby spec/spec_suite.rb" >> I get the following error: >> >> ./spec/erector/widget_spec.rb:26:in `send': undefined method `invokes >> #render and returns the string representation of the rendered widget' >> for Test::Unit::TestCase::Subclass_11:Class (NoMethodError) >> from ./spec/erector/widget_spec.rb:26 >> from >> /usr/lib/ruby/gems/1.8/gems/rspec-1.1.3/lib/spec/example/example_group_methods.rb:40:in >> `module_eval' >> [many more lines of stack trace omitted] > I'm not sure why its failing for you. Try upgrading rspec. >> >> Does #2 have something to do with rspec versions or something? #2 >> also happens if I run the tests via the command "rake" (with no >> arguments). >> >> 3. More minor (I think), but based on reading the commit messages, >> the build seems to have been broken between revisions 138 and >> 140. The reason I think this is minor is that it looks like an >> artifact of git-svn, although it would appear that there was a 30 >> second window during which someone could have gotten a bad update. > I checked in a broken build for a couple of revisions. I didn't merge > the commits before committing it back to svn. I can try to do that > next time. >> _______________________________________________ >> Erector-devel mailing list >> Erector-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/erector-devel >> > From brian.takita at gmail.com Tue Jun 3 03:54:09 2008 From: brian.takita at gmail.com (Brian Takita) Date: Tue, 3 Jun 2008 00:54:09 -0700 Subject: [Erector-devel] Partial Templates Message-ID: <1d7ddd110806030054s307928bfh875e301abee28b1d@mail.gmail.com> So I checked in an implementation for partials. The solution that I came up with is the partial Erector object will define a #render_partial method. So in the case where there is both: show.html.rb class Views::User::Show < Erector::Widget do def render ... end end _show.html.rb class Views::User::Show < Erector::Widget do def render_partial ... end end The Widget#to_s method also can take an argument that is the render method name. So, to render using #render_partial, one would call: Views::User::Show.new.to_s(:render_partial) What do you all think? From alex at pivotallabs.com Tue Jun 3 11:19:44 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Tue, 3 Jun 2008 08:19:44 -0700 Subject: [Erector-devel] Partial Templates In-Reply-To: <1d7ddd110806030054s307928bfh875e301abee28b1d@mail.gmail.com> References: <1d7ddd110806030054s307928bfh875e301abee28b1d@mail.gmail.com> Message-ID: <7a93bd340806030819r2baa29frd3b39b5b92648e5e@mail.gmail.com> I already implemented support for old-fashioned partials via render :partial... It has some gaps but mostly works. Did you look at that? On Tue, Jun 3, 2008 at 12:54 AM, Brian Takita wrote: > So I checked in an implementation for partials. > > The solution that I came up with is the partial Erector object will > define a #render_partial method. > > So in the case where there is both: > show.html.rb > class Views::User::Show < Erector::Widget do > def render > ... > end > end > > _show.html.rb > class Views::User::Show < Erector::Widget do > def render_partial > ... > end > end > > The Widget#to_s method also can take an argument that is the render method > name. > So, to render using #render_partial, one would call: > Views::User::Show.new.to_s(:render_partial) > > What do you all think? > _______________________________________________ > Erector-devel mailing list > Erector-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/erector-devel > -- Alex Chaffee alexch at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.takita at gmail.com Wed Jun 4 00:17:48 2008 From: brian.takita at gmail.com (Brian Takita) Date: Tue, 3 Jun 2008 21:17:48 -0700 Subject: [Erector-devel] Partial Templates In-Reply-To: <7a93bd340806030819r2baa29frd3b39b5b92648e5e@mail.gmail.com> References: <1d7ddd110806030054s307928bfh875e301abee28b1d@mail.gmail.com> <7a93bd340806030819r2baa29frd3b39b5b92648e5e@mail.gmail.com> Message-ID: <1d7ddd110806032117k4ec4f78dwaf4603411b32c44c@mail.gmail.com> On Tue, Jun 3, 2008 at 8:19 AM, Alex Chaffee wrote: > I already implemented support for old-fashioned partials via render > :partial... It has some gaps but mostly works. Did you look at that? I modified the TemplateHandler to call render_partial for the loaded object. The reason is there is an ambiguity when there is a partial template and a normal template with the same names. For example if there is both a show.html.rb and _show.html.rb, then this ambiguity occurs. Whats nice about the #render_partial method solution is that we don't have to give the partial widget a different class name, like ShowPartial. It just reopens the class and defines the method. In the docs, we could recommend not using partial widgets, because we have the OO facilities of Ruby. > > > On Tue, Jun 3, 2008 at 12:54 AM, Brian Takita > wrote: >> >> So I checked in an implementation for partials. >> >> The solution that I came up with is the partial Erector object will >> define a #render_partial method. >> >> So in the case where there is both: >> show.html.rb >> class Views::User::Show < Erector::Widget do >> def render >> ... >> end >> end >> >> _show.html.rb >> class Views::User::Show < Erector::Widget do >> def render_partial >> ... >> end >> end >> >> The Widget#to_s method also can take an argument that is the render method >> name. >> So, to render using #render_partial, one would call: >> Views::User::Show.new.to_s(:render_partial) >> >> What do you all think? >> _______________________________________________ >> Erector-devel mailing list >> Erector-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/erector-devel > > > > -- > Alex Chaffee > alexch at gmail.com From brian.takita at gmail.com Wed Jun 4 00:24:01 2008 From: brian.takita at gmail.com (Brian Takita) Date: Tue, 3 Jun 2008 21:24:01 -0700 Subject: [Erector-devel] Partial Templates In-Reply-To: <1d7ddd110806032117k4ec4f78dwaf4603411b32c44c@mail.gmail.com> References: <1d7ddd110806030054s307928bfh875e301abee28b1d@mail.gmail.com> <7a93bd340806030819r2baa29frd3b39b5b92648e5e@mail.gmail.com> <1d7ddd110806032117k4ec4f78dwaf4603411b32c44c@mail.gmail.com> Message-ID: <1d7ddd110806032124i20a2109fvb35c7907479b632b@mail.gmail.com> In Tue, Jun 3, 2008 at 9:17 PM, Brian Takita wrote: > On Tue, Jun 3, 2008 at 8:19 AM, Alex Chaffee wrote: >> I already implemented support for old-fashioned partials via render >> :partial... It has some gaps but mostly works. Did you look at that? > I modified the TemplateHandler to call render_partial for the loaded object. > > The reason is there is an ambiguity when there is a partial template > and a normal template with the same names. > For example if there is both a show.html.rb and _show.html.rb, then > this ambiguity occurs. > > Whats nice about the #render_partial method solution is that we don't > have to give the partial widget a different class name, like > ShowPartial. It just reopens the class and defines the method. > > In the docs, we could recommend not using partial widgets, because we > have the OO facilities of Ruby. I also monkey patched ActionView::Base#render_partial to set @is_partial_template to true. I also added ActionView#Base#is_partial_template? Hopefully this will cause the correct template to be loaded when there is a template and a partial template with the same base name. >> >> >> On Tue, Jun 3, 2008 at 12:54 AM, Brian Takita >> wrote: >>> >>> So I checked in an implementation for partials. >>> >>> The solution that I came up with is the partial Erector object will >>> define a #render_partial method. >>> >>> So in the case where there is both: >>> show.html.rb >>> class Views::User::Show < Erector::Widget do >>> def render >>> ... >>> end >>> end >>> >>> _show.html.rb >>> class Views::User::Show < Erector::Widget do >>> def render_partial >>> ... >>> end >>> end >>> >>> The Widget#to_s method also can take an argument that is the render method >>> name. >>> So, to render using #render_partial, one would call: >>> Views::User::Show.new.to_s(:render_partial) >>> >>> What do you all think? >>> _______________________________________________ >>> Erector-devel mailing list >>> Erector-devel at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/erector-devel >> >> >> >> -- >> Alex Chaffee >> alexch at gmail.com > From kingdon at panix.com Thu Jun 5 00:48:18 2008 From: kingdon at panix.com (Jim Kingdon) Date: Thu, 5 Jun 2008 00:48:18 -0400 (EDT) Subject: [Erector-devel] regressions In-Reply-To: <1d7ddd110806030036i2fb88ba4yb50d741ec053dc2b@mail.gmail.com> (brian.takita@gmail.com) References: <20080603052140.819FB241B5@panix5.panix.com> <1d7ddd110806030010m39314a45vc66471ecac26e4c@mail.gmail.com> <1d7ddd110806030036i2fb88ba4yb50d741ec053dc2b@mail.gmail.com> Message-ID: <20080605044818.58FA6241B5@panix5.panix.com> > >> 1. Sometime between revision 118 and revision 136, the widget method > >> stopped working . . . > > This probably has to do with the change from the array approach to > > using an IO stream. > This should be fixed in rev. 145. Yes, this work for me now. Thanks for the fix. From kingdon at panix.com Thu Jun 5 00:49:27 2008 From: kingdon at panix.com (Jim Kingdon) Date: Thu, 5 Jun 2008 00:49:27 -0400 (EDT) Subject: [Erector-devel] regressions In-Reply-To: <1d7ddd110806030010m39314a45vc66471ecac26e4c@mail.gmail.com> (brian.takita@gmail.com) References: <20080603052140.819FB241B5@panix5.panix.com> <1d7ddd110806030010m39314a45vc66471ecac26e4c@mail.gmail.com> Message-ID: <20080605044927.74417241B5@panix5.panix.com> > > ./spec/erector/widget_spec.rb:26:in `send': undefined method `invokes > > #render and returns the string representation of the rendered widget' > > I'm not sure why its failing for you. Try upgrading rspec. Yes, switching to rspec 1.1.4 (as now specified in geminstaller.yml) fixes this problem. Thanks. From kingdon at panix.com Thu Jun 5 01:56:10 2008 From: kingdon at panix.com (Jim Kingdon) Date: Thu, 5 Jun 2008 01:56:10 -0400 (EDT) Subject: [Erector-devel] Erector bug (... don't know how else to submit it) In-Reply-To: <82c457760806021226u93af6fm224532d2068c9e54@mail.gmail.com> (nick@pivotalsf.com) References: <7a93bd340805300821i7f3d9f2aie4bf100ce3db9236@mail.gmail.com> <1d7ddd110805301717u135198d5j9b5428d731473f44@mail.gmail.com> <20080531033548.1D1FE241FF@panix5.panix.com> <1d7ddd110805311220r3f63c61eh1bc8a462f9ea3ff9@mail.gmail.com> <82c457760805311627t4c12cb9ei622cd7d5b8f747c3@mail.gmail.com> <20080602042552.C4990241B5@panix5.panix.com> <82c457760806021226u93af6fm224532d2068c9e54@mail.gmail.com> Message-ID: <20080605055610.98362241B5@panix5.panix.com> > Instead, code would look like Markaby: > > form_for @user do > textarea :name > end Ah, OK, but this hasn't (yet) been implemented in Erector, right? (At least, I didn't see anything checked into the erector project). One of the things which makes it hard to talk about this kind of thing is that there isn't a standard set of erector widgets (with the possible exception of http://erector.rubyforge.org/svn/trunk/lib/erector/widgets/table.rb ). But the above form_for isn't the rails one (unless fake_erbout is capable of more than I thought). > And it should also be possible to have `block` have differing meanings > depending on context: I have attempted to complete this example at http://erector.rubyforge.org/svn/trunk/examples/nesting-determines-meaning.rb > This last is designed principally to support things like having multiple > form builders working in parallel -- various implementation of textarea -- > and so forth. One form builder might be table style, another dl/dt style, > another div style, etc.. Does that make sense? In the sense that I now better understand it, yes. I think I'd need more experience with it to decide whether I would prefer to write code that way. I can think of virtues (e.g. easy to switch from tables to divs or back), and costs (e.g. easier to get lost about what a method means in this particular context), and only trying it out in a real project would give me a better idea of which things would outweigh the others. > bar # note the call to bar here. Because of the > instance_eval'ing, you need "magic" to make this work. Yeah, thanks. This looks like the same case that Alex added to http://erector.rubyforge.org/svn/trunk/examples/blocks-via-widget.rb (in that example, the username method). I think this case might be missing from the specs. > The implement details may no longer be relevant going forward, given > the obvious difference in direction you guys want to go with Erector. Well, with respect to #widget there doesn't seem to be a consensus one way or the other. If "obvious difference in direction" means other things, like Rails integration, I'm also not sure it is "obvious" what the direction is. One of the pushes lately has been to separate out the rails stuff from the core. But I shouldn't belabor a point which I'm not even sure you were making. From kingdon at panix.com Fri Jun 6 01:57:36 2008 From: kingdon at panix.com (Jim Kingdon) Date: Fri, 6 Jun 2008 01:57:36 -0400 (EDT) Subject: [Erector-devel] indentation code checked in Message-ID: <20080606055736.D2DD6241B5@panix5.panix.com> I've checked in a first pass at indentation code. You need to enable it (at least for now) with a call to add_newlines for example: Erector::Widget.new() do p "foo" p "bar" end.add_newlines(true).to_s.should == "

foo

\n

bar

\n" The indentation algorithms are mostly taken from http://webiyo.sf.net/ (with a little bit of tweaking). Take a look. We'll need to make a decision about whether to enable this by default and/or provide different ways of turning it on. I put in documentation calling it experimental, so we should feel free to change the API or the behavior quite freely at this point. I'm guessing we'll always want some way of turning it off, for people who want to save every possible byte. I was pretty strict about not adding any lines of code unless I had a failing test. So that is why there are some places where @at_start_of_line isn't set where one might expect it. Perhaps I was a bit too strict about that rule, or unimaginative in terms of thinking up new tests to write. On the happy side, it worked very nicely to keep the indentation code in doc.rb. The only change to widget.rb was passing along the flag for whether to enable indentation. From brian.takita at gmail.com Sun Jun 8 03:53:25 2008 From: brian.takita at gmail.com (Brian Takita) Date: Sun, 8 Jun 2008 00:53:25 -0700 Subject: [Erector-devel] erector/rails renders directly to _erbout Message-ID: <1d7ddd110806080053q6a4068edpae7deacc9abbf95a@mail.gmail.com> I implemented Jim's suggestion to use the _erbout string of the ActionView#Base object. It seems Rails integration is now much better. Hopefully we will see some positive results on projects using Erector. From brian at pivotallabs.com Sun Jun 8 22:14:22 2008 From: brian at pivotallabs.com (Brian Takita) Date: Sun, 8 Jun 2008 19:14:22 -0700 Subject: [Erector-devel] Erector should now be much more compatible with Rails Message-ID: <1d7ddd110806081914i5dc451cdw62ba56120f33ea14@mail.gmail.com> Here are the latest changes on Erector: * Widget#doc is now a HtmlParts which proxies to the passed in IO stream * Better compatibility with standard Rails rendering because ActionController::Base#render and #render_widget now have the Widget write directly to _erbout. * ActionView::Base objects run with Erector now receive all of the instance variables * Erector works with erb layouts * Deprecate fake_erbout * Better handling for file with .html.rb extension Also since each widget is writing directly to _erbout, you no longer need to call to_s very often. For example, if you want to use a widget from erb: <% widget(Views::Users::Show, :user => @user) %> While there are tests, I'd like to see how this works for the projects using Erector. From alex at pivotallabs.com Fri Jun 13 17:52:10 2008 From: alex at pivotallabs.com (Alex Chaffee) Date: Fri, 13 Jun 2008 17:52:10 -0400 Subject: [Erector-devel] Three Little Problems Message-ID: <7a93bd340806131452k35f4a441pdb74b07a3f86776@mail.gmail.com> 1. With the latest version of erector, my app no longer finds view files (named foo.rb -- haven't tried renaming them to .html.rb but I shouldn't have to). 2. The test suite fails if Rails 2.1.0 is not installed. 3. form_for :model fails... use form_for @model instead. Should be easy to resolve (at least the first 2)... wanted to report them first. -- Alex Chaffee alexch at gmail.com From brian.takita at gmail.com Fri Jun 13 18:15:31 2008 From: brian.takita at gmail.com (Brian Takita) Date: Fri, 13 Jun 2008 15:15:31 -0700 Subject: [Erector-devel] Three Little Problems In-Reply-To: <7a93bd340806131452k35f4a441pdb74b07a3f86776@mail.gmail.com> References: <7a93bd340806131452k35f4a441pdb74b07a3f86776@mail.gmail.com> Message-ID: <1d7ddd110806131515l17ae1791n74a168be1f322be1@mail.gmail.com> On Fri, Jun 13, 2008 at 2:52 PM, Alex Chaffee wrote: > 1. With the latest version of erector, my app no longer finds view > files (named foo.rb -- haven't tried renaming them to .html.rb but I > shouldn't have to). > 2. The test suite fails if Rails 2.1.0 is not installed. Try running rake install_dependencies This will check out the Rails git repo and install Rails 2.1, 2.0.2, and 1.99 You can then run tests on whatever versions of Rails we wish to support. > 3. form_for :model fails... use form_for @model instead. > > Should be easy to resolve (at least the first 2)... wanted to report them first. > > -- > Alex Chaffee > alexch at gmail.com > _______________________________________________ > Erector-devel mailing list > Erector-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/erector-devel > From brian.takita at gmail.com Fri Jun 13 18:28:55 2008 From: brian.takita at gmail.com (Brian Takita) Date: Fri, 13 Jun 2008 15:28:55 -0700 Subject: [Erector-devel] I'm going to delete erector.iml Message-ID: <1d7ddd110806131528v51cae70dv2ed3d2e9b62adeee@mail.gmail.com> I deleted erector.iml file because its frequently causes merge conflicts for me. Please recreate locally and set it to be ignored. Thanks, Brian From brian.takita at gmail.com Sat Jun 14 15:27:54 2008 From: brian.takita at gmail.com (Brian Takita) Date: Sat, 14 Jun 2008 12:27:54 -0700 Subject: [Erector-devel] Three Little Problems In-Reply-To: <1d7ddd110806131515l17ae1791n74a168be1f322be1@mail.gmail.com> References: <7a93bd340806131452k35f4a441pdb74b07a3f86776@mail.gmail.com> <1d7ddd110806131515l17ae1791n74a168be1f322be1@mail.gmail.com> Message-ID: <1d7ddd110806141227v108f576eq807997f8f2659f5f@mail.gmail.com> On Fri, Jun 13, 2008 at 3:15 PM, Brian Takita wrote: > On Fri, Jun 13, 2008 at 2:52 PM, Alex Chaffee wrote: >> 1. With the latest version of erector, my app no longer finds view >> files (named foo.rb -- haven't tried renaming them to .html.rb but I >> shouldn't have to). Are you using Rails 2.0.2? >> 2. The test suite fails if Rails 2.1.0 is not installed. > Try running rake install_dependencies > This will check out the Rails git repo and install Rails 2.1, 2.0.2, and 1.99 > > You can then run tests on whatever versions of Rails we wish to support. >> 3. form_for :model fails... use form_for @model instead. Thats kindof surprising, since the instance variables should be assigned in the ActionView::Base object. >> >> Should be easy to resolve (at least the first 2)... wanted to report them first. >> >> -- >> Alex Chaffee >> alexch at gmail.com >> _______________________________________________ >> Erector-devel mailing list >> Erector-devel at rubyforge.org >> http://rubyforge.org/mailman/listinfo/erector-devel >> > From kingdon at panix.com Sat Jun 14 22:11:11 2008 From: kingdon at panix.com (Jim Kingdon) Date: Sat, 14 Jun 2008 22:11:11 -0400 (EDT) Subject: [Erector-devel] I'm going to delete erector.iml In-Reply-To: <1d7ddd110806131528v51cae70dv2ed3d2e9b62adeee@mail.gmail.com> (brian.takita@gmail.com) References: <1d7ddd110806131528v51cae70dv2ed3d2e9b62adeee@mail.gmail.com> Message-ID: <20080615021111.9038D241BB@panix5.panix.com> > I deleted erector.iml file because its frequently causes merge > conflicts for me. Good idea. Just checking in erector.ipr has generally seemed to work better for me. From kingdon at panix.com Sat Jun 14 22:35:32 2008 From: kingdon at panix.com (Jim Kingdon) Date: Sat, 14 Jun 2008 22:35:32 -0400 (EDT) Subject: [Erector-devel] Three Little Problems In-Reply-To: <1d7ddd110806131515l17ae1791n74a168be1f322be1@mail.gmail.com> (brian.takita@gmail.com) References: <7a93bd340806131452k35f4a441pdb74b07a3f86776@mail.gmail.com> <1d7ddd110806131515l17ae1791n74a168be1f322be1@mail.gmail.com> Message-ID: <20080615023532.809E0241BB@panix5.panix.com> > Try running rake install_dependencies This doesn't work for me. Here's an edited transcript (If I cut out something important, I can provide the whole thing, but was hoping to make things more concise): $ rm -fr spec/rails_root/vendor/ $ rake install_dependencies . . . [seems to work] Previous HEAD position was c8da518... Tagged Rails 2.0.2 Switched to branch "master" $ rake . . . [output from the non-rails tests] 130 examples, 0 failures, 5 pending ./spec/../lib/erector/rails/supported_rails_versions.rb:7: warning: already initialized constant SUPPORTED_RAILS_VERSIONS Running rails_spec_suite for Rails version 2.1.0 ln: creating symbolic link `/home/kingdon/zwork/erector/spec/rails_root/spec/../config/../vendor/plugins/erector': No such file or directory /home/kingdon/zwork/erector/spec/rails_root/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:275:in `load_missing_constant': uninitialized constant ActionView::TemplateHandlers::Erector (NameError) . . . rake aborted! Failed for version 2.1.0 /home/kingdon/zwork/erector/Rakefile:46 From brian.takita at gmail.com Sun Jun 15 14:23:37 2008 From: brian.takita at gmail.com (Brian Takita) Date: Sun, 15 Jun 2008 11:23:37 -0700 Subject: [Erector-devel] Three Little Problems In-Reply-To: <20080615023532.809E0241BB@panix5.panix.com> References: <7a93bd340806131452k35f4a441pdb74b07a3f86776@mail.gmail.com> <1d7ddd110806131515l17ae1791n74a168be1f322be1@mail.gmail.com> <20080615023532.809E0241BB@panix5.panix.com> Message-ID: <1d7ddd110806151123k100b6644rad02437cc03b2d14@mail.gmail.com> Jim, can you post your output to http://pastie.caboo.se Thanks, Brian On Sat, Jun 14, 2008 at 7:35 PM, Jim Kingdon wrote: >> Try running rake install_dependencies > > This doesn't work for me. Here's an edited transcript (If I cut out > something important, I can provide the whole thing, but was hoping to > make things more concise): > > $ rm -fr spec/rails_root/vendor/ > $ rake install_dependencies > . . . [seems to work] > Previous HEAD position was c8da518... Tagged Rails 2.0.2 > Switched to branch "master" > $ rake > . . . [output from the non-rails tests] > 130 examples, 0 failures, 5 pending > ./spec/../lib/erector/rails/supported_rails_versions.rb:7: warning: > already initialized constant SUPPORTED_RAILS_VERSIONS > Running rails_spec_suite for Rails version 2.1.0 > ln: creating symbolic link > `/home/kingdon/zwork/erector/spec/rails_root/spec/../config/../vendor/plugins/erector': > No such file or directory > /home/kingdon/zwork/erector/spec/rails_root/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:275:in > `load_missing_constant': uninitialized constant > ActionView::TemplateHandlers::Erector (NameError) > . . . > rake aborted! > Failed for version 2.1.0 > /home/kingdon/zwork/erector/Rakefile:46 > From m.kristian at web.de Sun Jun 29 15:07:30 2008 From: m.kristian at web.de (kristian) Date: Mon, 30 Jun 2008 00:37:30 +0530 Subject: [Erector-devel] problems with form_for Message-ID: <932801940806291207i39ad56g22e281a324f98d9@mail.gmail.com> hello, I hope this is the right way to send a patch. my story is that I wanted to upgrade rails from 2.0.2 to 2.1.0 and markaby gave me some problems. than I came across erector and I immediately liked the OO approach. so I gave it a trial, but I ran into problems with form_for which is used a lot in my application. so dug into the code and found a simple patch. I did not test it with other version since I do not understand your current implementation completely - I might have missed something. the patch works for me using rails 2.1.0. in case your are interested tell me where I can post the patch. I also setup a resource generator creating nice classes for a restful resource in rails. any interest ? with regards Kristian From brian.takita at gmail.com Mon Jun 30 20:35:47 2008 From: brian.takita at gmail.com (Brian Takita) Date: Mon, 30 Jun 2008 17:35:47 -0700 Subject: [Erector-devel] problems with form_for In-Reply-To: <932801940806291207i39ad56g22e281a324f98d9@mail.gmail.com> References: <932801940806291207i39ad56g22e281a324f98d9@mail.gmail.com> Message-ID: <1d7ddd110806301735w6524e46fide236d367f52e9db@mail.gmail.com> On Sun, Jun 29, 2008 at 12:07 PM, kristian wrote: > hello, Hello Kristian, > > I hope this is the right way to send a patch. > > my story is that I wanted to upgrade rails from 2.0.2 to 2.1.0 and > markaby gave me some problems. than I came across erector and I > immediately liked the OO approach. so I gave it a trial, but I ran > into problems with form_for which is used a lot in my application. > > so dug into the code and found a simple patch. I did not test it with > other version since I do not understand your current implementation > completely - I might have missed something. the patch works for me > using rails 2.1.0. in case your are interested tell me where I can > post the patch. Thank you for giving Erector a try. I hope its going well for you. Also, thank you for making the patch. I don't think you attached the patch to the email though. The best way to send patches is to use Erector's rubyforge page at http://rubyforge.org/tracker/?atid=18572&group_id=4797&func=browse I will update the docs. Are you using the latest revision in the svn repository or version 0.3.110? > > I also setup a resource generator creating nice classes for a restful > resource in rails. any interest ? Yes. Do you have some code samples? Probably the easiest way to show them off is using http://pastie.caboo.se > > with regards > Kristian Cheers, Brian > _______________________________________________ > Erector-devel mailing list > Erector-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/erector-devel >