From sjansen at gurulabs.com Thu Jun 23 16:13:42 2005 From: sjansen at gurulabs.com (Stuart Jansen) Date: Thu Jun 23 16:05:31 2005 Subject: [Rake-devel] rules with multiple prereqs Message-ID: <1119557622.32675.5.camel@localhost.localdomain> Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://rubyforge.org/pipermail/rake-devel/attachments/20050623/464a557d/attachment-0001.bin From sjansen at gurulabs.com Thu Jun 23 16:27:43 2005 From: sjansen at gurulabs.com (Stuart Jansen) Date: Thu Jun 23 16:19:31 2005 Subject: [Rake-devel] embedding rake Message-ID: <1119558463.32675.18.camel@localhost.localdomain> I need the functionality of rake as a part of a tool I'm building at work. After an initial tour of the code, it looks to me like rake can't yet be required and embedded by other apps. If I refactor rake to add this feature, would a patch be welcome? Looks like the code is clean enough that it shouldn't be hard. -- Stuart Jansen Guru Labs, L.C. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://rubyforge.org/pipermail/rake-devel/attachments/20050623/2799fad2/attachment.bin From jim at weirichhouse.org Thu Jun 23 20:18:40 2005 From: jim at weirichhouse.org (Jim Weirich) Date: Thu Jun 23 20:10:38 2005 Subject: [Rake-devel] rules with multiple prereqs In-Reply-To: <1119557622.32675.5.camel@localhost.localdomain> References: <1119557622.32675.5.camel@localhost.localdomain> Message-ID: <200506232018.40387.jim@weirichhouse.org> On Thursday 23 June 2005 04:13 pm, Stuart Jansen wrote: > Included is a patch that allows procs tied to rules to return multiple > prerequisites. > > After considering multiple approaches, including writing writing a tool > similar to makedepend for my project, I decided this was the cleanest > approach. I have also included an example rakefile that uses this new > feature. Wow. I'm still trying to wrap my head around the concept. That's what I love about open source, you get contributions that you yourself would have never thought of. Ok, lets see if I can explain your patch in words (just to make sure I understand your intention). In your Rakefile, you wish to generate a .tex file from a .xml file. The XML file includes other files. If any of the include files (or the main .xml file) are more up to date than the .tex, the .tex file should be regenerated. The only potential problem I see is a possibly interaction with the recursive rule logic. If the main .xml file does't exist at the time the rule is evaluated (i.e. it too is generated by a rule), then the secondary prereqs will never be created. This is probably ok because when this is the case, a file task for the main .xml will be generated and (since it is a file task) the .xml will be generated, causing the .tex to be generated (because it is now out of date w.r.t. the .xml file. In that case, the secondary prereqs don't matter ... But wait! If the secondary prereqs are also not present (and generated by a rule), then they will never be generated because the main .xml didn't exist at the time prereqs were calculated. Sorry for the rambling of the previous paragraph. I'm kinda thinking out load. It may be a case of caveat emptor, if you use rules in such ways, you really need to know what you are doing. What I would like to see, is some test cases for the changes you sent. Particularly showing that the normal one source proc functionality isn't broken and that the enhancements work as advertised. Some experimentation with the recursive rule/multiple source interaction might be worthwhile too. Thanks for the patch. -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas) From jim at weirichhouse.org Thu Jun 23 20:19:51 2005 From: jim at weirichhouse.org (Jim Weirich) Date: Thu Jun 23 20:11:45 2005 Subject: [Rake-devel] embedding rake In-Reply-To: <1119558463.32675.18.camel@localhost.localdomain> References: <1119558463.32675.18.camel@localhost.localdomain> Message-ID: <200506232019.51194.jim@weirichhouse.org> On Thursday 23 June 2005 04:27 pm, Stuart Jansen wrote: > I need the functionality of rake as a part of a tool I'm building at > work. After an initial tour of the code, it looks to me like rake can't > yet be required and embedded by other apps. If I refactor rake to add > this feature, would a patch be welcome? Looks like the code is clean > enough that it shouldn't be hard. I would be interested in a patch. Why don't you outline what you see needs to be done in an email. Thanks. -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)