Forum: Ruby on Rails Capistrano - 'sanity_check' 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.
181976602397443ce119909b9d82cae2?d=identicon&s=25 blinking bear (Guest)
on 2007-07-26 19:25
(Received via mailing list)
I instantly refresh my browser after deploying to make sure nothing went
wrong.  This gets tiring so I added some code to hit the site and print
results after the deployment task has been run.  The Net:HTTP code is
taken
verbatim from the pickaxe Net:HTTP reference.

task :after_deploy, :roles => :app do
  sanity_check
end

desc "Use Net:HTTP to pull up the live site"
task :sanity_check do
  Net::HTTP.start('www.yoursite.com') do |http|
    response = http.get('/')
    puts "Code = #{response.code}"
    puts "Message = #{response.message}"
    response.each do |key,val|
      printf "%-14s = %-40.40s\n", key, val
    end
    p response.body[400,500]
  end
end
This topic is locked and can not be replied to.