Last active
October 15, 2015 17:45
-
-
Save guiniol/37f3bd149e0e4f0b7071 to your computer and use it in GitHub Desktop.
Sup publish hook to send ics invites to google calendar
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
# This hook uses gcalcli to register events with google calendar. You need to configure gcalcli separately for it to work | |
# Non-calendar attachments are opened using `xdg-open` | |
require 'shellwords' | |
case chunk.content_type | |
when "text/calendar", "application/ics" | |
r = IO.popen("/usr/bin/gcalcli --nocolor --reminder=10 --detail_url=short --calendar='<your calendar>' import #{Shellwords.escape filename}", | |
:err => [:child, :out]) | |
flash r.gets | |
else | |
pid = Process.spawn("xdg-open", Shellwords.escape(filename), | |
:out => '/dev/null', | |
:err => '/dev/null') | |
Process.detach pid | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment