capistrano-v3-newrelic 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,52 @@
1
+ # rcov generated
2
+ coverage
3
+
4
+ # rdoc generated
5
+ rdoc
6
+
7
+ # yard generated
8
+ doc
9
+ .yardoc
10
+
11
+ # bundler
12
+ .bundle
13
+
14
+ # jeweler generated
15
+ pkg
16
+
17
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
18
+ #
19
+ # * Create a file at ~/.gitignore
20
+ # * Include files you want ignored
21
+ # * Run: git config --global core.excludesfile ~/.gitignore
22
+ #
23
+ # After doing this, these files will be ignored in all your git projects,
24
+ # saving you from having to 'pollute' every project you touch with them
25
+ #
26
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
27
+ #
28
+ # For MacOS:
29
+ #
30
+ .DS_Store
31
+
32
+ # For TextMate
33
+ *.tmproj
34
+ tmtags
35
+
36
+ # For emacs:
37
+ *~
38
+ \#*
39
+ .\#*
40
+
41
+ # For vim:
42
+ *.swp
43
+ *.swo
44
+
45
+ # For redcar:
46
+ .redcar
47
+
48
+ # For rubinius:
49
+ *.rbc
50
+
51
+
52
+ tmp
data/.rbenv-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p125
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color -fd
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,72 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ capistrano-v3-newrelic (0.0.1)
5
+ activesupport
6
+ capistrano (~> 3.1.0)
7
+ capistrano-rails
8
+ capistrano-rbenv (~> 2.0)
9
+ newrelic_rpm (>= 3.7.0)
10
+
11
+ GEM
12
+ remote: http://rubygems.org/
13
+ specs:
14
+ activesupport (4.1.0)
15
+ i18n (~> 0.6, >= 0.6.9)
16
+ json (~> 1.7, >= 1.7.7)
17
+ minitest (~> 5.1)
18
+ thread_safe (~> 0.1)
19
+ tzinfo (~> 1.1)
20
+ capistrano (3.1.0)
21
+ i18n
22
+ rake (>= 10.0.0)
23
+ sshkit (~> 1.3)
24
+ capistrano-bundler (1.1.2)
25
+ capistrano (~> 3.0)
26
+ sshkit (~> 1.2)
27
+ capistrano-rails (1.1.1)
28
+ capistrano (~> 3.1)
29
+ capistrano-bundler (~> 1.1)
30
+ capistrano-rbenv (2.0.2)
31
+ capistrano (~> 3.1)
32
+ sshkit (~> 1.3)
33
+ diff-lcs (1.2.5)
34
+ fakefs (0.5.2)
35
+ i18n (0.6.10)
36
+ json (1.8.1)
37
+ minitest (5.3.3)
38
+ net-scp (1.2.1)
39
+ net-ssh (>= 2.6.5)
40
+ net-ssh (2.9.1)
41
+ newrelic_rpm (3.7.3.204)
42
+ rake (10.2.1)
43
+ rspec (2.14.1)
44
+ rspec-core (~> 2.14.0)
45
+ rspec-expectations (~> 2.14.0)
46
+ rspec-mocks (~> 2.14.0)
47
+ rspec-core (2.14.8)
48
+ rspec-expectations (2.14.5)
49
+ diff-lcs (>= 1.1.3, < 2.0)
50
+ rspec-mocks (2.14.6)
51
+ sshkit (1.4.0)
52
+ net-scp (>= 1.1.2)
53
+ net-ssh (>= 2.8.0)
54
+ term-ansicolor
55
+ term-ansicolor (1.3.0)
56
+ tins (~> 1.0)
57
+ thread_safe (0.3.3)
58
+ tins (1.3.0)
59
+ tzinfo (1.1.0)
60
+ thread_safe (~> 0.1)
61
+ yard (0.8.7.4)
62
+
63
+ PLATFORMS
64
+ ruby
65
+
66
+ DEPENDENCIES
67
+ bundler
68
+ capistrano-v3-newrelic!
69
+ fakefs
70
+ rake
71
+ rspec
72
+ yard
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ capistrano-v3-newrelic
2
+ ======================
3
+
4
+ Capistrano v3 task for New Relic notification about deployment
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ Bundler.setup(:default, :development)
6
+ require 'rake'
7
+ require 'rspec/core/rake_task'
8
+
9
+ RSpec::Core::RakeTask.new(:spec)
10
+
11
+ task :default => :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "capistrano-v3-newrelic"
5
+ s.version = `cat VERSION`
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Ivan Antropov"]
9
+ s.date = "2014-05-29"
10
+ s.description = "Capistrano v3 task for New Relic notification about deployment"
11
+ s.email = ["antropov.ivan@gmail.com"]
12
+ s.extra_rdoc_files = [ "README.md" ]
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.licenses = ["MIT"]
16
+ s.require_paths = ["lib"]
17
+ s.rubygems_version = "1.6.2"
18
+ s.summary = "Sends New Relic deployment notifications"
19
+
20
+ s.add_dependency("capistrano", "~> 3.1.0")
21
+ s.add_dependency("capistrano-rails")
22
+ s.add_dependency("capistrano-rbenv", "~> 2.0")
23
+ s.add_dependency("newrelic_rpm", ">= 3.7.0")
24
+ s.add_dependency("activesupport")
25
+
26
+ s.add_development_dependency("bundler")
27
+ s.add_development_dependency("rake")
28
+ s.add_development_dependency("rspec")
29
+ s.add_development_dependency("yard")
30
+ s.add_development_dependency("fakefs")
31
+ end
@@ -0,0 +1,7 @@
1
+ require 'capistrano/setup'
2
+ require 'capistrano/deploy'
3
+ require 'capistrano/rbenv'
4
+ require 'capistrano/bundler'
5
+
6
+ binding.pry()
7
+ load File.expand_path("../tasks/newrelic.rake", __FILE__)
@@ -0,0 +1,17 @@
1
+ # require 'newrelic/notificator'
2
+
3
+ binding.pry()
4
+ namespace :notification do
5
+
6
+ desc 'Send notification to New Relic'
7
+ task :new_relic do
8
+ env = fetch(:env, "production")
9
+ revision = `git rev-parse HEAD`[0..6]
10
+ puts 'AAAAAAAAAA'
11
+ # notificator = NewRelic::Notificator.new(env, revision, local_user, 'config/newrelic.yml')
12
+ # notificator.notify
13
+ end
14
+
15
+ before :deploy, 'notification:new_relic'
16
+
17
+ end
@@ -0,0 +1 @@
1
+ binding.pry()
@@ -0,0 +1,43 @@
1
+ require 'active_support/hash_with_indifferent_access'
2
+ require 'active_support/core_ext/hash'
3
+ require 'new_relic/cli/command.rb'
4
+ require 'yaml'
5
+
6
+ class NewRelic::Notificator
7
+ def initialize(stage, revision, user, newrelic_config_file)
8
+ @stage = stage
9
+ @revision = revision
10
+ @user = user
11
+ @newrelic_config_file = newrelic_config_file
12
+ end
13
+
14
+ def notify
15
+ new_relic_yml = YAML.load_file(@newrelic_config_file) rescue nil
16
+ unless new_relic_yml
17
+ puts "Can't open New Relic config file!"
18
+ return
19
+ end
20
+
21
+ config = HashWithIndifferentAccess.new(new_relic_yml)[@stage]
22
+
23
+ deploy_options = {
24
+ :revision => @revision,
25
+ :environment => @stage,
26
+ :user => @user,
27
+ :description => config[:description],
28
+ :license_key => config[:license_key],
29
+ :appname => config[:app_name]
30
+ }
31
+
32
+ puts "Uploading deployment to New Relic..."
33
+
34
+ deployment = NewRelic::Cli::Deployments.new deploy_options
35
+ deployment.run
36
+
37
+ puts "Uploaded deployment information to New Relic"
38
+
39
+ rescue => e
40
+ puts "Unable to notify New Relic of the deployment... skipping"
41
+ puts "Error creating New Relic deployment (#{e})\n#{e.message})\n#{e.backtrace.join("\n")}"
42
+ end
43
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe NewRelic::Notificator do
4
+
5
+ it "should load new relic settings and notify" do
6
+ NewRelic::ConfigFaker.with_config do |filename|
7
+ NewRelic::Cli::Deployments.any_instance.should_receive :run
8
+ described_class.new(:test, '123', 'user', filename).notify
9
+ end
10
+ end
11
+
12
+ it "shouldn't notify without config options" do
13
+ NewRelic::Cli::Deployments.any_instance.should_not_receive :run
14
+ described_class.new(:test, '123', 'user', 'filename').notify
15
+ end
16
+
17
+ end
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup(:default, :development, :test)
4
+
5
+ $: << File.join(File.dirname(__FILE__), '../lib/')
6
+
7
+ require 'newrelic/notificator'
8
+
9
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each {|f| require f}
10
+
11
+ RSpec.configure do |config|
12
+ end
@@ -0,0 +1,15 @@
1
+ require 'tempfile'
2
+ module NewRelic::ConfigFaker
3
+ def self.with_config
4
+ options = { :test => {} }
5
+ file = Tempfile.new('newrelic_config')
6
+ begin
7
+ file.write(options.to_yaml)
8
+ file.close
9
+ yield(file.path)
10
+ ensure
11
+ file.close
12
+ file.unlink
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-v3-newrelic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ivan Antropov
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-05-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: &21471940 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *21471940
25
+ - !ruby/object:Gem::Dependency
26
+ name: capistrano-rails
27
+ requirement: &21471560 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *21471560
36
+ - !ruby/object:Gem::Dependency
37
+ name: capistrano-rbenv
38
+ requirement: &21471020 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '2.0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *21471020
47
+ - !ruby/object:Gem::Dependency
48
+ name: newrelic_rpm
49
+ requirement: &21470520 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.7.0
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *21470520
58
+ - !ruby/object:Gem::Dependency
59
+ name: activesupport
60
+ requirement: &21470140 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *21470140
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: &21469680 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *21469680
80
+ - !ruby/object:Gem::Dependency
81
+ name: rake
82
+ requirement: &19134140 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *19134140
91
+ - !ruby/object:Gem::Dependency
92
+ name: rspec
93
+ requirement: &19133520 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *19133520
102
+ - !ruby/object:Gem::Dependency
103
+ name: yard
104
+ requirement: &19132140 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *19132140
113
+ - !ruby/object:Gem::Dependency
114
+ name: fakefs
115
+ requirement: &19130540 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *19130540
124
+ description: Capistrano v3 task for New Relic notification about deployment
125
+ email:
126
+ - antropov.ivan@gmail.com
127
+ executables: []
128
+ extensions: []
129
+ extra_rdoc_files:
130
+ - README.md
131
+ files:
132
+ - .gitignore
133
+ - .rbenv-version
134
+ - .rspec
135
+ - Gemfile
136
+ - Gemfile.lock
137
+ - README.md
138
+ - Rakefile
139
+ - VERSION
140
+ - capistrano-v3-newrelic.gemspec
141
+ - lib/capistrano-v3-newrelic.rb
142
+ - lib/capistrano/newrelic.rb
143
+ - lib/capistrano/tasks/newrelic.rake
144
+ - lib/newrelic/notificator.rb
145
+ - spec/lib/newrelic/notificator_spec.rb
146
+ - spec/spec_helper.rb
147
+ - spec/support/newrelic/config_faker.rb
148
+ homepage:
149
+ licenses:
150
+ - MIT
151
+ post_install_message:
152
+ rdoc_options: []
153
+ require_paths:
154
+ - lib
155
+ required_ruby_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ requirements: []
168
+ rubyforge_project:
169
+ rubygems_version: 1.8.11
170
+ signing_key:
171
+ specification_version: 3
172
+ summary: Sends New Relic deployment notifications
173
+ test_files: []
174
+ has_rdoc: