Thanks for the help. My 'newbie question' was more related to the fact when I call merb, the request goes through the gem and not my local repo, I was wondering what was the official procedure to avoid that behaviour without breaking my other merb projects. I guess I can just call my generator directly.
<br><br>About the suggested structure, I was thinking more about creating a generic generator class and having many sub classes so we keep our code consistent and we make things easier for developers wanting to write new generators.
<br><br>I'll try to work on that asap<br><br><br>-Matt<br><br><br><br><div><span class="gmail_quote">On 7/30/07, <b class="gmail_sendername">Chris McGrath</b> <<a href="mailto:chris@octopod.info">chris@octopod.info
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On 30 Jul 2007, at 07:26, Matt Aimonetti wrote:<br><br>> Sounds good to me.
<br>> I'm willing to try working on the generator.<br>><br>> This is what I had in mind:<br>><br>> $ merb -g app bookshop<br>> $ merb -g model Book name:string author:string published_at:date<br>>
<br>> After a collision check, merb would automatically generate:<br>> - an Active Record Model<br>> - a migration file<br>> - a fixture file<br>> - a rspec example<br>> - a unit test<br>><br>> I would personally stick to only rspec but I'm fine with adding a unit
<br>> test template and generate a test and an example per model.<br>><br><br>I like the idea of having a separate script to generate AR/rspec<br>models, which merb -g might call by default. We can then have other<br>
scripts for AR/test-spec, ruby-sequel/rspec etc. if people want them<br>enough to write them. They could also be installed as plugins.<br><br>So you'd be able to do something like:<br><br>merb -g model -t test-spec -o ruby-sequel name:string author:string
<br><br>but so we don't have to have merb -g know all this stuff before we<br>can test / use it, you should be able to do something like:<br><br>merb_ar _rspec -g model ...<br><br>etc.<br><br>> Regarding using ruby-sequel instead of Active Record, I think that's a
<br>> good idea. I would probably have to modify the actual generator and we<br>> could add an option for the ORM you want to use. When the developer<br>> decides to generate a model, the generator could check on the ORM used
<br>> and use the proper template.<br>><br>> What do you think?<br>><br><br>Having it autodetect which ORM / BDD library would be cool, but not<br>as important as being able to generate the stuff first.<br><br>
<br>> Also, I have few newbie questions. How's your development/testing<br>> environment like? I guess you don't package/install the gem every<br>> time, do you? Do you just work on the files directly in your gems
<br>> folder? I'm sorry, I never worked on a gem and I couldn't find the<br>> rubygems developer guide. (and I prefer to sound ignorant than to<br>> waste my time not doing things properly :) )<br>><br>
><br><br>You want to checkout merb trunk somewhere locally on your machine<br>using svn.<br><br>Where $ is your terminal prompt<br><br>$ svn co <a href="http://svn.devjavu.com/merb/trunk">http://svn.devjavu.com/merb/trunk
</a> merb<br>$ cd merb<br>$ rake specs<br><br>This makes sure everything is working on your machine.<br><br>For the merb_ar script I mentioned above, I'd break it down into<br>something like the following:<br><br>bin/merb_ar
<br>lib/merb/merb_activerecord_generator/merb_activerecord.rb<br>lib/merb/merb_activerecord_generator/templates/model.erb<br>lib/merb/merb_activerecord_generator/templates/rspec.erb<br>lib/merb/merb_activerecord_generator/templates/test-
spec.erb<br>specs/merb/merb_active_record_generator/merb_activerecord_spec.rb<br>specs/merb/merb_active_record_generator/fixtures/model.rb<br>specs/merb/merb_active_record_generator/fixtures/rspec.rb<br>specs/merb/merb_active_record_generator/fixtures/test-
spec.rb<br><br>bin/merb_ar is a simple script which processes command line options<br>and calls the appropriate methods in the merb_activerecord.rb lib.<br>The specs would make sure that calling the methods on the lib<br>
generated the correct output by comparing with the expected output in<br>the fixtures dir. You'd possibly need more than the fixtures I've<br>listed here of course :)<br><br>I'd start with the specs and a simple model fixture, make the lib
<br>create the fixture, then move on to the creating the rspec file the<br>same way. You could leave off test-spec for now if you don't know it<br>and someone else can add that. When the lib is producing what it<br>should then you can write the bin/merb_ar script to call it.
<br><br>svn add all the files you've created as part of this, then run svn<br>diff > merb_ar_generator_1.diff and upload that to a new ticket on Trac<br><br>> -Matt<br><br>HTH, Cheers,<br><br>Chris<br>_______________________________________________
<br>Merb-devel mailing list<br><a href="mailto:Merb-devel@rubyforge.org">Merb-devel@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/merb-devel">http://rubyforge.org/mailman/listinfo/merb-devel</a><br></blockquote>
</div><br>