rake-raygun-deployment 1.0.0

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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZDdhZTg3NDZmMmIwYTMxOWRkOWNiMzFhNzViYmNlNzcwOWUwOGE0MQ==
5
+ data.tar.gz: !binary |-
6
+ NDYwY2QxNWI3MDg2OTBmMWEwMTFjMWZmZjQzYTkzZTRlMGUyZGI1OA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZTVhNzc0ODdlNDA1ZDQxMDFlMWVmMmU4NTFkZmM5OGRjN2QyNjAzOWZiMTlh
10
+ MWVkMGM3YTM0ZTgzMGU4ZGI4ZGVlZjE1NmUxODM0MjNmYTU4ODQ0NGY0Yzc4
11
+ M2Q2MGMwNTA2NDUzMTE5OTBkOTI4MTBhNGExMDE0MjRlN2IyMjc=
12
+ data.tar.gz: !binary |-
13
+ MzliODFmMGEzNjI3YTU3MGIzNzc2NzI0NzdjOWEzMWIxZWViMTNkYTdkODBh
14
+ OTY3YWJlZDc1NzVmNDQ0YzBmYTU0YmEwMjIzODc2Y2I1M2QzYzk0ZDAxNDFi
15
+ NTY0ZWI1MjFjNmVkOTAxMTFhMTkyNzQ3MDRjNzQxMTkyZDYzOTc=
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.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # rake-raygun-deployment
2
+
3
+ Rake Raygun Deployment makes it easy to notify Raygun of your deployments using a rake task.
4
+
5
+ ## Installation
6
+
7
+ First, install the gem:
8
+
9
+ gem install rake-raygun-deployment
10
+
11
+ Or if you are using Bundler, add it to your `Gemfile`:
12
+
13
+ echo "gem 'rake-raygun-deployment'" >> Gemfile
14
+ bundle install
15
+
16
+ Then, add the following to your `Rakefile`:
17
+
18
+ require 'rake-raygun-deployment'
19
+
20
+ Rake::RaygunDeployment.new(:raygun_deployment) do
21
+ releasePath "releases/LATEST"
22
+ authToken "YOUR_EXTERNAL_AUTH_TOKEN"
23
+ apiKey "YOUR_APPLICATIONS_API_KEY"
24
+ end
25
+
26
+ 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).
27
+
28
+ Finally, create a release file. We default to checking `releases/LATEST`, so recommend add a release file for each time you deploy and symlink the latest one to `LATEST`.
29
+ This is an example release file:
30
+
31
+ version: 6.0.0.0
32
+ ownerName: Jamie Penney
33
+ emailAddress: jamie@example.com
34
+ notes: |
35
+ # Testing out the rake plugin
36
+
37
+ * More markdown formatting
38
+
39
+ ### Jamie
40
+
41
+ Once you've written this to `releases/LATEST`, run `rake raygun_deployment` and your deployment will be sent to Raygun!
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1 @@
1
+ require 'rake/raygun-deployment'
@@ -0,0 +1,108 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+ require 'net/http'
4
+ require 'yaml'
5
+ require 'json'
6
+
7
+ class Rake::RaygunDeployment < Rake::TaskLib
8
+
9
+ def initialize(name=:raygun_deployment, &block)
10
+ @releaseFilePath = nil
11
+ @apiUri = nil
12
+ @apiKey = nil
13
+ @authToken = nil
14
+ @use_ssl = true
15
+ @use_git = true
16
+
17
+ @config = block
18
+ desc "Sends the latest deployment information to Raygun" unless Rake.application.last_comment
19
+ task name do
20
+ invoke
21
+ end
22
+ end
23
+
24
+ def releasePath(path)
25
+ @releaseFilePath = path;
26
+ end
27
+
28
+ def use_git(git)
29
+ @use_git = git
30
+ end
31
+
32
+ def use_ssl(ssl)
33
+ @use_ssl = ssl
34
+ end
35
+
36
+ def authToken(token)
37
+ @authToken = token
38
+ end
39
+
40
+ def apiKey(key)
41
+ @apiKey = key;
42
+ end
43
+
44
+ def apiUri(uri)
45
+ @apiUri = uri;
46
+ end
47
+
48
+ def get_git_hash
49
+ if @use_git && system('git rev-parse --verify HEAD')== true
50
+ return `git rev-parse --verify HEAD`
51
+ elsif @use_git
52
+ puts 'could not get git commit info. Set `use_git false` to disable this message'
53
+ end
54
+
55
+ ""
56
+ end
57
+
58
+ def get_deployment
59
+ raise "Need to set an authToken" if @authToken == nil
60
+ raise "Need to set an apiKey" if @apiKey == nil
61
+
62
+ @releaseFilePath ||= 'RELEASE'
63
+ @apiUri ||= 'https://app.raygun.io'
64
+
65
+ yaml = YAML::load_file(@releaseFilePath)
66
+
67
+ if yaml == false
68
+ raise "Invalid release file found at " + @releaseFilePath
69
+ end
70
+
71
+ return {
72
+ 'apiKey' => @apiKey,
73
+ 'version' => yaml['version'],
74
+ 'ownerName' => yaml['ownerName'],
75
+ 'emailAddress' => yaml['emailAddress'],
76
+ 'comment' => yaml['notes'],
77
+ 'scmIdentifier' => get_git_hash,
78
+ 'createdAt' => yaml['createdAt']
79
+ }
80
+ end
81
+
82
+ def invoke
83
+ instance_eval(&@config) unless @config == nil
84
+ deployment = get_deployment
85
+ send_deployment(deployment, URI.parse(@apiUri))
86
+ end
87
+
88
+ def send_deployment(deployment, uri)
89
+ http = Net::HTTP.new(uri.host, uri.port)
90
+ http.use_ssl = @use_ssl
91
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
92
+ request = Net::HTTP::Post.new("/deployments?authToken=#{@authToken}")
93
+ request.add_field('Content-Type', 'application/json')
94
+ request.body = deployment.to_json
95
+ res = http.request(request)
96
+ case res
97
+ when Net::HTTPSuccess
98
+ # OK
99
+ puts "Sent deployment to Raygun"
100
+ when Net::HTTPRedirection
101
+ puts "Authentication error - check your authToken and apiKey"
102
+ puts res.value
103
+ else
104
+ raise "Error sending deployment to Raygun: " + res.value
105
+ end
106
+ end
107
+
108
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake-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 rake 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/rake-raygun-deployment.rb
24
+ - lib/rake/raygun-deployment.rb
25
+ homepage: http://github.com/MindscapeHQ/rake-raygun-deployment
26
+ licenses:
27
+ - MIT
28
+ metadata: {}
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubyforge_project:
45
+ rubygems_version: 2.4.6
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Rake Raygun Deployment
49
+ test_files: []