Created
April 10, 2013 11:25
-
-
Save satooshi/5353830 to your computer and use it in GitHub Desktop.
pubsub task to notify to Hub server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "notify to PuSH Hub server" | |
task :pubsub do | |
require 'net/http' | |
require 'uri' | |
hub_url = "http://satooshi.superfeedr.com" # <--- replace this with your hub | |
atom_url = "http://blog.satooshi.jp/atom.xml" # <--- replace this with your full feed url | |
resp, data = Net::HTTP.post_form(URI.parse(hub_url), | |
{'hub.mode' => 'publish', | |
'hub.url' => atom_url}) | |
raise "!! Hub notification error: #{resp.code} #{resp.msg}, #{data}" unless resp.code == "204" | |
puts "## Notified hub (" + hub_url + ") that feed #{atom_url} has been updated" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment