Send emails when new comments are made on your gists.
This is useful because Github does not currently send any notifications.
This script uses a file to keep track of the last run time, and has been designed to run alone without any extra gems.
With some defaults:
$ ./notify_of_new_gist_comments github_username recipient_email sender_email email_password
This will notify for public gists only, will use smtp.gmail.com
to send your emails, and use the file /tmp/gist-notifications-last-run-time
to store the last run time in. It's a good idea to create a separate email account for sending emails, so you're not leaving your personal email password lying around in clear text.
To see comments on private gists that you have shared with others, you will need to create a Github OAuth token with the gist
scope here, and pass the token in after the email_password.
With all args:
$ ./notify_of_new_gist_comments github_username recipient_email sender_email email_password github_auth_token smtp.gmail.com last_run_time_file_location
Update com.bethesque.gist-notifications.plist
with appropriate values, and run the following:
cp notify_of_new_gist_comments /usr/local/bin/notify_of_new_gist_comments
chmod +x /usr/local/bin/notify_of_new_gist_comments
sudo mkdir /var/log/gist-notifications
sudo chown $USER:staff /var/log/gist-notifications
cp com.bethesque.gist-notifications.plist $HOME/Library/LaunchAgents/com.bethesque.gist-notifications.plist
launchctl load $HOME/Library/LaunchAgents/com.bethesque.gist-notifications.plist
launchctl start com.bethesque.gist-notifications
To update the launchd config:
launchctl unload $HOME/Library/LaunchAgents/com.bethesque.gist-notifications.plist && \
launchctl load $HOME/Library/LaunchAgents/com.bethesque.gist-notifications.plist && \
launchctl start com.bethesque.gist-notifications
If you get a Net::SMTPAuthenticationError
, and you're sending with gmail, it may be because Google has some security checks around sending emails from new hosts.
Try going to https://accounts.google.com/b/0/DisplayUnlockCaptcha
, submitting, and then running the code again.
For launchd issues, try:
$ tail -f /var/log/system.log
Or
$ tail -f /var/log/gist-notifications/launchd.out