Forum: Ruby Nuby Rake questions about FileList or File task

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bob Archer (Guest)
on 2008-12-04 17:24
(Received via mailing list)
Hello all,



It was recommended that I post rake questions here. I couldn't find a
rake specific mail list. If there is one, please point me to it.



I am creating a rake script and my .Net app test projects have
app.config.template files that I want to rename to app.config but only
if app.config doesn't already exist.



So, I am doing the following:



            FileList['**/app.config.template'].each do |src|

                                    cp src,
"#{File.dirname(src)}/app.config" unless
File::exist?("#{File.dirname(src)}/app.config")

                        end



It does work.. but seems like I should be able to do this with a rule or
File task.. but I can't figure out how. Should I just stick with the
above?



Also, what is the order that stuff that is in the rakefile but not in a
task will run. If I want this to happen no matter what task is run
should I put it before any tasks, or does it not matter? Or, should I
really put the above into my compile task?



Finally, I am confused about a File task. Does this run all the time, or
does it need to be called?



Thanks,

BOb
This topic is locked and can not be replied to.