From rugowski at nhw.pl Fri Oct 10 18:00:30 2008 From: rugowski at nhw.pl (Witold Rugowski) Date: Sat, 11 Oct 2008 00:00:30 +0200 Subject: [Rake-devel] Tasks with arguments and dependencies - doc patch Message-ID: <48EFD07E.60906@nhw.pl> Hi! I was recently using tasks with arguments and have noticed issue with docs. First, there is missing :needs key in example. Second - I'm using rake 0.8.3 and enclosing arguments names into array in task definition results with error when task is run (only when there is dependency on this task). In doc there is example: task :name, [:first_name, :last_name] => [:pre_name] do |t, args| args.with_defaults(:first_name => "John", :last_name => "Dough") puts "First name is #{args.first_name}" puts "Last name is #{args.last_name}" end It is missng :needs key, but even with it rake name returns: >rake name (in E:/NB/devel/NetBeans) rake aborted! undefined method `to_sym' for [:first_name, :last_name]:Array E:/NB/devel/NetBeans/rakefile:1 (See full trace by running task with --trace) Changing task definition into task :name, :first_name, :last_name, :needs => :pre_name do |t, args| fixes problem. I'm attaching patch to doc to make it clear and example rakefile which render this error. Best regards, -- Witold Rugowski Ruby on Rails freelancer http://nhw.pl/wp/ (EN blog) http://nhw.pl/pl (PL blog) -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rakefile URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: doc.patch URL: From jim.weirich at gmail.com Fri Oct 10 22:38:49 2008 From: jim.weirich at gmail.com (Jim Weirich) Date: Fri, 10 Oct 2008 22:38:49 -0400 Subject: [Rake-devel] Tasks with arguments and dependencies - doc patch In-Reply-To: <48EFD07E.60906@nhw.pl> References: <48EFD07E.60906@nhw.pl> Message-ID: On Oct 10, 2008, at 6:00 PM, Witold Rugowski wrote: > Hi! > I was recently using tasks with arguments and have noticed issue with > docs. First, there is missing :needs key in example. Second - I'm > using > rake 0.8.3 and enclosing arguments names into array in task definition > results with error when task is run (only when there is dependency on > this task). > > In doc there is example: > > task :name, [:first_name, :last_name] => [:pre_name] do |t, args| > args.with_defaults(:first_name => "John", :last_name => "Dough") > puts "First name is #{args.first_name}" > puts "Last name is #{args.last_name}" > end > > It is missng :needs key, Actually no, it is correct as it stands. The 0.8.3 version of rake does not need the :needs key (it will accept it, but the [:args] => [:prereqs] syntax is preferred. See below for an example. Double check to make sure you are running version 0.8.3. Perhaps you have two versions installed and are not running the one you expect. Thanks for the feedback. -- -- Jim Weirich -- jim.weirich at gmail.com $ cat Rakefile task :pre_name do puts "In pre_name" end task :name, [:first_name, :last_name] => [:pre_name] do |t, args| args.with_defaults(:first_name => "John", :last_name => "Dough") puts "First name is #{args.first_name}" puts "Last name is #{args.last_name}" end $ rake --version rake, version 0.8.3 $ rake name (in /Users/jim/pgm/rake/witold) In pre_name First name is John Last name is Dough $ rake name[Jim,Weirich] (in /Users/jim/pgm/rake/witold) In pre_name First name is Jim Last name is Weirich $ From rugowski at nhw.pl Sat Oct 11 08:37:42 2008 From: rugowski at nhw.pl (Witold Rugowski) Date: Sat, 11 Oct 2008 14:37:42 +0200 Subject: [Rake-devel] Tasks with arguments and dependencies - doc patch In-Reply-To: References: <48EFD07E.60906@nhw.pl> Message-ID: <48F09E16.8050406@nhw.pl> Jim Weirich wrote: > Actually no, it is correct as it stands. The 0.8.3 version of rake > does not need the :needs key (it will accept it, but the [:args] => > [:prereqs] syntax is preferred. See below for an example. > You are right, example from documentation does work. However description before is misleading: > > > Tasks that Expect Parameters and Have Prerequisites > > Tasks that use parameters have a slightly different format for > prerequisites. Use the :needs keyword to specify the prerequisites for > tasks with arguments. For example: > So maybe this need to be removed since after I have read this I have copied example and added :needs key. And this does not work - with :needs arrays should not be used. Best regards, -- Witold Rugowski Ruby on Rails freelancer http://nhw.pl/wp/ (EN blog) http://nhw.pl/pl (PL blog) From jim.weirich at gmail.com Sat Oct 11 09:00:20 2008 From: jim.weirich at gmail.com (Jim Weirich) Date: Sat, 11 Oct 2008 09:00:20 -0400 Subject: [Rake-devel] Tasks with arguments and dependencies - doc patch In-Reply-To: <48F09E16.8050406@nhw.pl> References: <48EFD07E.60906@nhw.pl> <48F09E16.8050406@nhw.pl> Message-ID: <9E6361FE-AB15-422B-AC4B-56847024ACCD@gmail.com> On Oct 11, 2008, at 8:37 AM, Witold Rugowski wrote: > You are right, example from documentation does work. However > description > before is misleading: Ahh, Thanks! I missed that in the documentation rewrite. I've updated it now. -- -- Jim Weirich -- jim.weirich at gmail.com From luislavena at gmail.com Thu Oct 23 10:32:31 2008 From: luislavena at gmail.com (Luis Lavena) Date: Thu, 23 Oct 2008 11:32:31 -0300 Subject: [Rake-devel] Plan for 0.8.4? Message-ID: <71166b3b0810230732n21433802ga1346d8819cbbbb4@mail.gmail.com> Hello Jim, 0.8.3 is giving some headaches to Windows users, and I'm catching all the fire related to it. There is something needed for us to wait for 0.8.4? (maybe I should run all the test locally and get back to you) Please let me know, I have some free hours to spare on OSS this week. Regards, -- Luis Lavena AREA 17 - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From luislavena at gmail.com Thu Oct 23 13:40:41 2008 From: luislavena at gmail.com (Luis Lavena) Date: Thu, 23 Oct 2008 14:40:41 -0300 Subject: [Rake-devel] Tracking some discrepancies on Windows Message-ID: <71166b3b0810231040j40dbf3beu6ec8d32cbd83d75f@mail.gmail.com> Hello everybody. I'm just investing a bit fixing some issues I found with latest 0.8.3 release and are hitting me hard to maintain One-Click installer. One of those is related to rake_system call and the "call" added, and others are related to ruby and sh commands. I forked the project and added some fixed in windows branch: http://github.com/luislavena/rake/tree/windows So using that as base, I found the following discrepancy: http://pastie.org/299068 Keep in mind that this version of ruby (patchlevel 114) has been patched to solve the $? existstatus issues found in previous versions of Ruby for Windows. http://blog.mmediasys.com/2008/05/24/random-bits-and-experiments/ Looking more closer, I believe Kernel::system with mutliple arguments is broken. ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-linux] irb(main):001:0> ENV['FOO'] = "hello" => "hello" irb(main):002:0> system "echo", "$FOO" $FOO => true irb(main):003:0> system "echo $FOO" hello => true Suggestions? -- Luis Lavena AREA 17 - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From luislavena at gmail.com Thu Oct 23 17:47:23 2008 From: luislavena at gmail.com (Luis Lavena) Date: Thu, 23 Oct 2008 18:47:23 -0300 Subject: [Rake-devel] Rake::Win32.rake_system In-Reply-To: <02EA1FD4E5205C48BE881A7ACE2F7C8C121F1AF2@azsmsx502.amr.corp.intel.com> References: <02EA1FD4E5205C48BE881A7ACE2F7C8C1214C025@azsmsx502.amr.corp.intel.com> <71166b3b0809252056r5a4d48b0hd3ccf97c1827b755@mail.gmail.com> <3BE70AD8-B336-4F62-A96A-DB29B4E2B61E@gmail.com> <02EA1FD4E5205C48BE881A7ACE2F7C8C1214C261@azsmsx502.amr.corp.intel.com> <02EA1FD4E5205C48BE881A7ACE2F7C8C121F1AF2@azsmsx502.amr.corp.intel.com> Message-ID: <71166b3b0810231447t292f1cd0ub3371620b30a1c11@mail.gmail.com> On Mon, Sep 29, 2008 at 1:00 PM, Turpin, Jay wrote: > Jim, > > That's much cleaner - I fixed a minor typo in the example you sent and tested on my machine. Seems to work fine. Any idea when we'll see a new gem with the fix in it? > > def perform_variable_expansion(cmd) > cmd.gsub!(/%([A-Za-z_]+)%/) { |k| ENV[$1] || k } > end > > Thanks for the help! > I just forked rake and added several fixed in windows branch http://github.com/luislavena/rake/tree/windows But this patch didn't make into the master repo. Jim: should we try it and let you know? -- Luis Lavena AREA 17 - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From assaf at labnotes.org Thu Oct 23 23:00:30 2008 From: assaf at labnotes.org (Assaf Arkin) Date: Thu, 23 Oct 2008 20:00:30 -0700 Subject: [Rake-devel] Tracking some discrepancies on Windows In-Reply-To: <71166b3b0810231040j40dbf3beu6ec8d32cbd83d75f@mail.gmail.com> References: <71166b3b0810231040j40dbf3beu6ec8d32cbd83d75f@mail.gmail.com> Message-ID: <5037b6e40810232000h6bf1bb99mb5b2c420a9cd64bf@mail.gmail.com> On Thu, Oct 23, 2008 at 10:40 AM, Luis Lavena wrote: > Hello everybody. > > I'm just investing a bit fixing some issues I found with latest 0.8.3 > release and are hitting me hard to maintain One-Click installer. > > One of those is related to rake_system call and the "call" added, and > others are related to ruby and sh commands. > > I forked the project and added some fixed in windows branch: > > http://github.com/luislavena/rake/tree/windows > > So using that as base, I found the following discrepancy: > > http://pastie.org/299068 > > Keep in mind that this version of ruby (patchlevel 114) has been > patched to solve the $? existstatus issues found in previous versions > of Ruby for Windows. > > http://blog.mmediasys.com/2008/05/24/random-bits-and-experiments/ > > Looking more closer, I believe Kernel::system with mutliple arguments is > broken. > > ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-linux] > irb(main):001:0> ENV['FOO'] = "hello" > => "hello" > irb(main):002:0> system "echo", "$FOO" > $FOO > => true > irb(main):003:0> system "echo $FOO" > hello > => true If you call system with a single argument, that argument goes through shell expansion (env variables, glob patterns, escaping, etc). If you call with multiple arguments, the first one is the executable name, the rest are passed as command line arguments without shell expansion. In other words, call system with multiple arguments if you want to bypass shell expansion. Assaf > > > Suggestions? > -- > Luis Lavena > AREA 17 > - > Human beings, who are almost unique in having the ability to learn from > the experience of others, are also remarkable for their apparent > disinclination to do so. > Douglas Adams > _______________________________________________ > Rake-devel mailing list > Rake-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/rake-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From luislavena at gmail.com Fri Oct 24 01:52:44 2008 From: luislavena at gmail.com (Luis Lavena) Date: Fri, 24 Oct 2008 02:52:44 -0300 Subject: [Rake-devel] Tracking some discrepancies on Windows In-Reply-To: <5037b6e40810232000h6bf1bb99mb5b2c420a9cd64bf@mail.gmail.com> References: <71166b3b0810231040j40dbf3beu6ec8d32cbd83d75f@mail.gmail.com> <5037b6e40810232000h6bf1bb99mb5b2c420a9cd64bf@mail.gmail.com> Message-ID: <71166b3b0810232252q5a023549i93d28302da49b015@mail.gmail.com> On Fri, Oct 24, 2008 at 12:00 AM, Assaf Arkin wrote: > On Thu, Oct 23, 2008 at 10:40 AM, Luis Lavena wrote: >> >> Hello everybody. >> >> I'm just investing a bit fixing some issues I found with latest 0.8.3 >> release and are hitting me hard to maintain One-Click installer. >> >> One of those is related to rake_system call and the "call" added, and >> others are related to ruby and sh commands. >> >> I forked the project and added some fixed in windows branch: >> >> http://github.com/luislavena/rake/tree/windows >> >> So using that as base, I found the following discrepancy: >> >> http://pastie.org/299068 >> >> Keep in mind that this version of ruby (patchlevel 114) has been >> patched to solve the $? existstatus issues found in previous versions >> of Ruby for Windows. >> >> http://blog.mmediasys.com/2008/05/24/random-bits-and-experiments/ >> >> Looking more closer, I believe Kernel::system with mutliple arguments is >> broken. >> >> ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-linux] >> irb(main):001:0> ENV['FOO'] = "hello" >> => "hello" >> irb(main):002:0> system "echo", "$FOO" >> $FOO >> => true >> irb(main):003:0> system "echo $FOO" >> hello >> => true > > If you call system with a single argument, that argument goes through shell > expansion (env variables, glob patterns, escaping, etc). If you call with > multiple arguments, the first one is the executable name, the rest are > passed as command line arguments without shell expansion. In other words, > call system with multiple arguments if you want to bypass shell expansion. > Assaf > Thank you for the clarification Assaf, the lack of documentation from Ruby C code on this function made me doubt about it. Now I can work on a pending patch dealing with extensionless commands that should be expanded properly. -- Luis Lavena AREA 17 - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From jim.weirich at gmail.com Sat Oct 25 13:49:23 2008 From: jim.weirich at gmail.com (Jim Weirich) Date: Sat, 25 Oct 2008 13:49:23 -0400 Subject: [Rake-devel] Plan for 0.8.4? In-Reply-To: <71166b3b0810230732n21433802ga1346d8819cbbbb4@mail.gmail.com> References: <71166b3b0810230732n21433802ga1346d8819cbbbb4@mail.gmail.com> Message-ID: <3B82576A-ACC5-472F-9D93-9CFEDADAFB77@gmail.com> On Oct 23, 2008, at 10:32 AM, Luis Lavena wrote: > Hello Jim, > > 0.8.3 is giving some headaches to Windows users, and I'm catching all > the fire related to it. > > There is something needed for us to wait for 0.8.4? > (maybe I should run all the test locally and get back to you) > > Please let me know, I have some free hours to spare on OSS this week. Sorry, I've been distracted away from rake for the past couple of weeks. I've applied the "env" patch to packagetask and committed that to the repo. Are there any outstanding windows issues to be addressed? If not, I can cut a new release. -- -- Jim Weirich -- jim.weirich at gmail.com From luislavena at gmail.com Sat Oct 25 14:58:57 2008 From: luislavena at gmail.com (Luis Lavena) Date: Sat, 25 Oct 2008 15:58:57 -0300 Subject: [Rake-devel] Plan for 0.8.4? In-Reply-To: <3B82576A-ACC5-472F-9D93-9CFEDADAFB77@gmail.com> References: <71166b3b0810230732n21433802ga1346d8819cbbbb4@mail.gmail.com> <3B82576A-ACC5-472F-9D93-9CFEDADAFB77@gmail.com> Message-ID: <71166b3b0810251158r5b3aadb9oc23a99f17cbd365d@mail.gmail.com> On Sat, Oct 25, 2008 at 2:49 PM, Jim Weirich wrote: > > On Oct 23, 2008, at 10:32 AM, Luis Lavena wrote: > >> Hello Jim, >> >> 0.8.3 is giving some headaches to Windows users, and I'm catching all >> the fire related to it. >> >> There is something needed for us to wait for 0.8.4? >> (maybe I should run all the test locally and get back to you) >> >> Please let me know, I have some free hours to spare on OSS this week. > > Sorry, I've been distracted away from rake for the past couple of weeks. > I've applied the "env" patch to packagetask and committed that to the repo. > Are there any outstanding windows issues to be addressed? If not, I can > cut a new release. > I just addressed some corrections in my fork (under windows branch): http://github.com/luislavena/rake/tree/windows Basically: Consider MinGW also as valid Windows platform, which improves the support for upcoming one-click installer based on it: http://github.com/luislavena/rake/commit/49b669ed72891a2a891be31cb8fdde9e54e950c5 Reordered how Rake find system-wide Rakefile (HOME, HOMEDRIVE+HOMEPATH, APPDATA and then USERPROFILE) http://github.com/luislavena/rake/commit/5813a2ad0e2d277a97e7b84fb9995bf7cb30676c Corrected some mocks during Win32 tests that generated some errors when executing test under Windows: http://github.com/luislavena/rake/commit/e2a1cb2d766a1dfc503fd5ac0ba1cdbd48b25112 http://github.com/luislavena/rake/commit/fd75a2c9f27c7655cdc5fccb1b8b0a34ba025d97 Corrected some tests and made them platform specific: http://github.com/luislavena/rake/commit/c7f5273ef87e959ff643d6fc752bc0bdb5d9c57c Make Rakefile matching really case insensitive: http://github.com/luislavena/rake/commit/23275bc752cdc62c50ed79adbe3367acda905cf2 Most of those are just to remove the noise around executing test under Windows. I needed to patch that to be able to work and release on other packages like DataMapper, Merb, Hoe, ParseTree and RubyInline. The one pending thing I noticed is how system with multiple args is working, which I believe I'm missing something from this thread: http://rubyforge.org/pipermail/rake-devel/2008-September/000581.html And some questions from me here: http://rubyforge.org/pipermail/rake-devel/2008-October/000601.html Thank you again for your time. -- Luis Lavena AREA 17 - Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. Douglas Adams From hongli at phusion.nl Mon Oct 27 10:36:00 2008 From: hongli at phusion.nl (Hongli Lai) Date: Mon, 27 Oct 2008 15:36:00 +0100 Subject: [Rake-devel] Bug? Shell output does not get printed in latest Rake releases Message-ID: <4905D1D0.6020603@phusion.nl> The following Rake task task :default do sh "true" end is supposed to cause Rake to print "true" on the terminal. Earlier versions did this, but the latest version of Rake (0.8.3) does not. According to --help, --verbose is turned on by default, and thus Rake is supposed to print any shell commands by default. Running Rake with --verbose explicitly causes shell commands to be printed, as does calling "RakeFileUtils.verbose_flag = true" in the Rakefile. The offending line is in 'def sh' in rake.rb: if RakeFileUtils.verbose_flag == :default options[:verbose] = false ... end .. rake_output_message cmd.join(" ") if options[:verbose] Is this a bug? I think it is, but according to 'git blame', this behavior was added in commit 5bf0bd6b2accbe, which dates back to April 2008. Regards, Hongli Lai -- Phusion | The Computer Science Company Web: http://www.phusion.nl/ E-mail: info at phusion.nl Chamber of commerce no: 08173483 (The Netherlands) From jim.weirich at gmail.com Mon Oct 27 12:07:13 2008 From: jim.weirich at gmail.com (Jim Weirich) Date: Mon, 27 Oct 2008 12:07:13 -0400 Subject: [Rake-devel] Plan for 0.8.4? In-Reply-To: <71166b3b0810251158r5b3aadb9oc23a99f17cbd365d@mail.gmail.com> References: <71166b3b0810230732n21433802ga1346d8819cbbbb4@mail.gmail.com> <3B82576A-ACC5-472F-9D93-9CFEDADAFB77@gmail.com> <71166b3b0810251158r5b3aadb9oc23a99f17cbd365d@mail.gmail.com> Message-ID: <3F8E7A09-CF34-49FF-AF7E-29427EC4D0EC@gmail.com> On Oct 25, 2008, at 2:58 PM, Luis Lavena wrote: > I just addressed some corrections in my fork (under windows branch): > > http://github.com/luislavena/rake/tree/windows > > Basically: > > Consider MinGW also as valid Windows platform, which improves the > support for upcoming one-click installer based on it: > http://github.com/luislavena/rake/commit/49b669ed72891a2a891be31cb8fdde9e54e950c5 > > Reordered how Rake find system-wide Rakefile (HOME, > HOMEDRIVE+HOMEPATH, APPDATA and then USERPROFILE) > http://github.com/luislavena/rake/commit/5813a2ad0e2d277a97e7b84fb9995bf7cb30676c > > Corrected some mocks during Win32 tests that generated some errors > when executing test under Windows: > http://github.com/luislavena/rake/commit/e2a1cb2d766a1dfc503fd5ac0ba1cdbd48b25112 > http://github.com/luislavena/rake/commit/fd75a2c9f27c7655cdc5fccb1b8b0a34ba025d97 > > Corrected some tests and made them platform specific: > http://github.com/luislavena/rake/commit/c7f5273ef87e959ff643d6fc752bc0bdb5d9c57c > > Make Rakefile matching really case insensitive: > http://github.com/luislavena/rake/commit/23275bc752cdc62c50ed79adbe3367acda905cf2 > > Most of those are just to remove the noise around executing test > under Windows. > > I needed to patch that to be able to work and release on other > packages like DataMapper, Merb, Hoe, ParseTree and RubyInline. > > The one pending thing I noticed is how system with multiple args is > working, which I believe I'm missing something from this thread: > > http://rubyforge.org/pipermail/rake-devel/2008-September/000581.html > > And some questions from me here: > > http://rubyforge.org/pipermail/rake-devel/2008-October/000601.html > > Thank you again for your time. Created a ticket for this: http://onestepback.org/redmine/issues/show/29 Will look into these items directly. -- -- Jim Weirich -- jim.weirich at gmail.com From jim.weirich at gmail.com Mon Oct 27 20:53:24 2008 From: jim.weirich at gmail.com (Jim Weirich) Date: Mon, 27 Oct 2008 20:53:24 -0400 Subject: [Rake-devel] Plan for 0.8.4? In-Reply-To: <71166b3b0810251158r5b3aadb9oc23a99f17cbd365d@mail.gmail.com> References: <71166b3b0810230732n21433802ga1346d8819cbbbb4@mail.gmail.com> <3B82576A-ACC5-472F-9D93-9CFEDADAFB77@gmail.com> <71166b3b0810251158r5b3aadb9oc23a99f17cbd365d@mail.gmail.com> Message-ID: On Oct 25, 2008, at 2:58 PM, Luis Lavena wrote: > I just addressed some corrections in my fork (under windows branch): I've pulled your windows branch and have updated my repo. Double check it please. I need to get the release docs up to date and there is a small pending RDoc change I'd like to get in this release. After that I'll be ready to release 0.8.4. -- -- Jim Weirich -- jim.weirich at gmail.com From quixoticsycophant at gmail.com Tue Oct 28 21:17:26 2008 From: quixoticsycophant at gmail.com (James M. Lawrence) Date: Tue, 28 Oct 2008 21:17:26 -0400 Subject: [Rake-devel] Task#prerequisites and Task#needed? Message-ID: <996afcbc0810281817p4f08339yc6d302a3ba19f5e9@mail.gmail.com> When I saw commit 995b742d "fixed namespace task list bug" I was reminded of the problem I had in Drake where Task#prerequisites gave namespace-unqualified task names (http://rubyforge.org/pipermail/rake-devel/2008-September/000574.html). namespace :a do task :x task :y => :x end task :default do p Rake::Task["a:y"].prerequisites #=> ["x"] # should be ["a:x"] ? end Does this work as designed? I had initially conjectured that you wanted a task manager to have context-dependent behavior (where the "x" prereq can mean something different depending on the current namespace), but it doesn't look like Rake is designed this way. The other issue was that File#needed? does not look past its immediate prereqs. file "parent" do touch "parent" end file "child" => "parent" do touch "child" end file "grandchild" => "child" do touch "grandchild" end task :is_grandchild_needed do p Rake::Task["grandchild"].needed? end % rake grandchild (in /Users/jlawrence/test) touch parent touch child touch grandchild % touch parent % rake is_grandchild_needed (in /Users/jlawrence/test) false I hesitate to file bugs because Task#prerequisites and Task#needed? may be intended for internal use only. James M. Lawrence From jim.weirich at gmail.com Thu Oct 30 00:42:38 2008 From: jim.weirich at gmail.com (Jim Weirich) Date: Thu, 30 Oct 2008 00:42:38 -0400 Subject: [Rake-devel] Task#prerequisites and Task#needed? In-Reply-To: <996afcbc0810281817p4f08339yc6d302a3ba19f5e9@mail.gmail.com> References: <996afcbc0810281817p4f08339yc6d302a3ba19f5e9@mail.gmail.com> Message-ID: <9778E04C-ACF4-4767-84D2-56191FCB3773@gmail.com> On Oct 28, 2008, at 9:17 PM, James M. Lawrence wrote: > When I saw commit 995b742d "fixed namespace task list bug" I was > reminded of the problem I had in Drake where Task#prerequisites gave > namespace-unqualified task names > (http://rubyforge.org/pipermail/rake-devel/2008-September/ > 000574.html). > > namespace :a do > task :x > task :y => :x > end > > task :default do > p Rake::Task["a:y"].prerequisites #=> ["x"] > # should be ["a:x"] ? > end > > Does this work as designed? I had initially conjectured that you > wanted a task manager to have context-dependent behavior (where the > "x" prereq can mean something different depending on the current > namespace), but it doesn't look like Rake is designed this way. Yes, this works as designed. The prerequisites are deliberately stored as name references that are looked up in the tasks scope. It is the lookup process that applies the namespace resolution, not the definition process. Although your suggestions makes a lot of sense. I should reevaluate that decision. > The other issue was that File#needed? does not look past its > immediate prereqs. Hmmm, interesting. I will confess that I'm not entirely sure why it works that way, and yet it will correctly rebuild out of date files. I'll take another look at this code when I'm not so tired and maybe enlightenment will occur. (FYI, the needed? method was originally within the first 1 hour of the creation of Rake) -- -- Jim Weirich -- jim.weirich at gmail.com From ittay.dror at gmail.com Thu Oct 30 01:00:59 2008 From: ittay.dror at gmail.com (Ittay Dror (Freiman)) Date: Thu, 30 Oct 2008 07:00:59 +0200 Subject: [Rake-devel] Task#prerequisites and Task#needed? In-Reply-To: <9778E04C-ACF4-4767-84D2-56191FCB3773@gmail.com> References: <996afcbc0810281817p4f08339yc6d302a3ba19f5e9@mail.gmail.com> <9778E04C-ACF4-4767-84D2-56191FCB3773@gmail.com> Message-ID: <667c668f0810292200v2e8354baj5f01c30a4499b80a@mail.gmail.com> On Thu, Oct 30, 2008 at 6:42 AM, Jim Weirich wrote: > > On Oct 28, 2008, at 9:17 PM, James M. Lawrence wrote: > > When I saw commit 995b742d "fixed namespace task list bug" I was >> reminded of the problem I had in Drake where Task#prerequisites gave >> namespace-unqualified task names >> (http://rubyforge.org/pipermail/rake-devel/2008-September/000574.html). >> >> namespace :a do >> task :x >> task :y => :x >> end >> >> task :default do >> p Rake::Task["a:y"].prerequisites #=> ["x"] >> # should be ["a:x"] ? >> end >> >> Does this work as designed? I had initially conjectured that you >> wanted a task manager to have context-dependent behavior (where the >> "x" prereq can mean something different depending on the current >> namespace), but it doesn't look like Rake is designed this way. >> > > Yes, this works as designed. The prerequisites are deliberately stored as > name references that are looked up in the tasks scope. It is the lookup > process that applies the namespace resolution, not the definition process. > > Although your suggestions makes a lot of sense. I should reevaluate that > decision. > > The other issue was that File#needed? does not look past its immediate >> prereqs. >> > > Hmmm, interesting. I will confess that I'm not entirely sure why it works > that way, and yet it will correctly rebuild out of date files. I'll take > another look at this code when I'm not so tired and maybe enlightenment will > occur. (FYI, the needed? method was originally within the first 1 hour of > the creation of Rake) > Isn't it that needed? is called after invoke_prerequisites? Since child has bee invoked, it touched "child" and so grandchild will see that one of its prerequisites is newer. I think this is good for two reasons: 1. performance wise, 2. it means "child" can have some logic in its block to determine if updating itself is needed, only if it updated itself, will "parent" be invoked. Ittay > > > -- > -- Jim Weirich > -- jim.weirich at gmail.com > > > _______________________________________________ > Rake-devel mailing list > Rake-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/rake-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From quixoticsycophant at gmail.com Thu Oct 30 01:23:04 2008 From: quixoticsycophant at gmail.com (James M. Lawrence) Date: Thu, 30 Oct 2008 01:23:04 -0400 Subject: [Rake-devel] Task#prerequisites and Task#needed? In-Reply-To: <9778E04C-ACF4-4767-84D2-56191FCB3773@gmail.com> References: <996afcbc0810281817p4f08339yc6d302a3ba19f5e9@mail.gmail.com> <9778E04C-ACF4-4767-84D2-56191FCB3773@gmail.com> Message-ID: <996afcbc0810292223n1ff1027bvc9d1df40c196e89d@mail.gmail.com> On Thu, Oct 30, 2008 at 12:42 AM, Jim Weirich wrote: > > On Oct 28, 2008, at 9:17 PM, James M. Lawrence wrote: > >> When I saw commit 995b742d "fixed namespace task list bug" I was >> reminded of the problem I had in Drake where Task#prerequisites gave >> namespace-unqualified task names >> (http://rubyforge.org/pipermail/rake-devel/2008-September/000574.html). >> >> namespace :a do >> task :x >> task :y => :x >> end >> >> task :default do >> p Rake::Task["a:y"].prerequisites #=> ["x"] >> # should be ["a:x"] ? >> end >> >> Does this work as designed? I had initially conjectured that you >> wanted a task manager to have context-dependent behavior (where the >> "x" prereq can mean something different depending on the current >> namespace), but it doesn't look like Rake is designed this way. > > Yes, this works as designed. The prerequisites are deliberately stored as > name references that are looked up in the tasks scope. It is the lookup > process that applies the namespace resolution, not the definition process. > > Although your suggestions makes a lot of sense. I should reevaluate that > decision. But the @scope is an attr_reader of Task, which why I said, on the other hand, that it looks like Rake is not designed this way. The lookup always finds the same thing. >> The other issue was that File#needed? does not look past its immediate >> prereqs. > > Hmmm, interesting. I will confess that I'm not entirely sure why it works > that way, and yet it will correctly rebuild out of date files. I'll take > another look at this code when I'm not so tired and maybe enlightenment will > occur. (FYI, the needed? method was originally within the first 1 hour of > the creation of Rake) In the link I gave, I mentioned that the "needed?" flag is correctly propagated by the recursive invoke. The problem only occurs when someone asks for it explicitly, outside of invoke(). This posed a problem for Drake because Drake gathers tasks with a dry run, resulting in grandparent tasks of a dirty file being left out of the dependency graph. I solved it by manually marking parents of a File task (see invoke_prerequisites in Drake). James M. Lawrence