Created
May 6, 2013 12:03
-
-
Save Arjeno/5524736 to your computer and use it in GitHub Desktop.
New Relic Deployment Notification
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
#!/usr/bin/env ruby | |
# New Relic Deployment Notification | |
require 'new_relic/agent' | |
require 'new_relic/command' | |
config = NewRelic::Agent::Configuration::YamlSource.new(NewRelic::Agent.config[:config_path], ENV['RAILS_ENV']) | |
app_name = config[:app_name] | |
branch = `git branch --no-color | sed -e '/^[^*]/d'`.gsub("*", "").strip | |
description = `git log #{branch} -1 --format="%s"`.chomp | |
user = ENV['DEPLOY_AUTHOR'] | |
revision = ENV['DEPLOYED_REVISION'] | |
deploy_options = { | |
:environment => ENV['RAILS_ENV'], | |
:revision => revision, | |
:description => description, | |
:appname => app_name, | |
:user => user | |
} | |
deployment = NewRelic::Command::Deployments.new deploy_options | |
deployment.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment