Created
August 22, 2014 12:37
-
-
Save ethagnawl/2acc29ea2508cd58a200 to your computer and use it in GitHub Desktop.
Buckethead Tour Date Watcher
This file contains hidden or 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
| require 'pry' | |
| require 'crimp' | |
| require 'net/smtp' | |
| def send_notification(opts={}) | |
| body = <<BODY_END | |
| It appears Buckethead has announced new tour dates! | |
| http://bucketheadland.com/tour/index.html | |
| BODY_END | |
| opts[:to] ||= '[email protected]' | |
| opts[:server] ||= 'localhost' | |
| opts[:from] ||= '[email protected]' | |
| opts[:from_alias] ||= 'Buckethead Tour Dates' | |
| opts[:subject] ||= "[Buckethead] New Tour Dates" | |
| opts[:body] ||= body | |
| msg = <<END_OF_MESSAGE | |
| From: #{opts[:from_alias]} <#{opts[:from]}> | |
| To: <#{opts[:to]}> | |
| Subject: #{opts[:subject]} | |
| #{opts[:body]} | |
| END_OF_MESSAGE | |
| Net::SMTP.start(opts[:server]) do |smtp| | |
| smtp.send_message msg, opts[:from], opts[:to] | |
| end | |
| end | |
| old_html = File.read 'tour.html' | |
| old_signature = Crimp.signature old_html | |
| `wget http://bucketheadland.com/tour/index.html -O tour.html` | |
| new_html = File.read 'tour.html' | |
| new_signature = Crimp.signature new_html | |
| puts old_signature == new_signature | |
| send_notification unless old_signature == new_signature |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment