[Rake-devel] Add path ( Pathname to file tasks)

Dominic Sisneros dsisnero at gmail.com
Tue May 18 19:15:16 EDT 2010


I would like to add path to FileTask to make it easier to create file tasks

file 'test.txt' do |t|
  t.path.open('w') do |file|
      file.puts "It works"
end
end

as opposed to
file 'test.txt' do |t|
   File.open( t.name) do |file| ...


   class FileTask < Task

+    attr_reader :path
+
+    def initialize(*args)
+      super
+      @path = Pathname.new(name)
+    end
+
+


The patch also changes directory to use Pathname.ascend so pathname objects
can be used.  It passes all tests

root = Pathname.getwd


tmp = root + 'tmp'

directory tmp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rake-devel/attachments/20100518/5ed5ecd0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pathname.patch
Type: application/octet-stream
Size: 2938 bytes
Desc: not available
URL: <http://rubyforge.org/pipermail/rake-devel/attachments/20100518/5ed5ecd0/attachment.obj>


More information about the Rake-devel mailing list