diffend 0.2.15 → 0.2.16

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: f0c029223225bca30784ffe294dd16c09b9896d871fec470ab4b91cbae30e819
4
- data.tar.gz: 05e4eeb252dade68164ae084f39abfab62e0b12f76091925834636a016d98f3a
3
+ metadata.gz: d23a558405ac69141d76368e9a642d153300c2a9bb01fd67b9c8f3c949a9225b
4
+ data.tar.gz: 5d74b929a8debf7c7a32aa0cb8d01e9f51c373b0859468a3936e40a1bccc1004
5
5
  SHA512:
6
- metadata.gz: 70e35763ffc3730731826fac04646747c7bda85a5c7b70695131ab15e3e2130fc92ace7f12839c47725deb3c2fa0f1f291d797497fd6e583247c7ae2e79a0e87
7
- data.tar.gz: 37c1418a0965c90eb4ad26ae629c398ed06df41c7a504f720e412c658e65264f8ce700fbf4a655f1ab1f2e33a96a31862c80fa0d5461dbe389ef8331745a116a
6
+ metadata.gz: 8fe13be65aad9dda4c8a4cf3341851d691f253e4dc2d3d4a31e1da2bba92bffb2902e69ea08f78a5d3a9c6a5fb3f233abf72dd569d732df317aa5f0d8748830b
7
+ data.tar.gz: 86929a3b0259f8de839edfdd2901c203ed0e69d35a733d31860d6628c71a5874097efd3a08fb4203e4fa4768f110d5d36ec192f064b144b1a99c8c208111be0f
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- diffend (0.2.15)
4
+ diffend (0.2.16)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -21,7 +21,7 @@
21
21
  # Diffend main namespace
22
22
  module Diffend
23
23
  # Current plugin version
24
- VERSION = '0.2.15'
24
+ VERSION = '0.2.16'
25
25
  # Diffend homepage
26
26
  HOMEPAGE = 'https://diffend.io'
27
27
 
@@ -36,7 +36,8 @@ module Diffend
36
36
  # @return [Net::HTTPResponse] response from Diffend
37
37
  def call(command, payload, config)
38
38
  retry_count ||= 0
39
- build_http(command, config.project_id) do |http, uri|
39
+
40
+ build_http(commands_url(command, config.project_id)) do |http, uri|
40
41
  http.request(build_request(uri, config, payload))
41
42
  end
42
43
  rescue *CONNECTION_EXCEPTIONS => e
@@ -46,7 +47,7 @@ module Diffend
46
47
 
47
48
  retry if retry_count < 3
48
49
 
49
- puts prepare_report(payload, e)
50
+ output_report(build_report(payload, e))
50
51
  Bundler.ui.error('^^^ Above is the dump of your request ^^^')
51
52
  Bundler.ui.error(build_request_error_message)
52
53
 
@@ -58,25 +59,29 @@ module Diffend
58
59
 
59
60
  retry if retry_count < 3
60
61
 
61
- puts prepare_report(payload, e)
62
+ output_report(build_report(payload, e))
62
63
  Bundler.ui.error('^^^ Above is the dump of your request ^^^')
63
64
  Bundler.ui.error(build_request_error_message)
64
65
 
65
66
  exit 1
66
67
  rescue StandardError => e
67
- puts prepare_report(payload, e)
68
+ exception_payload = build_report(payload, e)
69
+ output_report(exception_payload)
68
70
  Bundler.ui.error('^^^ Above is the dump of your request ^^^')
69
71
  Bundler.ui.error(build_unhandled_exception_message)
70
72
 
73
+ build_http(errors_url(config.project_id)) do |http, uri|
74
+ http.request(build_request(uri, config, exception_payload))
75
+ end
76
+
71
77
  exit 1
72
78
  end
73
79
 
74
80
  # Builds http connection object
75
81
  #
76
- # @param command [String] either install or update
77
- # @param project_id [String] diffend project_id
78
- def build_http(command, project_id)
79
- uri = URI(endpoint_url(command, project_id))
82
+ # @param url [String] command endpoint url
83
+ def build_http(url)
84
+ uri = URI(url)
80
85
 
81
86
  Net::HTTP.start(
82
87
  uri.host,
@@ -122,18 +127,29 @@ module Diffend
122
127
  request.body = JSON.dump(payload: payload)
123
128
  end
124
129
 
125
- # Provides diffend endpoint url
130
+ # Provides diffend command endpoint url
126
131
  #
127
132
  # @param command [String] either install or update
128
133
  # @param project_id [String] diffend project_id
129
134
  #
130
135
  # @return [String] diffend endpoint
131
- def endpoint_url(command, project_id)
132
- return ENV['DIFFEND_URL'] if ENV.key?('DIFFEND_URL')
136
+ def commands_url(command, project_id)
137
+ return ENV['DIFFEND_COMMAND_URL'] if ENV.key?('DIFFEND_COMMAND_URL')
133
138
 
134
139
  "https://my.diffend.io/api/projects/#{project_id}/bundle/#{command}"
135
140
  end
136
141
 
142
+ # Provides diffend errors endpoint url
143
+ #
144
+ # @param project_id [String] diffend project_id
145
+ #
146
+ # @return [String] diffend endpoint
147
+ def errors_url(project_id)
148
+ return ENV['DIFFEND_ERROR_URL'] if ENV.key?('DIFFEND_ERROR_URL')
149
+
150
+ "https://my.diffend.io/api/projects/#{project_id}/errors"
151
+ end
152
+
137
153
  def exponential_backoff(retry_count)
138
154
  2**(retry_count + 1)
139
155
  end
@@ -154,7 +170,7 @@ module Diffend
154
170
  MSG
155
171
  end
156
172
 
157
- def prepare_report(payload, exception)
173
+ def build_report(payload, exception)
158
174
  {
159
175
  request_id: SecureRandom.uuid,
160
176
  payload: payload,
@@ -163,7 +179,11 @@ module Diffend
163
179
  message: exception.message,
164
180
  backtrace: exception.backtrace
165
181
  }
166
- }.to_json
182
+ }
183
+ end
184
+
185
+ def output_report(report)
186
+ puts report.to_json
167
187
  end
168
188
  end
169
189
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diffend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.15
4
+ version: 0.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Pajor
@@ -34,7 +34,7 @@ cert_chain:
34
34
  9MmF6uCQa1EjK2p8tYT0MnbHrFkoehxdX4VO9y99GAkhZyJNKPYPtyAUFV27sT2V
35
35
  LfCJRk4ifKIN/FUCwDSn8Cz0m6oH265q0p6wdzI6qrWOjP8tGOMBTA==
36
36
  -----END CERTIFICATE-----
37
- date: 2020-07-27 00:00:00.000000000 Z
37
+ date: 2020-07-28 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: bundler
metadata.gz.sig CHANGED
Binary file