From djberg96 at gmail.com Thu Jan 1 08:58:50 2009 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 01 Jan 2009 06:58:50 -0700 Subject: [Rake-devel] Test failures on Solaris 10 In-Reply-To: <71166b3b0812311611h4e937a53s1a9e4326ae77b08c@mail.gmail.com> References: <495BA113.1030303@qwest.com> <71166b3b0812311611h4e937a53s1a9e4326ae77b08c@mail.gmail.com> Message-ID: <495CCC1A.7080809@gmail.com> Luis Lavena wrote: > On Wed, Dec 31, 2008 at 2:42 PM, Daniel Berger wrote: >> Hi, >> >> This is from the latest git repo using Ruby 1.8.6-p114 on Solaris 10: >> >> Started >> ...................................................................................................................................................................................................................................................................................................F...F.F..................................................... >> Finished in 20.571438 seconds. >> >> 1) Failure: >> test_default_arguements_that_dont_match_names_are_ignored(TestTaskArguments) >> [./test/test_task_arguments.rb:87]: >> expected but was >> <"cc">. >> >> 2) Failure: >> test_extra_names_are_nil(TestTaskArguments) >> [./test/test_task_arguments.rb:50]: >> expected but was >> <"cc">. >> >> 3) Failure: >> test_named_args(TestTaskArguments) [./test/test_task_arguments.rb:40]: >> expected but was >> <"cc">. >> >> 351 tests, 964 assertions, 3 failures, 0 errors >> rake aborted! >> Command failed with status (1): [/usr/local/bin/ruby -w -Ilib >> "/usr/local/l...] >> >> I think I brought this up before, but people thought it was a Windows issue. >> I think the problem is that I've got my CC environment variable set to "cc". >> >> I'm not sure what's supposed to happen in that case, though. >> > > Basically, Rake::TaskArguments is checking for cc being defined as > argument for a Task, and then fallback to ENV looking for it: > > def lookup(name) > if @hash.has_key?(name) > @hash[name] > elsif ENV.has_key?(name.to_s) > ENV[name.to_s] > elsif ENV.has_key?(name.to_s.upcase) > ENV[name.to_s.upcase] > elsif @parent > @parent.lookup(name) > end > end > > > So, let's say I have defined a task named foo, with a named argument > called cc and will default to ENV['CC'] if no CC is provided with the > task (rake foo[something-for-cc] > > I believe that fallback on ENV is a non documented behavior of task arguments? That's interesting, and not something I knew. A little surprising maybe even. Anyway, if that's the correct behavior then the tests simply need to be updated. Thanks, Dan From jim.weirich at gmail.com Thu Jan 1 16:25:17 2009 From: jim.weirich at gmail.com (Jim Weirich) Date: Thu, 1 Jan 2009 16:25:17 -0500 Subject: [Rake-devel] Test failures on Solaris 10 In-Reply-To: <495CCC1A.7080809@gmail.com> References: <495BA113.1030303@qwest.com> <71166b3b0812311611h4e937a53s1a9e4326ae77b08c@mail.gmail.com> <495CCC1A.7080809@gmail.com> Message-ID: <0B22E7B1-AE63-4A1B-B049-71C5B8E95B21@gmail.com> On Jan 1, 2009, at 8:58 AM, Daniel Berger wrote: > Luis Lavena wrote: >> On Wed, Dec 31, 2008 at 2:42 PM, Daniel Berger > > wrote: >>> Hi, >>> >>> This is from the latest git repo using Ruby 1.8.6-p114 on Solaris >>> 10: >>> >>> Started >>> ...................................................................................................................................................................................................................................................................................................F...F.F..................................................... >>> Finished in 20.571438 seconds. >>> >>> 1) Failure: >>> test_default_arguements_that_dont_match_names_are_ignored >>> (TestTaskArguments) >>> [./test/test_task_arguments.rb:87]: >>> expected but was >>> <"cc">. >>> >>> 2) Failure: >>> test_extra_names_are_nil(TestTaskArguments) >>> [./test/test_task_arguments.rb:50]: >>> expected but was >>> <"cc">. >>> >>> 3) Failure: >>> test_named_args(TestTaskArguments) [./test/test_task_arguments.rb: >>> 40]: >>> expected but was >>> <"cc">. >>> >>> 351 tests, 964 assertions, 3 failures, 0 errors >>> rake aborted! >>> Command failed with status (1): [/usr/local/bin/ruby -w -Ilib >>> "/usr/local/l...] >>> >>> I think I brought this up before, but people thought it was a >>> Windows issue. >>> I think the problem is that I've got my CC environment variable >>> set to "cc". >>> >>> I'm not sure what's supposed to happen in that case, though. >>> >> Basically, Rake::TaskArguments is checking for cc being defined as >> argument for a Task, and then fallback to ENV looking for it: >> def lookup(name) >> if @hash.has_key?(name) >> @hash[name] >> elsif ENV.has_key?(name.to_s) >> ENV[name.to_s] >> elsif ENV.has_key?(name.to_s.upcase) >> ENV[name.to_s.upcase] >> elsif @parent >> @parent.lookup(name) >> end >> end >> So, let's say I have defined a task named foo, with a named argument >> called cc and will default to ENV['CC'] if no CC is provided with the >> task (rake foo[something-for-cc] >> I believe that fallback on ENV is a non documented behavior of task >> arguments? > > That's interesting, and not something I knew. A little surprising > maybe even. > > Anyway, if that's the correct behavior then the tests simply need to > be updated. > > Thanks, > > Dan Created a RedMine ticket for this (http://onestepback.org/redmine/issues/show/43 ). Thanks for the update. -- -- Jim Weirich -- jim.weirich at gmail.com From luislavena at gmail.com Tue Jan 6 00:05:53 2009 From: luislavena at gmail.com (Luis Lavena) Date: Tue, 6 Jan 2009 03:05:53 -0200 Subject: [Rake-devel] Status of 0.8.3.100 Message-ID: <71166b3b0901052105p74784933r3e17e771ac491a7c@mail.gmail.com> Hello Jim, I'm happy to report that couldn't find any blockers/bugs with latest gem from GitHub. However, I'm worried about two things that is blocking myself in my work with One-Click installer. #40 : Task parameters and default values ignored http://onestepback.org/redmine/issues/show/40 I was relying on taskname[version] to allow building of different version of packages, but seems since the task argument is named "version" in both cases, it always overrides it. Also, the lack of print of command being executed, as reported by Hongli Lai: http://rubyforge.org/pipermail/rake-devel/2008-October/000607.html Any comment on these two things? I've manually patched both cases, but I will like to know your PoV before the new release. Thank you, -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry From jim.weirich at gmail.com Tue Jan 6 01:17:19 2009 From: jim.weirich at gmail.com (Jim Weirich) Date: Tue, 6 Jan 2009 01:17:19 -0500 Subject: [Rake-devel] Status of 0.8.3.100 In-Reply-To: <71166b3b0901052105p74784933r3e17e771ac491a7c@mail.gmail.com> References: <71166b3b0901052105p74784933r3e17e771ac491a7c@mail.gmail.com> Message-ID: <342DD893-BB45-432C-81B6-042C46637D11@gmail.com> On Jan 6, 2009, at 12:05 AM, Luis Lavena wrote: > Hello Jim, > > I'm happy to report that couldn't find any blockers/bugs with latest > gem from GitHub. > > However, I'm worried about two things that is blocking myself in my > work with One-Click installer. > > #40 : Task parameters and default values ignored > http://onestepback.org/redmine/issues/show/40 > > I was relying on taskname[version] to allow building of different > version of packages, but seems since the task argument is named > "version" in both cases, it always overrides it. This is by design. Since there is no way to explicitly pass task parameters to prerequisites, the only way to propagate task parameters is on a name matching basis. I would be open to suggestions on better ways to handle this. > Also, the lack of print of command being executed, as reported by > Hongli Lai: > > http://rubyforge.org/pipermail/rake-devel/2008-October/000607.html I wasn't sure at first, but I think I agree that this is a bug. A patch and unit test would be welcome. -- -- Jim Weirich -- jim.weirich at gmail.com From quixoticsycophant at gmail.com Tue Jan 6 08:49:15 2009 From: quixoticsycophant at gmail.com (James M. Lawrence) Date: Tue, 6 Jan 2009 08:49:15 -0500 Subject: [Rake-devel] Status of 0.8.3.100 In-Reply-To: <71166b3b0901052105p74784933r3e17e771ac491a7c@mail.gmail.com> References: <71166b3b0901052105p74784933r3e17e771ac491a7c@mail.gmail.com> Message-ID: <996afcbc0901060549k527b0815u9330e9ae072e8aa9@mail.gmail.com> Now that 1.9 fixes the system() problem, there should be a RUBY_VERSION check in Rake. I just asked on ruby-core whether it will be backported to 1.8 (probably not). But we should wait to hear back. The system() workaround has been simplified since the first pass reflected in 8.3.100. When we know which RUBY_VERSION to check, I'll send a pull request. Or you can pull my current mainline-rake branch which assumes the 1.9 fixes won't be backported. James M. Lawrence From luislavena at gmail.com Tue Jan 6 14:00:40 2009 From: luislavena at gmail.com (Luis Lavena) Date: Tue, 6 Jan 2009 17:00:40 -0200 Subject: [Rake-devel] Status of 0.8.3.100 In-Reply-To: <342DD893-BB45-432C-81B6-042C46637D11@gmail.com> References: <71166b3b0901052105p74784933r3e17e771ac491a7c@mail.gmail.com> <342DD893-BB45-432C-81B6-042C46637D11@gmail.com> Message-ID: <71166b3b0901061100v6ef2626euc9124f84748b12a0@mail.gmail.com> On Tue, Jan 6, 2009 at 4:17 AM, Jim Weirich wrote: > > On Jan 6, 2009, at 12:05 AM, Luis Lavena wrote: > >> Hello Jim, >> >> I'm happy to report that couldn't find any blockers/bugs with latest >> gem from GitHub. >> >> However, I'm worried about two things that is blocking myself in my >> work with One-Click installer. >> >> #40 : Task parameters and default values ignored >> http://onestepback.org/redmine/issues/show/40 >> >> I was relying on taskname[version] to allow building of different >> version of packages, but seems since the task argument is named >> "version" in both cases, it always overrides it. > > This is by design. > > Since there is no way to explicitly pass task parameters to prerequisites, > the only way to propagate task parameters is on a name matching basis. Ok, that's explain the reason, and that render my option useless :-P I thought that #with_defaults helped and in case you wanted something different, you could ask for it: rake gcc[4.4.0] ruby[1.9.1] Where ruby depends on gcc, and forcing the version on gcc changed the default one. > I would be open to suggestions on better ways to handle this. Anyhow, due this I worked on alternatives ;-) >> Also, the lack of print of command being executed, as reported by Hongli >> Lai: >> >> http://rubyforge.org/pipermail/rake-devel/2008-October/000607.html > > I wasn't sure at first, but I think I agree that this is a bug. A patch and > unit test would be welcome. > Hongli Lai? can you provide a patch for this? (hands full for the rest of the week, sorry). -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry From Dominik.Mayer at beagile.de Tue Jan 13 06:42:06 2009 From: Dominik.Mayer at beagile.de (Dominik Mayer) Date: Tue, 13 Jan 2009 12:42:06 +0100 Subject: [Rake-devel] How to pass arguments to Rake::Task['name'].invoke ? Message-ID: <1231846926.13878.9.camel@n0ne-mobil.noisenation> hallo everyone! i already tried to find an answer to this question on google and posted it on the ruby-mailing list, but i had no success so far in solving my issue. i detail my problem is the following: i'm using rake with RubyOnRails and want to invoke a task from inside another task. at the moment i do this with system calls like the following: system 'rake db:migrate VERSION=0' or `rake db:drop RAILS_ENV=test` what i try to do now is something like that (inside another rake-task): Rake::Task['db:migrate'].invoke(:version => 0) # to pass VERSION=0 or Rake::Task['db:drop'].execute(RAILS_ENV, test) nothing has worked so far. arguments get ignored or result in errors. what's the right way to do such a thing? thanks in advance dominik -------------- next part -------------- An HTML attachment was scrubbed... URL: From luislavena at gmail.com Tue Jan 13 07:17:21 2009 From: luislavena at gmail.com (Luis Lavena) Date: Tue, 13 Jan 2009 10:17:21 -0200 Subject: [Rake-devel] How to pass arguments to Rake::Task['name'].invoke ? In-Reply-To: <1231846926.13878.9.camel@n0ne-mobil.noisenation> References: <1231846926.13878.9.camel@n0ne-mobil.noisenation> Message-ID: <71166b3b0901130417s22607aces8c7d242e802b39ed@mail.gmail.com> On Tue, Jan 13, 2009 at 9:42 AM, Dominik Mayer wrote: > hallo everyone! > > i already tried to find an answer to this question on google and posted > it on the ruby-mailing list, but i had no success so far in solving my > issue. > > i detail my problem is the following: > i'm using rake with RubyOnRails and want to invoke a task from inside > another task. at the moment i do this with system calls like the > following: > > > system 'rake db:migrate VERSION=0' > or > `rake db:drop RAILS_ENV=test` > > > what i try to do now is something like that (inside another rake-task): > > > Rake::Task['db:migrate'].invoke(:version => 0) # to pass VERSION=0 > or > Rake::Task['db:drop'].execute(RAILS_ENV, test) > > > nothing has worked so far. arguments get ignored or result in errors. > what's the right way to do such a thing? > If you check the task source code, you will see it uses ENV to find the parameters. Because of that, you cannot invoke or execute the task in the way you're doing. Instead you should: ENV['VERSION'] = '0' Rake::Task['db:migrate'].invoke If Rails update the task to take paramenters, you could invoke it with the first syntax you tried. Hope it helps, -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry From hongli at phusion.nl Tue Jan 13 07:40:27 2009 From: hongli at phusion.nl (Hongli Lai) Date: Tue, 13 Jan 2009 13:40:27 +0100 Subject: [Rake-devel] How to pass arguments to Rake::Task['name'].invoke ? In-Reply-To: <1231846926.13878.9.camel@n0ne-mobil.noisenation> References: <1231846926.13878.9.camel@n0ne-mobil.noisenation> Message-ID: <144957280901130440q3d8f08calcffb7d819d3a596f@mail.gmail.com> On Tue, Jan 13, 2009 at 12:42 PM, Dominik Mayer wrote: > hallo everyone! > > i already tried to find an answer to this question on google and posted > it on the ruby-mailing list, but i had no success so far in solving my > issue. > > i detail my problem is the following: > i'm using rake with RubyOnRails and want to invoke a task from inside > another task. at the moment i do this with system calls like the > following: > > > system 'rake db:migrate VERSION=0' > or > `rake db:drop RAILS_ENV=test` > > > what i try to do now is something like that (inside another rake-task): > > > Rake::Task['db:migrate'].invoke(:version => 0) # to pass VERSION=0 > or > Rake::Task['db:drop'].execute(RAILS_ENV, test) > > > nothing has worked so far. arguments get ignored or result in errors. > what's the right way to do such a thing? > > thanks in advance > dominik Arguments are passed through environment variables. Try this: ENV['RAILS_ENV'] = "production" Rake::Task['db:migrate].invoke -- Phusion | The Computer Science Company Web: http://www.phusion.nl/ E-mail: info at phusion.nl Chamber of commerce no: 08173483 (The Netherlands) From dominik.mayer at beagile.de Tue Jan 13 08:26:03 2009 From: dominik.mayer at beagile.de (Dominik Mayer) Date: Tue, 13 Jan 2009 14:26:03 +0100 Subject: [Rake-devel] How to pass arguments to Rake::Task['name'].invoke ? In-Reply-To: <71166b3b0901130417s22607aces8c7d242e802b39ed@mail.gmail.com> References: <1231846926.13878.9.camel@n0ne-mobil.noisenation> <71166b3b0901130417s22607aces8c7d242e802b39ed@mail.gmail.com> Message-ID: <1231853163.15883.4.camel@n0ne-mobil.noisenation> thanks for your reply! sadly this only works for ENV['VERSION'] but not for ENV['RAILS_ENV'] so if i'm in development-environment, the following would not drop my test-db (unfortunately it would drop my development-db): ENV['RAILS_ENV'] = 'test' Rake::Task['db:drop'].invoke any other ideas on that? Am Dienstag, den 13.01.2009, 10:17 -0200 schrieb Luis Lavena: > If you check the task source code, you will see it uses ENV to find > the parameters. > > Because of that, you cannot invoke or execute the task in the way > you're doing. Instead you should: > > ENV['VERSION'] = '0' > Rake::Task['db:migrate'].invoke > > If Rails update the task to take paramenters, you could invoke it with > the first syntax you tried. > > Hope it helps, From luislavena at gmail.com Tue Jan 13 08:43:40 2009 From: luislavena at gmail.com (Luis Lavena) Date: Tue, 13 Jan 2009 11:43:40 -0200 Subject: [Rake-devel] How to pass arguments to Rake::Task['name'].invoke ? In-Reply-To: <1231853163.15883.4.camel@n0ne-mobil.noisenation> References: <1231846926.13878.9.camel@n0ne-mobil.noisenation> <71166b3b0901130417s22607aces8c7d242e802b39ed@mail.gmail.com> <1231853163.15883.4.camel@n0ne-mobil.noisenation> Message-ID: <71166b3b0901130543h1ce1e73csff94fc46eda205db@mail.gmail.com> On Tue, Jan 13, 2009 at 11:26 AM, Dominik Mayer wrote: > thanks for your reply! > > sadly this only works for > > ENV['VERSION'] > > but not for > > ENV['RAILS_ENV'] > > so if i'm in development-environment, the following would not drop my > test-db (unfortunately it would drop my development-db): > > ENV['RAILS_ENV'] = 'test' > Rake::Task['db:drop'].invoke > > any other ideas on that? > Looks like your rails environment already initialized? your task is depending on :environment? You should try setting ENV['RAILS_ENV'] and also changing RAILS_ENV constant (or at list check if it's defined). -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup?ry From hongli at phusion.nl Tue Jan 13 08:54:39 2009 From: hongli at phusion.nl (Hongli Lai) Date: Tue, 13 Jan 2009 14:54:39 +0100 Subject: [Rake-devel] How to pass arguments to Rake::Task['name'].invoke ? In-Reply-To: <1231853163.15883.4.camel@n0ne-mobil.noisenation> References: <1231846926.13878.9.camel@n0ne-mobil.noisenation> <71166b3b0901130417s22607aces8c7d242e802b39ed@mail.gmail.com> <1231853163.15883.4.camel@n0ne-mobil.noisenation> Message-ID: <496C9D1F.3010507@phusion.nl> Dominik Mayer wrote: > thanks for your reply! > > sadly this only works for > > ENV['VERSION'] > > but not for > > ENV['RAILS_ENV'] > > so if i'm in development-environment, the following would not drop my > test-db (unfortunately it would drop my development-db): > > ENV['RAILS_ENV'] = 'test' > Rake::Task['db:drop'].invoke > > any other ideas on that? That's because Rails is already loaded when your Rakefile is loaded. If you want to enforce a different RAILS_ENV, then you must launch a new Rake process which will re-initialize Rails. For example: ENV['RAILS_ENV'] = 'test' sh("rake db:drop") -- Phusion | The Computer Science Company Web: http://www.phusion.nl/ E-mail: info at phusion.nl Chamber of commerce no: 08173483 (The Netherlands) From dominik.mayer at beagile.de Tue Jan 13 09:43:30 2009 From: dominik.mayer at beagile.de (Dominik Mayer) Date: Tue, 13 Jan 2009 15:43:30 +0100 Subject: [Rake-devel] How to pass arguments to Rake::Task['name'].invoke ? In-Reply-To: <496C9D1F.3010507@phusion.nl> References: <1231846926.13878.9.camel@n0ne-mobil.noisenation> <71166b3b0901130417s22607aces8c7d242e802b39ed@mail.gmail.com> <1231853163.15883.4.camel@n0ne-mobil.noisenation> <496C9D1F.3010507@phusion.nl> Message-ID: <1231857810.15883.18.camel@n0ne-mobil.noisenation> Am Dienstag, den 13.01.2009, 11:43 -0200 schrieb Luis Lavena: > Looks like your rails environment already initialized? your task is > depending on :environment? yes it is. > You should try setting ENV['RAILS_ENV'] and also changing RAILS_ENV > constant (or at list check if it's defined). i already tried that, without success. Am Dienstag, den 13.01.2009, 14:54 +0100 schrieb Hongli Lai: > That's because Rails is already loaded when your Rakefile is loaded. exactly. > If you want to enforce a different RAILS_ENV, then you must launch a > new Rake process which will re-initialize Rails. For example: > > ENV['RAILS_ENV'] = 'test' > sh("rake db:drop") or like i'm doing it now: system('rake db:drob RAILS_ENV=test') seems like there is no other way. thanks anyway for your help! /MaD From mgassmann at amberg.ch Tue Jan 13 12:24:37 2009 From: mgassmann at amberg.ch (mgassmann at amberg.ch) Date: Tue, 13 Jan 2009 18:24:37 +0100 Subject: [Rake-devel] Michael Gassmann is abroad. Message-ID: Ich werde ab 13.01.2009 nicht im B?ro sein. Ich kehre zur?ck am 15.01.2009. i'll answer your mail as soon as i am back. in urgent cases please send me a message on my mobile (+41 79 355 9367). thank you.