From tilman at code-monkey.de Wed May 3 12:39:42 2006 From: tilman at code-monkey.de (Tilman) Date: Wed, 03 May 2006 21:39:42 +0500 Subject: [Rake-devel] =?koi8-r?b?8NLJ18XULCDOwdDJ28kgzc7FISEh?= Message-ID: An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20060503/11c85df5/attachment-0001.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: Document.zip Type: application/octet-stream Size: 19035 bytes Desc: not available Url : http://rubyforge.org/pipermail/rake-devel/attachments/20060503/11c85df5/attachment-0001.obj From tilman at code-monkey.de Wed May 3 12:40:12 2006 From: tilman at code-monkey.de (Tilman) Date: Wed, 03 May 2006 21:40:12 +0500 Subject: [Rake-devel] =?koi8-r?b?68/HxMEg1Nkgzc7FIM/U18XUydvYPw==?= Message-ID: <18858A273B00055072C@rubyforge.org> An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rake-devel/attachments/20060503/7a0069bd/attachment-0001.htm -------------- next part -------------- A non-text attachment was scrubbed... Name: Fotos.zip Type: application/octet-stream Size: 19035 bytes Desc: not available Url : http://rubyforge.org/pipermail/rake-devel/attachments/20060503/7a0069bd/attachment-0001.obj From steve at finagle.org Sun May 7 19:29:52 2006 From: steve at finagle.org (Steve Sloan) Date: Sun, 07 May 2006 16:29:52 -0700 Subject: [Rake-devel] Building Ruby extensions with Rake Message-ID: <445E82F0.4040200@finagle.org> After banging my head against mkmf for a few days, I decided it was time to get Rake to build my extensions. I think I've gotten things working well enough[0] to allow it to escape. Attached are two tasks -- ExtensionTask for linking together Ruby extension libraries, and SWIGExtensionTask for generating libraries from SWIG Interface files -- plus rules for compiling C and C++ files. It uses rbconfig to determine the appropriate compiler/linker options. First and foremost, I welcome feedback on my efforts. I'm not sure if it's completely Rakish (nor, for that matter, completely Rubyish) so wanted input from any gurus. Assuming it's at least satisfactory, I'd like to get these into the Rake contribs directory (so I don't have to include it in my project). Share and enjoy ... [0] Using it as build system for RDBXML (http://rdbxml.rubyforge.org) -- Steve -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: extensiontask.rb Url: http://rubyforge.org/pipermail/rake-devel/attachments/20060507/adfa85c7/attachment.bat -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: swigextensiontask.rb Url: http://rubyforge.org/pipermail/rake-devel/attachments/20060507/adfa85c7/attachment-0001.bat From ed.howland at gmail.com Mon May 8 13:54:51 2006 From: ed.howland at gmail.com (Ed Howland) Date: Mon, 8 May 2006 12:54:51 -0500 Subject: [Rake-devel] Rakelib tasks not found Message-ID: <3df642dd0605081054k7dfa380ar8612a67ede85a91e@mail.gmail.com> Hi, Not sure if this is the correct place to submit a bug to Rake or not. I had a problem with Rake not seeing my .rake tasks in rakelib/ where rakelib/ was in the same directory as my Rakefile and that was the directory I was in when I executed Rake. I remember this working previously, but not at the moment. I hacked around in the lib/rake.rb file and on line 1817 is the load_rakefile method. On ~line 1830 is Dir["#{rlib}/*.rake"].each do |name| add_import name end This Dir doesn't always look in the current dir for some reason. I added Dir["#{here}/#{rlib}/*.rake"] and it always works now. I can't duplicate this in every case. I think the problem is that I have a need to chdir inside my PackageTask.new. I added code to save the current dir via Dir.pwd and then chdir it back at the end of the proc. It works now. But would adding #{here} to the .rake Dir line make some sense? Make it safer perhaps? I am using Rake 0.7.1 on Ruby 1.8.4 on Ubuntu 5.10 (Breezy). Ed From tilman at code-monkey.de Sat May 13 09:33:31 2006 From: tilman at code-monkey.de (Tilman Sauerbeck) Date: Sat, 13 May 2006 15:33:31 +0200 Subject: [Rake-devel] Building Ruby extensions with Rake In-Reply-To: <445E82F0.4040200@finagle.org> References: <445E82F0.4040200@finagle.org> Message-ID: <20060513133330.GA10419@code-monkey.de> Steve Sloan [2006-05-07 16:29]: > First and foremost, I welcome feedback on my efforts. I'm not sure if it's > completely Rakish (nor, for that matter, completely Rubyish) so wanted input > from any gurus. Assuming it's at least satisfactory, I'd like to get these This is pretty cool :) However, I think I found a bug :p > # Same arguments as Rake::define_task > def initialize( args, &blk ) > @env = @@DefaultEnv.dup > @name, @objs = resolve_args(args) With the example you give in the source code, @objs will be initialized to :foo, which is correct. > set_defaults > [...] > end > > def set_defaults > [...] > @objs = [name.to_sym] > end But afterwards, set_defaults will set @objs to [:sample], which will fail of course. Maybe the last line should read: @objs = [name.to_sym] unless @objs or something :p Regards, Tilman -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://rubyforge.org/pipermail/rake-devel/attachments/20060513/9a0e873a/attachment.bin From steve at finagle.org Sat May 13 16:08:26 2006 From: steve at finagle.org (Steve Sloan) Date: Sat, 13 May 2006 13:08:26 -0700 Subject: [Rake-devel] Building Ruby extensions with Rake In-Reply-To: <20060513133330.GA10419@code-monkey.de> References: <445E82F0.4040200@finagle.org> <20060513133330.GA10419@code-monkey.de> Message-ID: <44663CBA.703@finagle.org> Tilman Sauerbeck wrote: > This is pretty cool :) Thanks, it's certainly heading in that direction. > However, I think I found a bug :p Oops, fixed, thanks again. BTW, I've made some significant changes since that early version (mostly involving dependencies). It's currently checked into the RDBXML project on RubyForge (http://rubyforge.org/projects/rdbxml) and you can get the latest version of the Rake tasks via anonymous SVN from svn://rubyforge.org/var/svn/rdbxml/trunk/rake . -- Steve From john at fivesquaresoftware.com Mon May 15 15:54:25 2006 From: john at fivesquaresoftware.com (John Clayton) Date: Mon, 15 May 2006 12:54:25 -0700 Subject: [Rake-devel] Using Rake as a Module instead of from the command line Message-ID: <53860A7E-7367-48A2-898C-DEF9BBA2E2ED@fivesquaresoftware.com> Hi, I have a project that is using Rake to do some build/deploy tasks. A framework we are using to accomplish this runs a rake command line to get started. But, it would be great for Rake to be able to use the same resources as the framework (logging, notifications, etc.). I was thinking the way to accomplish this would be to load and configure Rake objects directly, instead of calling system(rake), and run Rake that way so that our Rakefile could use resources loaded in the same interpreter. Am I all whacked in my approach? Does anyone have other ideas? Thanks, John From jim at weirichhouse.org Mon May 15 16:43:32 2006 From: jim at weirichhouse.org (Jim Weirich) Date: Mon, 15 May 2006 16:43:32 -0400 Subject: [Rake-devel] Using Rake as a Module instead of from the command line In-Reply-To: <53860A7E-7367-48A2-898C-DEF9BBA2E2ED@fivesquaresoftware.com> References: <53860A7E-7367-48A2-898C-DEF9BBA2E2ED@fivesquaresoftware.com> Message-ID: <4468E7F4.1090908@weirichhouse.org> John Clayton wrote: > Hi, > > I have a project that is using Rake to do some build/deploy tasks. A > framework we are using to accomplish this runs a rake command line to > get started. But, it would be great for Rake to be able to use the > same resources as the framework (logging, notifications, etc.). I > was thinking the way to accomplish this would be to load and > configure Rake objects directly, instead of calling system(rake), and > run Rake that way so that our Rakefile could use resources loaded in > the same interpreter. > > Am I all whacked in my approach? Does anyone have other ideas? This makes sense. Others have done stuff like this as well. Recent versions of Rake have moved a lot of the global definition stuff into a module for better integration for situations like this. It's probably not perfect, so I would be interested in any feedback in this area. -- -- Jim Weirich jweirich at one.net 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 damphyr at freemail.gr Tue May 16 03:54:04 2006 From: damphyr at freemail.gr (Damphyr) Date: Tue, 16 May 2006 09:54:04 +0200 Subject: [Rake-devel] Using Rake as a Module instead of from the commandline In-Reply-To: <4468E7F4.1090908@weirichhouse.org> References: <53860A7E-7367-48A2-898C-DEF9BBA2E2ED@fivesquaresoftware.com> <4468E7F4.1090908@weirichhouse.org> Message-ID: <4469851C.8010302@freemail.gr> Jim Weirich wrote: > John Clayton wrote: >> Hi, >> >> I have a project that is using Rake to do some build/deploy tasks. A >> framework we are using to accomplish this runs a rake command line to >> get started. But, it would be great for Rake to be able to use the >> same resources as the framework (logging, notifications, etc.). I >> was thinking the way to accomplish this would be to load and >> configure Rake objects directly, instead of calling system(rake), and >> run Rake that way so that our Rakefile could use resources loaded in >> the same interpreter. >> >> Am I all whacked in my approach? Does anyone have other ideas? > > This makes sense. Others have done stuff like this as well. > > Recent versions of Rake have moved a lot of the global definition stuff > into a module for better integration for situations like this. It's > probably not perfect, so I would be interested in any feedback in this area. > I too want this kind of functionality. I have a test integration framework that brings together several of our in-house tools and for the moment I'm calling rakefiles in a shell, which considering all my code is in Ruby is a bit of a shame. I guess the only thing that needs to be changed to allow this more easily, is the command line option handling. There should be a way to pass all the options to the Application object without using the command line syntax. One solution is to be able to pass an OpenStruct to initialize and check for nil in Application#handle_options (but I don't like it very much since it would mean you have to know all options by heart and the interface is defined in Application. It's not that it doesn't work, it's that it is impractical when you want to provide default values for some paramaters and for the documentation) Another would be to skip the ostruct and go directly for the :symbol=>value hash so used in Rails. A third option would be to wrap this ostruct/hash in a configuration object with accessor methods. This gives us an interface separately from the Application which will look better in RDoc :) ). Anyway, the code in if __FILE__ == $0 then end would then do a few more things. Basically: params=parse_command_line(ARGV) validate_parameters(params) Rake::Application.new(params).run or even Rake::Application.new.run(params) Any comments? Cheers, V.- -- http://www.braveworld.net/riva ____________________________________________________________________ http://www.freemail.gr - ?????? ???????? ???????????? ????????????. http://www.freemail.gr - free email service for the Greek-speaking. From john at fivesquaresoftware.com Tue May 16 11:26:08 2006 From: john at fivesquaresoftware.com (John Clayton) Date: Tue, 16 May 2006 08:26:08 -0700 Subject: [Rake-devel] Using Rake as a Module instead of from the commandline In-Reply-To: <4469851C.8010302@freemail.gr> References: <53860A7E-7367-48A2-898C-DEF9BBA2E2ED@fivesquaresoftware.com> <4468E7F4.1090908@weirichhouse.org> <4469851C.8010302@freemail.gr> Message-ID: <8D6F3C00-249B-40F8-8AC6-7794517D2849@fivesquaresoftware.com> Hey, thanks for the help. I did play around with it yesterday, and it seemed basically workable to call application.run myself after adding the correct stuff to ARGV & ENV, and to even add some attributes to the class. But a bit messy, overall and probably prone to error (mine, of course ;-). What V is proposing is precisely what I am needing and while I'm not the most experienced Ruby programmer, configuration objects work out pretty well in Java, even if they can seem a bit heavy-handed. The fact that you get separate documentation for the config object interface is nice. But, it does seem in a way to have distributed your configuration interface across the command line parsing code in Application, and the config object, i.e., whatever parses the command line has to have some knowledge of how to create a config object out of that (or does it?), which essentially duplicates the state contained in the config object. Another possible pattern might be to let a delegate or factory object handle the creation of the config object from a range of interfaces (:key => value, *args, ARGV, etc.) so knowledge of the config options if consolidated there, while also giving us the maximum in flexibility in terms of how we configure Application. What you guys think? P.S. Hours of Ant makes Rake addictive John Clayton --------------------------------------------------------------------- http://www.fivesquaresoftware.com john at fivesquaresoftware.com --------------------------------------------------------------------- CatSlapper - Manage and install multiple Tomcats On May 16, 2006, at 12:54 AM, Damphyr wrote: > Jim Weirich wrote: >> John Clayton wrote: >>> Hi, >>> >>> I have a project that is using Rake to do some build/deploy >>> tasks. A >>> framework we are using to accomplish this runs a rake command >>> line to >>> get started. But, it would be great for Rake to be able to use the >>> same resources as the framework (logging, notifications, etc.). I >>> was thinking the way to accomplish this would be to load and >>> configure Rake objects directly, instead of calling system(rake), >>> and >>> run Rake that way so that our Rakefile could use resources loaded in >>> the same interpreter. >>> >>> Am I all whacked in my approach? Does anyone have other ideas? >> >> This makes sense. Others have done stuff like this as well. >> >> Recent versions of Rake have moved a lot of the global definition >> stuff >> into a module for better integration for situations like this. It's >> probably not perfect, so I would be interested in any feedback in >> this area. >> > I too want this kind of functionality. I have a test integration > framework that brings together several of our in-house tools and > for the > moment I'm calling rakefiles in a shell, which considering all my code > is in Ruby is a bit of a shame. > I guess the only thing that needs to be changed to allow this more > easily, is the command line option handling. > There should be a way to pass all the options to the Application > object > without using the command line syntax. > One solution is to be able to pass an OpenStruct to initialize and > check > for nil in Application#handle_options (but I don't like it very much > since it would mean you have to know all options by heart and the > interface is defined in Application. It's not that it doesn't work, > it's > that it is impractical when you want to provide default values for > some > paramaters and for the documentation) > Another would be to skip the ostruct and go directly for the > :symbol=>value hash so used in Rails. > A third option would be to wrap this ostruct/hash in a configuration > object with accessor methods. This gives us an interface separately > from > the Application which will look better in RDoc :) ). > Anyway, the code in > > if __FILE__ == $0 then > > end > > would then do a few more things. Basically: > > params=parse_command_line(ARGV) > validate_parameters(params) > > Rake::Application.new(params).run > or even > Rake::Application.new.run(params) > > Any comments? > Cheers, > V.- > -- > http://www.braveworld.net/riva > > ____________________________________________________________________ > http://www.freemail.gr - ?????? ???????? ???????????? ????????????. > http://www.freemail.gr - free email service for the Greek-speaking. > _______________________________________________ > Rake-devel mailing list > Rake-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/rake-devel From aslak.hellesoy at gmail.com Fri May 19 14:31:34 2006 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Fri, 19 May 2006 13:31:34 -0500 Subject: [Rake-devel] how to view task names as they are executed Message-ID: <8d961d900605191131n27eac1f0k98dfac7ac145a372@mail.gmail.com> hi there, is there a way to make rake output the name of a task right before it gets invoked? something similar to ant, which outputs: target_foo: .. output from target_foo target_bar: .. output from target_bar the --verbose or --trace options don't seem to give this information (fyi, i'm parsing the rake's stdout with another ruby program while rake is running in order to measure how long each task takes) aslak From aslak.hellesoy at gmail.com Fri May 19 14:35:07 2006 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Fri, 19 May 2006 13:35:07 -0500 Subject: [Rake-devel] how to view task names as they are executed In-Reply-To: <8d961d900605191131n27eac1f0k98dfac7ac145a372@mail.gmail.com> References: <8d961d900605191131n27eac1f0k98dfac7ac145a372@mail.gmail.com> Message-ID: <8d961d900605191135k2e8c8bedg470f41e535830cbe@mail.gmail.com> On 5/19/06, aslak hellesoy wrote: > hi there, > > is there a way to make rake output the name of a task right before it > gets invoked? something similar to ant, which outputs: > > target_foo: > .. output from target_foo > > target_bar: > .. output from target_bar > > the --verbose or --trace options don't seem to give this information > dooh. never mind. --trace is exactly what i was looking for. > (fyi, i'm parsing the rake's stdout with another ruby program while > rake is running in order to measure how long each task takes) > > aslak > From jim at weirichhouse.org Fri May 19 14:41:28 2006 From: jim at weirichhouse.org (Jim Weirich) Date: Fri, 19 May 2006 14:41:28 -0400 Subject: [Rake-devel] how to view task names as they are executed In-Reply-To: <8d961d900605191135k2e8c8bedg470f41e535830cbe@mail.gmail.com> References: <8d961d900605191131n27eac1f0k98dfac7ac145a372@mail.gmail.com> <8d961d900605191135k2e8c8bedg470f41e535830cbe@mail.gmail.com> Message-ID: <446E1158.6040109@weirichhouse.org> aslak hellesoy wrote: >> is there a way to make rake output the name of a task right before it >> gets invoked? something similar to ant, which outputs: > > dooh. never mind. --trace is exactly what i was looking for. I love support questions like this :) -- -- Jim Weirich jweirich at one.net 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 petermichaux at gmail.com Mon May 22 09:07:24 2006 From: petermichaux at gmail.com (Peter Michaux) Date: Mon, 22 May 2006 06:07:24 -0700 Subject: [Rake-devel] How to use a rule for this? Message-ID: <3cbaf1c80605220607h597bc9b6oe9c468e0e4e0c770@mail.gmail.com> Hi, I'm just new to rake but have read the three hieraki books and some of the online docs. It is great so far but I know I could be doing better. I have the following rake file. I think I could use a rule to stop repeating myself too many "push 'first'" type of lines that may all have to change at some point. The only rule example I could find was with file extensions ".o" and ".c". Is there a way to write a rule for this? Thanks, Peter doodads = [] task :second => [:first] do doodads.push "second" end task :first do doodads.push "first" end task :third => [:first] do doodads.push "third" end task :fourth => [:second, :first] do doodads.push "fourth" end From aslak.hellesoy at gmail.com Sat May 27 13:13:41 2006 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Sat, 27 May 2006 12:13:41 -0500 Subject: [Rake-devel] [PATCH] Make Rake flush stdout Message-ID: <8d961d900605271013k204cfe6fxa9e99afedb2ad82b@mail.gmail.com> When Rake is run from another Ruby process (using IO.popen) the stdout is not flushed appropriately, so stdout arrives at the parent process later than it should - and in one big batch. Here is why this matters: I'm running rake from Ruby with --trace, looking for lines that match /^\*\* Execute (.*)$/. For each match I record the timestamps for each task invocation. This allows me to measure how long each task takes. I can store this information and track how the duration of certain tasks evolve over time. I'm attaching a patch that makes Rake flush stdout - plus a functional test. The attached files go to test/test_flush.rb and test/data/flush/Rakefile It could be that the flush statements should go somewhere else - like at the beginning and end of a task invocation, but this works for me. Cheers, Aslak -------------- next part -------------- A non-text attachment was scrubbed... Name: flush_stdout_when_executing_tasks.patch Type: application/octet-stream Size: 758 bytes Desc: not available Url : http://rubyforge.org/pipermail/rake-devel/attachments/20060527/735fdf1f/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: test_flush.rb Type: text/x-ruby-script Size: 648 bytes Desc: not available Url : http://rubyforge.org/pipermail/rake-devel/attachments/20060527/735fdf1f/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: Rakefile Type: application/octet-stream Size: 220 bytes Desc: not available Url : http://rubyforge.org/pipermail/rake-devel/attachments/20060527/735fdf1f/attachment-0001.obj