[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Rake TestTask running its block anytime rake is invoked

Adam Anderson

9/19/2007 7:18:00 AM

--
require 'rake/testtask'

Rake::TestTask.new do |t|
chdir './../'
puts pwd
end

desc "print working directory"
task :pwd do
puts "Working Directory #{pwd}"
end
--

$ rake -T
cd ./../
/Users/scudco/projects
rake chdir # change directory
rake test # Run tests

$ rake chdir
cd ./../
/Users/scudco/projects
Working Directory /Users/scudco/projects


So the question is why does the chdir in the TestTask get executed every
time no matter what? It is quite frustrating when code specific to a
block is being executed for every other task. Any ideas?
--
Posted via http://www.ruby-....

1 Answer

Adam Anderson

9/19/2007 8:41:00 AM

0

--
require 'rake/testtask'

Rake::TestTask.new do |t|
chdir './../'
puts pwd
end

desc "print working directory"
task :pwd do
puts "Working Directory #{pwd}"
end
--

$ rake -T
cd ./../
/Users/scudco/projects
rake pwd # print working directory
rake test # Run tests

$ rake pwd
cd ./../
/Users/scudco/projects
Working Directory /Users/scudco/projects

Attachments:
http://www.ruby-...attachment/31...

--
Posted via http://www.ruby-....