capistrano-new-relic 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/capistrano-new-relic.rb +42 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MzdkM2UxNjQ2OGI2MTk5NTY2OTgyOTEyNjAwMGNlMDU1NDU4OTIzNg==
5
+ data.tar.gz: !binary |-
6
+ ZGNmY2M2ZGNlZjg4NGU2MWUxZWI4NzUzM2Q2MWZlYWZjYzM2Yzk0OA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YTRmODk0MTBjMDExMzhjM2ZmYTNiMGVmYzc1ZWNhNzE0Y2RlODNjZjc5Njcz
10
+ YzA0YjM4OGQ2NzNhMzAyMDVlNTZlYWJmMGE4YzkyMTk3M2FiNWMwMTcyMGE5
11
+ ZWQzNzkxMjc3YTQzNmZmODkxZDVkNWM2MmY0ZTYyNGQxNDJiODk=
12
+ data.tar.gz: !binary |-
13
+ YmQ5M2Q2OTE4YTVlMzEzMWQzNzJlZTM0NGMzNTJmOTAxYmZmMDJkNjk5MmVh
14
+ MThiMzY3MzFiNWI0YmY1MDkxMDNkZTlhZGI3MjVkNjQ4ZDMwMjAyMTNmMjIw
15
+ MzEwY2NkZGZmOTliYWJiNmFlNDcyOWNjZTYzMTQzZjIzMTkyNDY=
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+ require 'capistrano'
3
+ require 'colored'
4
+
5
+ def _cset(name, *args, &block)
6
+ unless exists?(name)
7
+ set(name, *args, &block)
8
+ end
9
+ end
10
+
11
+ Capistrano::Configuration.instance.load do
12
+ _cset(:new_relic_api_key) {
13
+ abort "Please specify the new_relic_api_key either in :new_relic_api_key or in environment NEW_RELIC_API_KEY".red if ENV['NEW_RELIC_API_KEY'].nil?
14
+ ENV['NEW_RELIC_API_KEY']
15
+ }
16
+
17
+ _cset(:new_relic_app_name) { abort "Please specify :newrelic_app_name".red }
18
+ _cset(:deploy_env) { abort "Please specify :deploy_env, needed for sensible description".red }
19
+ _cset(:application) { abort "Please specify :application, needed for sensible description".red }
20
+ _cset(:branch) { abort "Please specify :branch, needed for sensible description".red }
21
+
22
+ namespace :newrelic do
23
+ desc "Notify New Relic of deployment"
24
+ task :notify do
25
+ local_user = run_locally("git config user.name").strip
26
+ local_user_email = run_locally("git config user.email").strip
27
+ current_rev = capture("cd #{latest_release}; git rev-parse HEAD").strip()
28
+ previous_rev = capture("cd #{previous_release}; git rev-parse HEAD").strip()
29
+ changelog = capture("cd #{latest_release}; git log --oneline #{previous_rev}..#{current_rev}")
30
+ run %Q{
31
+ curl -s -H "x-api-key:#{new_relic_api_key}"
32
+ -d "deployment[app_name]=#{new_relic_app_name}"
33
+ -d "deployment[description]=Deploy #{application}/#{branch} to #{deploy_env}"
34
+ -d "deployment[user]=#{local_user} <#{local_user_email}>"
35
+ -d "deployment[revision]=#{current_rev}"
36
+ -d "deployment[changelog]=#{changelog.gsub("\n", ' - ')}"
37
+ https://rpm.newrelic.com/deployments.xml
38
+ >nul 2>&1
39
+ }
40
+ end
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-new-relic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Gunnar Lium
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Capistrano recipe to notify New Relic after deploying code
14
+ email:
15
+ - post@gunnarlium.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/capistrano-new-relic.rb
21
+ homepage: http://github.com/gunnarlium/capistrano-new-relic
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.0.0
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Capistrano New Relic recipe
45
+ test_files: []