From stuart.hungerford at anu.edu.au Mon Apr 2 20:07:55 2007 From: stuart.hungerford at anu.edu.au (Stuart Hungerford) Date: Tue, 03 Apr 2007 10:07:55 +1000 Subject: [Rake-devel] Multi-part extensions in rules?... Message-ID: <46119ADB.700@anu.edu.au> Hi, I'm using Rake to build various versions of some image files and would like to setup a Rake rule like this: rule ".50.png" => [".tiff"] do |r| # do stuff with r end The rest of the Rakefile sets up a bunch of file tasks where a ".50.png" depends on a ".tiff" file. However Rake doesn't seem to recognize those rules for me and I'm not sure why, so I tried a more general regex based rule: rule(/\.50\.png$/ => [".tiff"]) do |r| # do stuff with r end And that doesn't seem to be recognized either. I think I'm missing something essential about how rules and file tasks work. Can anyone shine a little light on this for me? TIA, Stu -- Stuart Hungerford ANUSF Data Intensive Projects From jim at weirichhouse.org Mon Apr 2 22:08:05 2007 From: jim at weirichhouse.org (Jim Weirich) Date: Mon, 02 Apr 2007 22:08:05 -0400 Subject: [Rake-devel] Multi-part extensions in rules?... In-Reply-To: <46119ADB.700@anu.edu.au> References: <46119ADB.700@anu.edu.au> Message-ID: <4611B705.6080000@weirichhouse.org> Stuart Hungerford wrote: > I'm using Rake to build various versions of some image files and > would like to setup a Rake rule like this: > > rule ".50.png" => [".tiff"] do |r| > # do stuff with r > end > > The rest of the Rakefile sets up a bunch of file tasks where a > ".50.png" depends on a ".tiff" file. However Rake doesn't seem > to recognize those rules for me and I'm not sure why, so I tried > a more general regex based rule: > > > rule(/\.50\.png$/ => [".tiff"]) do |r| > # do stuff with r > end The problem is that (by default), rake doesn't recognize ".50.png" as a file extension. The second rule using a regexp addresses part of the problem, but it doesn't go far enough. You also have to tell rake how to find the source file a match for the rule. Given that it's trying to build 'xxx.50.png', it will try to find a 'xxx.50.tiff'. If you want to drop the 50 part, you have to give rake a proc that convert from the .50.png to just .tiff. Something like this: rule(/\.50\.png$/ => proc { |fn| fn.sub(/\.\d+\.png$/, '.tiff') }) do |r| cp r.source, r.name end I hope I understood your problem correctly. Does that help? -- -- Jim Weirich jim at weirichhouse.org http://onestepback.org -- In theory, practice and theory are the same. -- In practice, they are different. From stuart.hungerford at anu.edu.au Mon Apr 2 23:30:01 2007 From: stuart.hungerford at anu.edu.au (Stuart Hungerford) Date: Tue, 03 Apr 2007 13:30:01 +1000 Subject: [Rake-devel] Multi-part extensions in rules?... In-Reply-To: <4611B705.6080000@weirichhouse.org> References: <46119ADB.700@anu.edu.au> <4611B705.6080000@weirichhouse.org> Message-ID: <4611CA39.7040907@anu.edu.au> Jim Weirich wrote: > [...] > > rule(/\.50\.png$/ => [".tiff"]) do |r| > > # do stuff with r > > end > > The problem is that (by default), rake doesn't recognize ".50.png" as a > file extension. The second rule using a regexp addresses part of the > problem, but it doesn't go far enough. You also have to tell rake how > to find the source file a match for the rule. Given that it's trying to > build 'xxx.50.png', it will try to find a 'xxx.50.tiff'. If you want to > drop the 50 part, you have to give rake a proc that convert from the > .50.png to just .tiff. Something like this: > > rule(/\.50\.png$/ => proc { |fn| fn.sub(/\.\d+\.png$/, '.tiff') }) do |r| > cp r.source, r.name > end > > I hope I understood your problem correctly. Does that help? I think I see now -- many thanks! Stu -- Stuart Hungerford ANUSF Data Intensive Projects From aslak.hellesoy at gmail.com Thu Apr 12 15:45:58 2007 From: aslak.hellesoy at gmail.com (aslak hellesoy) Date: Thu, 12 Apr 2007 21:45:58 +0200 Subject: [Rake-devel] gem task runs task instead of packaging dir when dir and task names are the same Message-ID: <8d961d900704121245ra019fb5ha1199acc503ab1bc@mail.gmail.com> How to reproduce: 1) Download and install the 1.8.6-25 version of the One Click Ruby installer for Windows 2) Check out the RSpec core: svn co svn://rubyforge.org/var/svn/rspec/trunk/rspec/trunk/rspec rspc 3) cd rspec 4) rake gem Apparently, instead of packaging the examples, failing_examples and spec directories, Rake instead decides to run the tasks by these names. The failing_examples task fails (and is intended to fail), but Rake shouldn't be running it in the first place - it should package the dirs. This behaviour has only been observed on Windows, with Ruby 1.8.6-25 and 1.8.5-something - both with Rake 1.7.2. I'd rather not rename tasks and/or directories to work around this. Cheers, Aslak From jim at weirichhouse.org Fri Apr 13 00:07:16 2007 From: jim at weirichhouse.org (Jim Weirich) Date: Fri, 13 Apr 2007 00:07:16 -0400 Subject: [Rake-devel] gem task runs task instead of packaging dir when dir and task names are the same In-Reply-To: <8d961d900704121245ra019fb5ha1199acc503ab1bc@mail.gmail.com> References: <8d961d900704121245ra019fb5ha1199acc503ab1bc@mail.gmail.com> Message-ID: <461F01F4.4060006@weirichhouse.org> aslak hellesoy wrote: > How to reproduce: > > 1) Download and install the 1.8.6-25 version of the One Click Ruby > installer for Windows > 2) Check out the RSpec core: svn co > svn://rubyforge.org/var/svn/rspec/trunk/rspec/trunk/rspec rspc > 3) cd rspec > 4) rake gem > > Apparently, instead of packaging the examples, failing_examples and > spec directories, Rake instead decides to run the tasks by these > names. The failing_examples task fails (and is intended to fail), but > Rake shouldn't be running it in the first place - it should package > the dirs. > > This behaviour has only been observed on Windows, with Ruby 1.8.6-25 > and 1.8.5-something - both with Rake 1.7.2. > > I'd rather not rename tasks and/or directories to work around this. Interesting. MacOSX and Cygwin on windows both work, but I've confirmed the problem with the plain windows installation. I don't know why yet. Thanks for the report. -- -- Jim Weirich jim at weirichhouse.org http://onestepback.org -- In theory, practice and theory are the same. -- In practice, they are different. From Daniel.Berger at qwest.com Mon Apr 30 10:19:31 2007 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Mon, 30 Apr 2007 09:19:31 -0500 Subject: [Rake-devel] Problem with sh on Windows Message-ID: <7524A45A1A5B264FA4809E2156496CFBE72BE9@ITOMAE2KM01.AD.QINTRA.COM> Windows XP Pro, SP2 Ruby 1.8.5/1.8.6 (one click) Rake 0.7.3 (also tried 0.7.2 and 0.7.1) Here's a simple task I have setup: task :install_gem do ruby 'ptools.gemspec' file = Dir['*.gem'].first sh "gem install #{file}" end This works fine on Unix, but on my Windows box it does this: C:\Documents and Settings\djberge\workspace\ptools>rake install_gem --trace (in C:/Documents and Settings/djberge/workspace/ptools) ** Invoke install_gem (first_time) ** Execute install_gem C:/ruby/bin/ruby ptools.gemspec Successfully built RubyGem Name: ptools Version: 1.1.3 File: ptools-1.1.3.gem File: 'ptools-1.1.3.gem' gem install ptools-1.1.3.gem rake aborted! Command failed with status (0): [gem install ptools-1.1.3.gem...] C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:719:in `sh' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:726:in `call' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:726:in `sh' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:805:in `sh' C:/Documents and Settings/djberge/workspace/ptools/rakefile:13 C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `call' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `each' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:392:in `execute' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:362:in `invoke' C:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:355:in `invoke' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `top_level' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `each' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1739:in `top_level' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in `standard_exception_handling' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1733:in `top_level' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1711:in `run' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1761:in `standard_exception_handling' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/lib/rake.rb:1708:in `run' C:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.3/bin/rake:7 C:/ruby/bin/rake.bat:20:in `load' C:/ruby/bin/rake.bat:20 Is this just a known limitation of sh on Windows? I could have sworn it worked in older versions, but perhaps my memory is failing. Thanks, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.