mina-rollbar 1.0.0 → 1.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.
- checksums.yaml +5 -5
- data/.editorconfig +14 -0
- data/LICENSE.txt +1 -1
- data/README.md +8 -11
- data/lib/mina/rollbar/tasks.rb +38 -28
- data/lib/mina/rollbar/version.rb +1 -1
- data/mina-rollbar.gemspec +2 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 41e7cbc805007c993e9f946db75a6be6d6e1147d819303d5b7da6cca27dd1f33
|
4
|
+
data.tar.gz: 6c6d787b7861f98a5f0209679b135dc8b978b2e5ea77b2e2bb6fc33f9aadffe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cfeb277a43c328956255554663f1dc201a20bafd1f04925842cd3c6912a9df176f8ac63fb4483332189f8db11fff7397aed664afa1ddd16c4d733c55d65f00d
|
7
|
+
data.tar.gz: 0b3dd33df8eb592de51d2e19805311216d358d3038ac037a074941abea37dba24234d3f0c7896fc75f27e2e26ee456b877005c0d679227207dd413976d4dcfa9
|
data/.editorconfig
ADDED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -20,13 +20,11 @@ And then execute:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
**Note:** Currently requires `curl` to be present on the server for notifications to be sent. Patches happily accepted to improve this limitation!
|
24
|
-
|
25
23
|
require 'mina/rollbar'
|
26
24
|
|
27
25
|
...
|
28
26
|
# replace value w/your real access token
|
29
|
-
set :rollbar_access_token, '
|
27
|
+
set :rollbar_access_token, 'this-is-not-a-real-token'
|
30
28
|
|
31
29
|
task deploy: :environment do
|
32
30
|
deploy do
|
@@ -41,14 +39,13 @@ And then execute:
|
|
41
39
|
|
42
40
|
## Options
|
43
41
|
|
44
|
-
| Name | Description
|
45
|
-
| ---------------------------- |
|
46
|
-
| `rollbar_access_token` | Rollbar access token (post_server_item token)
|
47
|
-
| `rollbar_username` | Rollbar username of deploying user (optional)
|
48
|
-
| `rollbar_local_username` | Local username of deploying user (optional)
|
49
|
-
| `rollbar_comment` | Comment for this deployment (optional)
|
50
|
-
| `
|
51
|
-
| `rollbar_environment` | Deployment environment string, defaults to `rails_env` |
|
42
|
+
| Name | Description |
|
43
|
+
| ---------------------------- | ------------------------------------------------------ |
|
44
|
+
| `rollbar_access_token` | Rollbar access token (post_server_item token) |
|
45
|
+
| `rollbar_username` | Rollbar username of deploying user (optional) |
|
46
|
+
| `rollbar_local_username` | Local username of deploying user (optional) |
|
47
|
+
| `rollbar_comment` | Comment for this deployment (optional) |
|
48
|
+
| `rollbar_env` | Deployment environment string, defaults to `rails_env` |
|
52
49
|
|
53
50
|
## Contributing
|
54
51
|
|
data/lib/mina/rollbar/tasks.rb
CHANGED
@@ -20,6 +20,10 @@
|
|
20
20
|
# end
|
21
21
|
# end
|
22
22
|
|
23
|
+
require 'net/http'
|
24
|
+
require 'rubygems'
|
25
|
+
require 'json'
|
26
|
+
|
23
27
|
require 'mina/rails'
|
24
28
|
|
25
29
|
# ## Settings
|
@@ -41,47 +45,53 @@ set :rollbar_local_username, %x[whoami].strip rescue nil
|
|
41
45
|
# Sets a deployment comment (what was deployed, etc.). Optional.
|
42
46
|
set :rollbar_comment, nil
|
43
47
|
|
44
|
-
# ###
|
45
|
-
# If true, enables verbosity in the notification to help debug issues. Defaults to false.
|
46
|
-
set :rollbar_notification_debug, false
|
47
|
-
|
48
|
-
# ### :rollbar_environment
|
48
|
+
# ### :rollbar_env
|
49
49
|
# Sets the rollbar environment being deployed. If left un-set, will default to `rails_env` value.
|
50
|
-
set :
|
50
|
+
set :rollbar_env, nil
|
51
51
|
|
52
52
|
namespace :rollbar do
|
53
53
|
|
54
54
|
desc 'Notifies Rollbar of your deployment'
|
55
|
-
task notify
|
55
|
+
task :notify do
|
56
56
|
|
57
57
|
unless fetch(:rollbar_access_token)
|
58
|
-
print_error '
|
59
|
-
|
58
|
+
print_error 'Rollbar: You must set `:rollbar_access_token` to notify'
|
59
|
+
next
|
60
60
|
end
|
61
61
|
|
62
62
|
unless set?(:branch) || set?(:commit)
|
63
|
-
print_error 'Must
|
64
|
-
|
63
|
+
print_error 'Rollbar: Must set either `:branch` or `:commit`'
|
64
|
+
next
|
65
65
|
end
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
67
|
+
uri = URI.parse 'https://api.rollbar.com/api/1/deploy/'
|
68
|
+
revision = fetch(:commit) || %x[git rev-parse origin/#{fetch(:branch)}].strip
|
69
|
+
params = {
|
70
|
+
local_username: fetch(:rollbar_local_username),
|
71
|
+
rollbar_username: fetch(:rollbar_username),
|
72
|
+
access_token: fetch(:rollbar_access_token),
|
73
|
+
environment: fetch(:rollbar_env) || fetch(:rollbar_environment) || fetch(:rails_env),
|
74
|
+
comment: fetch(:rollbar_comment),
|
75
|
+
revision: revision
|
76
|
+
}.reject { |_, value| value.nil? }
|
77
|
+
|
78
|
+
request = Net::HTTP::Post.new(uri.request_uri)
|
79
|
+
request.body = ::JSON.dump(params)
|
80
|
+
|
81
|
+
begin
|
82
|
+
comment "Notifying Rollbar of deployment"
|
83
|
+
|
84
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
85
|
+
response = http.request(request)
|
86
|
+
|
87
|
+
unless response.is_a?(Net::HTTPSuccess)
|
88
|
+
print_error "Rollbar: [#{response.code}] #{response.message}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
rescue StandardError => e
|
93
|
+
print_error "Rollbar: #{e.class} #{e.message}"
|
76
94
|
end
|
77
|
-
script << "-F revision=#{revision}"
|
78
|
-
script << "-F local_username=#{fetch(:rollbar_local_username)}" if set?(:rollbar_local_username)
|
79
|
-
script << "-F rollbar_username=#{fetch(:rollbar_username)}" if set?(:rollbar_username)
|
80
|
-
script << "-F comment=#{set(:rollbar_comment)}" if set?(:rollbar_comment)
|
81
|
-
|
82
|
-
comment %{Notifying Rollbar of deployment}
|
83
|
-
command %[#{script.join(' ')}]
|
84
|
-
|
85
95
|
end
|
86
96
|
|
87
97
|
end
|
data/lib/mina/rollbar/version.rb
CHANGED
data/mina-rollbar.gemspec
CHANGED
@@ -18,7 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'mina', '~> 1.0
|
21
|
+
spec.add_dependency 'mina', '~> 1.0'
|
22
|
+
spec.add_dependency 'json', '~> 2.1.0'
|
22
23
|
|
23
24
|
spec.add_development_dependency 'awesome_print'
|
24
25
|
spec.add_development_dependency 'bundler', '~> 1.13'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mina-rollbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Veys
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mina
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.1.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: awesome_print
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,6 +213,7 @@ executables: []
|
|
199
213
|
extensions: []
|
200
214
|
extra_rdoc_files: []
|
201
215
|
files:
|
216
|
+
- ".editorconfig"
|
202
217
|
- ".gitignore"
|
203
218
|
- ".rspec"
|
204
219
|
- ".rubocop.yml"
|
@@ -231,9 +246,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
246
|
version: '0'
|
232
247
|
requirements: []
|
233
248
|
rubyforge_project:
|
234
|
-
rubygems_version: 2.
|
249
|
+
rubygems_version: 2.7.5
|
235
250
|
signing_key:
|
236
251
|
specification_version: 4
|
237
252
|
summary: Mina tasks for Rollbar
|
238
253
|
test_files: []
|
239
|
-
has_rdoc:
|