Skip to content

Instantly share code, notes, and snippets.

@thermistor
Last active January 29, 2016 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thermistor/08e039f912795166d567 to your computer and use it in GitHub Desktop.
Save thermistor/08e039f912795166d567 to your computer and use it in GitHub Desktop.
Rollbar deploy notification using ENV variable from dotenv
require 'dotenv/tasks'
task notify_rollbar: :dotenv do
on roles(:app) do |h|
revision = `git log -n 1 --pretty=format:"%H"`
local_user = `whoami`.chomp
rollbar_token = ENV['ROLLBAR_ACCESS_TOKEN']
rails_env = fetch(:rails_env, 'production')
execute :curl, "https://api.rollbar.com/api/1/deploy/ -F access_token=#{rollbar_token} -F environment=#{rails_env} -F revision=#{revision} -F local_username=#{local_user} >/dev/null 2>&1", :once => true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment