capistrano-sentry 0.4.0 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68fd747d897527e62a5ac086ebc361a5c4b166c059d7c3596b85f7b2a776374f
4
- data.tar.gz: ce63a3acb315cc6b3c96fc01a968032e8a98d4ea080d21eedfe3bc17cb42a3c2
3
+ metadata.gz: aa08b17ff84fe1b532e61db8eb1523386d1067fdbebb2f1e35e08ea3838321a7
4
+ data.tar.gz: 37f28cfb7948b2f466459edc77d415df07110792c4aeb195e0c9b9ae3c41ba3a
5
5
  SHA512:
6
- metadata.gz: 9b3ccae3566b22f9fa686821dae840b0ddd63aa49f9dea6a3d1eaad27802ad33933f650be0706f8ad4c2cf3f10f53035a263a859385577263ff0b6a5d338a826
7
- data.tar.gz: 5e85c1e6d80eaa6dcf43af44ec0e70f76f3de0d31028b0481ea22922501ca73ae350bfda417d1b8af152c7999398911331ad73703fb55f59cbb012af776e198f
6
+ metadata.gz: 2f29484e5511e9a3c6a2446c4ce50910e8eeb06ca9bcce512322ea111bfed2ff18e747378deee98389fb34c7e659315d0ff35f512252e6196e627c9bf66574ae
7
+ data.tar.gz: 7aa867b34a28f3fca952372e847134326df5210872b634db857497ba5e080223302534a28535eeb06e5de2c616d21240c246ea7768c8908c496bdf2e122be0b8
@@ -0,0 +1,42 @@
1
+ name: Test
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ test:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ strategy:
11
+ matrix:
12
+ ruby: [ '2.6' ]
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+
17
+ - name: Set up Ruby ${{ matrix.ruby }}
18
+ uses: actions/setup-ruby@v1
19
+ with:
20
+ ruby-version: ${{ matrix.ruby }}
21
+
22
+ - name: Retrieve gems cache
23
+ uses: actions/cache@v1.1.2
24
+ with:
25
+ path: vendor/bundle
26
+ key: ${{ runner.os }}-${{ matrix.ruby }}-gem-${{ hashFiles('**/Gemfile.lock') }}
27
+
28
+ - name: Install gems
29
+ run: |
30
+ rm -f .ruby-version
31
+ bundle config path vendor/bundle
32
+ bundle install --jobs 4 --retry 3
33
+
34
+ - name: Run tests
35
+ run: bundle exec rake test
36
+
37
+ - name: Upload log if failure
38
+ uses: actions/upload-artifact@v1
39
+ if: failure()
40
+ with:
41
+ name: test.log
42
+ path: log/test.log
@@ -0,0 +1,99 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+
4
+ Layout/AccessModifierIndentation:
5
+ EnforcedStyle: outdent
6
+ IndentationWidth: 2
7
+
8
+ Layout/ArgumentAlignment:
9
+ EnforcedStyle: with_fixed_indentation
10
+ IndentationWidth: 2
11
+
12
+ Layout/FirstArrayElementIndentation:
13
+ EnforcedStyle: consistent
14
+
15
+ Layout/FirstHashElementIndentation:
16
+ EnforcedStyle: consistent
17
+
18
+ Layout/HashAlignment:
19
+ EnforcedHashRocketStyle: table
20
+ EnforcedColonStyle: table
21
+
22
+ Layout/MultilineMethodCallIndentation:
23
+ EnforcedStyle: indented
24
+
25
+ Layout/ParameterAlignment:
26
+ EnforcedStyle: with_fixed_indentation
27
+ IndentationWidth: 2
28
+
29
+ Lint/RaiseException:
30
+ Enabled: true
31
+
32
+ Lint/StructNewOverride:
33
+ Enabled: true
34
+
35
+ Metrics/AbcSize:
36
+ Max: 65
37
+
38
+ Metrics/BlockLength:
39
+ Max: 70
40
+
41
+ Metrics/ClassLength:
42
+ Max: 300
43
+
44
+ Metrics/CyclomaticComplexity:
45
+ Max: 10
46
+
47
+ Metrics/MethodLength:
48
+ Max: 60
49
+
50
+ Metrics/ModuleLength:
51
+ Max: 300
52
+
53
+ Metrics/PerceivedComplexity:
54
+ Max: 10
55
+
56
+ Naming/FileName:
57
+ Enabled: false
58
+
59
+ Style/AsciiComments:
60
+ Enabled: false
61
+
62
+ Style/ClassAndModuleChildren:
63
+ AutoCorrect: true
64
+
65
+ Style/ConditionalAssignment:
66
+ Enabled: false
67
+
68
+ Style/Documentation:
69
+ Enabled: false
70
+
71
+ Style/EmptyMethod:
72
+ EnforcedStyle: expanded
73
+
74
+ Style/GuardClause:
75
+ MinBodyLength: 3
76
+
77
+ Style/HashEachMethods:
78
+ Enabled: true
79
+ AutoCorrect: true
80
+
81
+ Style/HashTransformKeys:
82
+ Enabled: true
83
+ AutoCorrect: true
84
+
85
+ Style/HashTransformValues:
86
+ Enabled: true
87
+ AutoCorrect: true
88
+
89
+ Style/IfUnlessModifier:
90
+ Enabled: false
91
+
92
+ Style/MultipleComparison:
93
+ Enabled: false
94
+
95
+ Style/NumericPredicate:
96
+ Enabled: false
97
+
98
+ Style/SymbolArray:
99
+ MinSize: 7
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rake/testtask'
3
5
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'capistrano/sentry'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'capistrano/sentry/version'
@@ -8,7 +10,7 @@ Gem::Specification.new do |spec|
8
10
  spec.authors = ['Brice Texier']
9
11
  spec.email = ['brice@codeur.com']
10
12
  spec.description = 'Sentry release/deployment integration'
11
- spec.summary = 'Sentry release/deployment integration'
13
+ spec.summary = 'Push release and deployment information on Sentry on each deploy'
12
14
  spec.homepage = 'https://github.com/codeur/capistrano-sentry'
13
15
  spec.license = 'MIT'
14
16
 
@@ -26,5 +28,5 @@ Gem::Specification.new do |spec|
26
28
 
27
29
  spec.add_development_dependency 'bundler', '~> 1.17'
28
30
  spec.add_development_dependency 'minitest', '~> 5.0'
29
- spec.add_development_dependency 'rake', '~> 10.0'
31
+ spec.add_development_dependency 'rake', '>= 10'
30
32
  end
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  load File.expand_path('tasks/sentry.rake', __dir__)
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Capistrano
2
4
  module Sentry
3
- VERSION = '0.4.0'.freeze
5
+ VERSION = '0.4.2'
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This task will notify Sentry via their API[1][2] that you have deployed
2
4
  # a new release. It uses the commit hash as the `version` and the git ref as
3
5
  # the optional `ref` value.
@@ -19,9 +21,10 @@ namespace :sentry do
19
21
  info '[sentry:validate_config] Validating Sentry notification config'
20
22
  api_token = ENV['SENTRY_API_TOKEN'] || fetch(:sentry_api_token)
21
23
  if api_token.nil? || api_token.empty?
22
- msg = "Missing SENTRY_API_TOKEN. Please set SENTRY_API_TOKEN environment variable or `set :sentry_api_token` in your `config/deploy.rb` file for your Rails application."
24
+ msg = 'Missing SENTRY_API_TOKEN. Please set SENTRY_API_TOKEN environment' \
25
+ ' variable or `set :sentry_api_token` in your `config/deploy.rb` file for your Rails application.'
23
26
  warn msg
24
- fail Capistrano::SentryConfigurationError, msg
27
+ raise Capistrano::SentryConfigurationError, msg
25
28
  end
26
29
  end
27
30
  end
@@ -43,9 +46,9 @@ namespace :sentry do
43
46
  api_token = ENV['SENTRY_API_TOKEN'] || fetch(:sentry_api_token)
