Skip to content

Instantly share code, notes, and snippets.

@Jaym3s
Created February 1, 2012 17:10
Show Gist options
  • Save Jaym3s/1718079 to your computer and use it in GitHub Desktop.
Save Jaym3s/1718079 to your computer and use it in GitHub Desktop.
pusher_event_script with RVM
#!/usr/bin/env bash
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi
rvm use [email protected]
ruby_program=$(cat <<EOP
require 'pusher'
Pusher.app_id = '<your_app_id>'
Pusher.key = '<your_app_key>'
Pusher.secret = '<your_pusher_secret>'
channel = %Q($1)
event = %Q($2)
data = %Q($3)
if channel && event && data
Pusher[channel].trigger(event, data)
else
puts 'usage: pusher_event <channel> <event> <data>'
end
EOP
)
ruby -e "$ruby_program"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment