The real problem is that GemPackageTask uses the FileList to create a 
list of dependencies which is done prior to parsing and running a task 
(line 82):

    # File lib/rake/gempackagetask.rb, line 77
77:     def define
78:       super
79:       task :package => [:gem]
80:       desc "Build the gem file #{gem_file}"
81:       task :gem => ["#{package_dir}/#{gem_file}"]
82:       file "#{package_dir}/#{gem_file}" => [package_dir] + 
@gem_spec.files do
83:         when_writing("Creating GEM") {
84:           Gem::Builder.new(gem_spec).build
85:           verbose(true) {
86:             mv gem_file, "#{package_dir}/#{gem_file}"
87:           }
88:         }
89:       end
90:     end

So your spec.files is read every time rake is ran.

This also has a side effect that you can not have your :package task 
dependent upon any tasks that are responsible for creating files in the 
gem_spec.files array, because the files array is read before any other 
tasks are ran.

Kind of a bummer as what I'd really like is:

task :package => [:clean, :docs]

Have fun,
Roy
-- 
Posted via http://www.ruby-forum.com/.