44
47
  repo_integration_enabled = fetch(:sentry_repo_integration, true)
45
48
  release_refs = fetch(:sentry_release_refs, [{
46
- repository: fetch(:sentry_repo) || fetch(:repo_url).split(':').last.gsub(/\.git$/, ''),
47
- commit: head_revision,
48
- previousCommit: prev_revision,
49
+ repository: fetch(:sentry_repo) || fetch(:repo_url).split(':').last.delete_suffix('.git'),
50
+ commit: head_revision,
51
+ previousCommit: prev_revision
49
52
  }])
50
53
  release_version = fetch(:sentry_release_version) || head_revision
51
54
  deploy_name = fetch(:sentry_deploy_name) || "#{release_version}-#{fetch(:release_timestamp)}"
@@ -55,24 +58,27 @@ namespace :sentry do
55
58
  http.use_ssl = true
56
59
 
57
60
  headers = {
58
- 'Content-Type' => 'application/json',
59
- 'Authorization' => 'Bearer ' + api_token.to_s,
61
+ 'Content-Type' => 'application/json',
62
+ 'Authorization' => 'Bearer ' + api_token.to_s
60
63
  }
61
64
 
62
65
  req = Net::HTTP::Post.new("/api/0/organizations/#{organization_slug}/releases/", headers)
63
66
  body = {
64
- version: release_version,
65
- projects: [project],
67
+ version: release_version,
68
+ projects: [project]
66
69
  }
67
70
  body[:refs] = release_refs if repo_integration_enabled
68
71
  req.body = JSON.generate(body)
69
72
  response = http.request(req)
70
73
  if response.is_a? Net::HTTPSuccess
71
74
  info "Notified Sentry of new release: #{release_version}"
72
- req = Net::HTTP::Post.new("/api/0/organizations/#{organization_slug}/releases/#{release_version}/deploys/", headers)
75
+ req = Net::HTTP::Post.new(
76
+ "/api/0/organizations/#{organization_slug}/releases/#{release_version}/deploys/",
77
+ headers
78
+ )
73
79
  req.body = JSON.generate(
74
80
  environment: environment,
75
- name: deploy_name,
81
+ name: deploy_name
76
82
  )
77
83
  response = http.request(req)
78
84
  if response.is_a? Net::HTTPSuccess
@@ -1,11 +1,12 @@
1
- require 'test_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- class Capistrano::SentryTest < Minitest::Test
4
- def test_that_it_has_a_version_number
5
- refute_nil ::Capistrano::Sentry::VERSION
6
- end
3
+ require 'test_helper'
4
+ require 'capistrano/sentry/version'
7
5
 
8
- def test_it_does_something_useful
9
- assert false
6
+ module Capistrano
7
+ class SentryTest < Minitest::Test
8
+ def test_that_it_has_a_version_number
9
+ assert !::Capistrano::Sentry::VERSION.nil?
10
+ end
10
11
  end
11
12
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
2
4
  require 'capistrano/sentry'
3
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-sentry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Texier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-03 00:00:00.000000000 Z
11
+ date: 2020-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '10'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '10'
69
69
  description: Sentry release/deployment integration
70
70
  email:
71
71
  - brice@codeur.com
@@ -73,8 +73,9 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".github/workflows/test.yml"
76
77
  - ".gitignore"
77
- - ".travis.yml"
78
+ - ".rubocop.yml"
78
79
  - CODE_OF_CONDUCT.md
79
80
  - Gemfile
80
81
  - LICENSE.txt
@@ -108,11 +109,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
109
  - !ruby/object:Gem::Version
109
110
  version: '0'
110
111
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 2.7.6
112
+ rubygems_version: 3.0.3
113
113
  signing_key:
114
114
  specification_version: 4
115
- summary: Sentry release/deployment integration
115
+ summary: Push release and deployment information on Sentry on each deploy
116
116
  test_files:
117
117
  - test/capistrano/sentry_test.rb
118
118
  - test/test_helper.rb
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.5.1
7
- before_install: gem install bundler -v 1.17.1