capistrano-sentry 0.1.5 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b604bc26d4b0cf71021d043bbe11976c97f434ec2ada60305775be65e25ca83a
4
- data.tar.gz: dfdaddac07ac73247e7766146f759a6326ce2c030f9c8f59fb337d88b172495f
3
+ metadata.gz: 3c2b0c32362fb64aaaa1e3037835ddf4e8c57db855e4081f3be2777ed78c5082
4
+ data.tar.gz: 38c19a019f359db6dd0f12d6b9c17faa5a4d4c3e2d8137b1765a928e8a6155b7
5
5
  SHA512:
6
- metadata.gz: 46ee1f6c34b8c7d363ce49fdf7400dfec5f7b551ac6a69b73fcc934e1e47268a40a831aaf226d7c0ba3d43fe5586bbd91cc7a17ddad91c67f9e16d0b0873ecf9
7
- data.tar.gz: 1c765c330033504b7126b20a060e1231abbdaf2a2f71368ac752c0d022dfd64c2aea275d62f85bd61ecbcf481678871afe15de778ddffea62b7a685ed7667dfd
6
+ metadata.gz: b3ea7744d925f10e7930cae9c6793f2303cd34be0ac5821880462345f46fe10e90a94400987259b1c591e2f63440424ee8257ce162cf7c1998191b992157d4af
7
+ data.tar.gz: ecdec189a6ae9f5848171738c48bad136e381994ec3d99d1460a9827af5cb746290aec9eaca6c430a16024b8a1da62d5c16711cb8f20c2316e2df63e35d9853a
data/README.md CHANGED
@@ -19,9 +19,11 @@ Then, add this line to your application's Capfile:
19
19
  require 'capistrano/sentry'
20
20
  ```
21
21
 
22
- And then execute:
22
+ And then execute from your command line:
23
23
 
24
- $ bundle
24
+ ```bash
25
+ bundle
26
+ ```
25
27
 
26
28
  ## Usage
27
29
 
@@ -29,6 +31,7 @@ Add these lines to your application's `config/deploy.rb`:
29
31
 
30
32
  ```ruby
31
33
  # Sentry deployment notification
34
+ set :sentry_host, 'https://my-sentry.mycorp.com' # https://sentry.io by default
32
35
  set :sentry_api_token, 'd9fe44a1cf34e63993e258dbecf42158918d407978a1bb72f8fb5886aa5f9fe1'
33
36
  set :sentry_organization, 'my-org' # fetch(:application) by default
34
37
  set :sentry_project, 'my-proj' # fetch(:application) by default
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Sentry
3
- VERSION = '0.1.5'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
@@ -1,39 +1,32 @@
1
1
  # This task will notify Sentry via their API[1] that you have deployed
2
- # a new release. It uses the release timestamp as the `version`
3
- # (like 20151113182847) and the git ref as the optional `ref` value.
4
- #
5
- # This task requires several environment variables be set (or just
6
- # hardcode the values in here if you like living on the edge):
7
- #
8
- # ENV['SENTRY_API_ENDPOINT'] : API endpoint, https://app.getsentry.com
9
- # ENV['SENTRY_ORG'] : the organization for this app
10
- # ENV['SENTRY_PROJECT'] : the project for this app
11
- # ENV['SENTRY_AUTH_TOKEN'] : a valid Auth token (replaces API Key)
2
+ # a new release. It uses the commit hash as the `version` and the git ref as
3
+ # the optional `ref` value.
12
4
  #
13
5
  # [1]: https://docs.getsentry.com/hosted/api/releases/post-project-releases
14
6
 
15
7
  # For Rails app, this goes in config/deploy.rb
16
8
 
17
9
  namespace :sentry do
18
- desc 'Notice new deployment in Sentry (sentry.io)'
10
+ desc 'Notice new deployment in Sentry'
19
11
  task :notice_deployment do
20
12
  run_locally do
21
13
  require 'uri'
22
14
  require 'net/https'
23
15
  require 'json'
24
16
 
25
- uri = URI.parse('https://sentry.io')
26
- http = Net::HTTP.new(uri.host, uri.port)
27
- http.use_ssl = true
28
-
29
17
  version = `git rev-parse HEAD`.strip
30
18
 
19
+ sentry_host = ENV['SENTRY_HOST'] || fetch(:sentry_host, 'https://sentry.io')
31
20
  orga_slug = fetch(:sentry_organization) || fetch(:application)
32
21
  project = fetch(:sentry_project) || fetch(:application)
33
22
  environment = fetch(:stage) || 'default'
34
23
  api_token = ENV['SENTRY_API_TOKEN'] || fetch(:sentry_api_token)
35
24
  repo_name = fetch(:sentry_repo) || fetch(:repo_url).split(':').last.gsub(/\.git$/, '')
36
25
 
26
+ uri = URI.parse(sentry_host)
27
+ http = Net::HTTP.new(uri.host, uri.port)
28
+ http.use_ssl = true
29
+
37
30
  headers = {
38
31
  'Content-Type' => 'application/json',
39
32
  'Authorization' => 'Bearer ' + api_token.to_s
@@ -44,8 +37,7 @@ namespace :sentry do
44
37
  version: version,
45
38
  refs: [{
46
39
  repository: repo_name,
47
- commit: fetch(:current_revision) || `git rev-parse HEAD`.strip,
48
- # previousCommit: fetch(:previous_revision)
40
+ commit: fetch(:current_revision) || `git rev-parse HEAD`.strip
49
41
  }],
50
42
  projects: [project]
51
43
  )
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.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Texier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-19 00:00:00.000000000 Z
11
+ date: 2019-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano