I see a strange thing in my rake script today. I have two Rake tasks under the different namespaces like following:
path = "/home/tomcat/tomcat"
namespace :stage do
path = "/home/tomcat/stage-tomcat"
desc "Deploys a java application to stage tomcat"
task :java_deploy do
puts path # stage:java_deploy should print /home/tomcat/stage-tomcat
end
end
namespace :production do
path = "/home/tomcat/production-tomcat"
desc "Deploys a java application to production tomcat"
task :java_deploy do
puts path # production:java_deploy should print /home/tomcat/production-tomcat
end
end
When I run: rake stage:java_deploy
it prints
/home/tomcat/production-tomcat
I was expecting /home/tomcat/stage-tomcat. If I remove the very first line path = "/home/tomcat/tomcat"
from the rake file, it works as expected.
Any idea why this kolavari? :)
Thanks in advance!!