capistrano-raygun-deployment 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDVhZDlhMzllOWM2NjY2ZTJiYjU4OTU3ZTJiMDFmZmRiZjEzOTZkMg==
5
+ data.tar.gz: !binary |-
6
+ ZDE4Y2Y3Nzc2NmEyNzQ1YWRlNTE2N2U4MTBhOGY3NDI0MGUxZjczMw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDJkNzgxMTRmNjk4ZGNkNzBlZjEwYzUyOGQ2YTRiN2FhM2UyMzY1ZDFlNzQ3
10
+ YmU4ZGI3Mjg5ZTczNmY4ZGRhNWZkNDU3OWUwY2EyYmFjYTFmMDYwMjJmNDM2
11
+ NGQ5NjE2ZjE5ZjkyYmFhNDRhYzAyNjI0Yjg2ZjJjYmJhNjAxMzM=
12
+ data.tar.gz: !binary |-
13
+ MTZkOWYwZWQxMzUyMGZmYjkzNWU1M2RjNjkyODcyZWNhZWM3OWMwNmU0ZTZi
14
+ NjI1MTViN2Q5ZWYyYTJhNjA0YzA4NzE0NmZkOGUyNjA0ZTNiMzMyZjY4OTdh
15
+ NjY4YmQ4YjlmNWI0MjI1ZDQ1NDkyMWRhNGYwZmE2MjNjZWNkNDA=
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Mindscape Ltd
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,42 @@
1
+ # capistrano-raygun-deployment
2
+
3
+ Capistrano Raygun Deployment makes it easy to notify Raygun of your deployments using a capistrano task.
4
+
5
+ ## Installation
6
+
7
+ First, install the gem:
8
+
9
+ gem install capistrano-raygun-deployment
10
+
11
+ Or if you are using Bundler, add it to your `Gemfile`:
12
+
13
+ echo "gem 'capistrano-raygun-deployment'" >> Gemfile
14
+ bundle install
15
+
16
+ Then, add the following to your `Capfile`:
17
+
18
+ require 'capistrano/raygun-deployment'
19
+
20
+ Finally, add this configuration to your config:
21
+
22
+ set :raygun_api_key, "YOUR_APPLICATIONS_API_KEY"
23
+ set :raygun_auth_token, "YOUR_EXTERNAL_AUTH_TOKEN"
24
+ set :raygun_release_path, "releases/LATEST" #optional, defaults to RELEASE
25
+ set :use_git, false #optional, for if you don't want to send a git hash with your deployment
26
+
27
+ You'll need the Raygun API Key for your application, plus an External Auth Token which you can generate [here](https://app.raygun.io/user).
28
+
29
+ Finally, create a release file. We default to checking `RELEASE`, but you can change this by setting `:raygun_release_path`
30
+ This is an example release file:
31
+
32
+ version: 6.0.0.0
33
+ ownerName: Jamie Penney
34
+ emailAddress: jamie@example.com
35
+ notes: |
36
+ # Testing out the capistrano plugin
37
+
38
+ * More markdown formatting
39
+
40
+ ### Jamie
41
+
42
+ Once you've written this to `RELEASE`, you can deploy with `cap deploy` and your deployment will be sent to Raygun!
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
File without changes
@@ -0,0 +1 @@
1
+ load File.expand_path('../tasks/raygun-deployment.cap', __FILE__)
@@ -0,0 +1,58 @@
1
+ require 'net/http'
2
+ require 'yaml'
3
+ require 'json'
4
+
5
+ namespace :deploy do
6
+ desc 'Registers a deployment with Raygun'
7
+ task :raygun_register_deployment do
8
+
9
+ if fetch(:raygun_api_key).nil?
10
+ ask(:raygun_api_key, 'Required')
11
+ end
12
+ if fetch(:raygun_auth_token).nil?
13
+ ask(:raygun_auth_token, 'Required')
14
+ end
15
+
16
+ run_locally do
17
+
18
+ yaml = YAML::load_file(fetch(:raygun_release_path, 'RELEASE'))
19
+
20
+ use_git = fetch(:scm) == :git && fetch(:use_git, true)
21
+ git_hash = if use_git && system('git rev-parse --verify HEAD')
22
+ `git rev-parse --verify HEAD`
23
+ else
24
+ ""
25
+ end
26
+
27
+ deployment = {
28
+ 'apiKey' => fetch(:raygun_api_key),
29
+ 'version' => yaml['version'],
30
+ 'ownerName' => yaml['ownerName'],
31
+ 'emailAddress' => yaml['emailAddress'],
32
+ 'comment' => yaml['notes'],
33
+ 'scmIdentifier' => git_hash,
34
+ 'createdAt' => yaml['createdAt']
35
+ }
36
+
37
+ uri = URI.parse(fetch(:raygun_api_uri, "https://app.raygun.io"))
38
+ deploymentEndpoint = "/deployments?authToken=#{fetch(:raygun_auth_token)}"
39
+
40
+ http = Net::HTTP.new(uri.host, uri.port)
41
+ http.use_ssl = fetch(:raygun_use_ssl, true)
42
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
43
+ request = Net::HTTP::Post.new(deploymentEndpoint)
44
+ request.add_field('Content-Type', 'application/json')
45
+ request.body = deployment.to_json
46
+ res = http.request(request)
47
+ case res
48
+ when Net::HTTPSuccess
49
+ # OK
50
+ info "Sent deployment to Raygun"
51
+ else
52
+ raise "Error sending deployment to Raygun: " + res.value
53
+ end
54
+ end
55
+ end
56
+ after :published, :raygun_register_deployment
57
+
58
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-raygun-deployment
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jamie Penney
8
+ - Raygun.io
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-03-09 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: A capistrano task to notify Raygun.io of a deployment
15
+ email: hello@raygun.io
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - LICENSE
21
+ - README.md
22
+ - VERSION
23
+ - lib/capistrano-raygun-deployment.rb
24
+ - lib/capistrano/raygun-deployment.rb
25
+ - lib/capistrano/tasks/raygun-deployment.cap
26
+ homepage: http://github.com/MindscapeHQ/capistrano-raygun-deployment
27
+ licenses:
28
+ - MIT
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.4.6
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: Capistrano Raygun Deployment
50
+ test_files: []