mina-rollbar-3 1.0.3

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,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2f7c122ae704b60c64e9b2228eb6c6b7085047d514c40d893090c0781eefb896
4
+ data.tar.gz: c9e36f3f880b0721c630cc40714a648bc4bcba3a3a393aea771833aac918e957
5
+ SHA512:
6
+ metadata.gz: f7b774396b6b68ecb606f0846c714d6184d2a53b3289e9d62e7d73b74e41cbce489470ae68e517f9f07d94fd1140d7322054c7318c29b3320e37ce5fa1d7a4df
7
+ data.tar.gz: adeae69257e99c160ad21d53db3cb1dbb3a85cabf6c1f1ad8cd3138d3f66b659401cbe13d3b6b1aad67cfe4e577c272aed59520a3baef876f87ef461e56bdb3b
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ *.exe
15
+ mkmf.log
16
+ .idea
data/.rubocop.yml ADDED
@@ -0,0 +1,4 @@
1
+ AllCops:
2
+ Include:
3
+ - 'lib/**/*.rb'
4
+ - 'spec/**/*.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mina-rollbar.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014-2018 Aramis Group, LLC dba code lever
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,66 @@
1
+ # Mina::Rollbar
2
+ [Mina](https://github.com/mina-deploy/mina) tasks for interacting with [Rollbar](http://rollbar.com).
3
+
4
+ This is updated version of [Mina::Rollbar](https://github.com/code-lever/mina-rollbar).
5
+ Supports separate deployment started/finished notifications in rollbar.
6
+
7
+ Adds the following tasks:
8
+
9
+ rollbar:notify:starting
10
+ rollbar:notify:finished
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'mina-rollbar-3', require: false
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ ## Usage
25
+
26
+ require 'mina/rollbar'
27
+
28
+ ...
29
+ # replace value w/your real access token
30
+ set :rollbar_access_token, 'this-is-not-a-real-token'
31
+
32
+ task deploy: :environment do
33
+ run(:local) do
34
+ invoke :'rollbar:starting'
35
+ end
36
+
37
+ deploy do
38
+ ...
39
+
40
+ on :launch do
41
+ ...
42
+ end
43
+ end
44
+
45
+ run(:local) do
46
+ invoke :'rollbar:finished'
47
+ end
48
+ end
49
+
50
+ ## Options
51
+
52
+ | Name | Description |
53
+ | ---------------------------- | ------------------------------------------------------ |
54
+ | `rollbar_access_token` | Rollbar access token (post_server_item token) |
55
+ | `rollbar_username` | Rollbar username of deploying user (optional) |
56
+ | `rollbar_local_username` | Local username of deploying user (optional) |
57
+ | `rollbar_comment` | Comment for this deployment (optional) |
58
+ | `rollbar_env` | Deployment environment string, defaults to `rails_env` |
59
+
60
+ ## Contributing
61
+
62
+ 1. Fork it ( https://github.com/railsblueprint/mina-rollbar/fork )
63
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
64
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
65
+ 4. Push to the branch (`git push origin my-new-feature`)
66
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,128 @@
1
+ # frozen_string_literal: true
2
+
3
+ # # Modules: Rollbar
4
+ # Adds settings and tasks for notifying Rollbar.
5
+ #
6
+ # require 'mina/rollbar'
7
+ #
8
+ # ## Usage example
9
+ # require 'mina_sidekiq/tasks'
10
+ #
11
+ # # this is your 'post_server_item' token for your project
12
+ # set :rollbar_access_token, 'rollbar-access-token-goes-here'
13
+ #
14
+ # task :deploy do
15
+ # deploy do
16
+ # ...
17
+ #
18
+ # to :launch do
19
+ # ...
20
+ # invoke :'rollbar:notify'
21
+ # end
22
+ # end
23
+ # end
24
+
25
+ require 'net/http'
26
+ require 'rubygems'
27
+ require 'json'
28
+
29
+ require 'mina/rails'
30
+
31
+ # ## Settings
32
+ # Any and all of these settings can be overriden in your `deploy.rb`.
33
+
34
+ # ### rollbar_access_token
35
+ # Sets the access token for your Rollbar account. Required.
36
+ set :rollbar_access_token, nil
37
+
38
+ # ### rollbar_username
39
+ # Sets the Rollbar username of the user who deployed. Optional.
40
+ set :rollbar_username, nil
41
+
42
+ # ### rollbar_local_username
43
+ # Sets the name of the user who deployed. Defaults to `whoami`. Optional.
44
+ begin
45
+ set :rollbar_local_username, `whoami`.strip
46
+ rescue StandardError
47
+ nil
48
+ end
49
+
50
+ # ### rollbar_comment
51
+ # Sets a deployment comment (what was deployed, etc.). Optional.
52
+ set :rollbar_comment, nil
53
+
54
+ # ### :rollbar_env
55
+ # Sets the rollbar environment being deployed. If left un-set, will default to `rails_env` value.
56
+ set :rollbar_env, nil
57
+
58
+ namespace :rollbar do
59
+ desc 'Notifies Rollbar of your deployment'
60
+ task :starting do
61
+ unless fetch(:rollbar_access_token)
62
+ print_error 'Rollbar: You must set `:rollbar_access_token` to notify'
63
+ next
64
+ end
65
+
66
+ unless set?(:branch) || set?(:commit)
67
+ print_error 'Rollbar: Must set either `:branch` or `:commit`'
68
+ next
69
+ end
70
+
71
+ uri = URI.parse 'https://api.rollbar.com/api/1/deploy/'
72
+ revision = fetch(:commit) || `git rev-parse origin/#{fetch(:branch)}`.strip
73
+ params = {
74
+ local_username: fetch(:rollbar_local_username),
75
+ rollbar_username: fetch(:rollbar_username),
76
+ environment: fetch(:rollbar_env) || fetch(:rollbar_environment) || fetch(:rails_env),
77
+ comment: fetch(:rollbar_comment),
78
+ revision: revision,
79
+ status: 'started'
80
+ }.reject { |_, value| value.nil? }
81
+
82
+ request = Net::HTTP::Post.new(uri.request_uri)
83
+ request.body = ::JSON.dump(params)
84
+ request['X-Rollbar-Access-Token'] = fetch(:rollbar_access_token)
85
+ begin
86
+ comment 'Notifying Rollbar of deployment'
87
+ Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
88
+ response = http.request(request)
89
+
90
+ print_error "Rollbar: [#{response.code}] #{response.message}" unless response.is_a?(Net::HTTPSuccess)
91
+ set :rollbar_deployment_id, JSON.parse(response.body).dig('data', 'deploy_id')
92
+ end
93
+ rescue StandardError => e
94
+ print_error "Rollbar: #{e.class} #{e.message}"
95
+ end
96
+ end
97
+
98
+ task :finished do
99
+ unless fetch(:rollbar_access_token)
100
+ print_error 'Rollbar: You must set `:rollbar_access_token` to notify'
101
+ next
102
+ end
103
+
104
+ unless set?(:rollbar_deployment_id)
105
+ print_error 'Rollbar:deployment id not known. Did you call rollbar:deploy:start ?'
106
+ next
107
+ end
108
+
109
+ uri = URI.parse "https://api.rollbar.com/api/1/deploy/#{fetch(:rollbar_deployment_id)}"
110
+
111
+ request = Net::HTTP::Patch.new(uri.request_uri)
112
+ params = {
113
+ status: 'succeeded'
114
+ }
115
+ request.body = ::JSON.dump(params)
116
+ request['X-Rollbar-Access-Token'] = fetch(:rollbar_access_token)
117
+ begin
118
+ comment 'Updating Rollbar deployment status'
119
+ Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
120
+ response = http.request(request)
121
+
122
+ print_error "Rollbar: [#{response.code}] #{response.message}" unless response.is_a?(Net::HTTPSuccess)
123
+ end
124
+ rescue StandardError => e
125
+ print_error "Rollbar: #{e.class} #{e.message}"
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mina
4
+ module Rollbar
5
+ VERSION = '1.0.3'
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mina/rollbar/tasks'
4
+ require 'mina/rollbar/version'
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mina/rollbar/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'mina-rollbar-3'
8
+ spec.version = Mina::Rollbar::VERSION
9
+ spec.authors = ['Vladimir Elchinov']
10
+ spec.email = ['elik@elik.ru']
11
+ spec.summary = %q{Mina tasks for Rollbar}
12
+ spec.description = %q{Notify Rollbar of Mina deployments.}
13
+ spec.homepage = 'https://github.com/railsblueprint/mina-rollbar'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'mina', '~> 1.0'
22
+ spec.add_dependency 'json'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.13'
25
+ spec.add_development_dependency 'pry'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.0'
28
+ spec.add_development_dependency 'yard'
29
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-rollbar-3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Vladimir Elchinov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-11-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mina
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
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: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.13'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.13'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Notify Rollbar of Mina deployments.
112
+ email:
113
+ - elik@elik.ru
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rubocop.yml"
120
+ - ".ruby-version"
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - lib/mina/rollbar.rb
126
+ - lib/mina/rollbar/tasks.rb
127
+ - lib/mina/rollbar/version.rb
128
+ - mina-rollbar.gemspec
129
+ homepage: https://github.com/railsblueprint/mina-rollbar
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubygems_version: 3.1.6
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Mina tasks for Rollbar
152
+ test_files: []