diffend 0.2.17 → 0.2.25
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.github/workflows/ci.yml +12 -2
- data/CHANGELOG.md +63 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +12 -1
- data/{LICENSE → LICENSE.md} +0 -0
- data/lib/diffend.rb +69 -19
- data/lib/diffend/build_bundler_definition.rb +26 -0
- data/lib/diffend/errors.rb +2 -4
- data/lib/diffend/handle_errors/build_exception_payload.rb +30 -0
- data/lib/diffend/handle_errors/display_to_stdout.rb +17 -0
- data/lib/diffend/handle_errors/messages.rb +29 -0
- data/lib/diffend/handle_errors/report.rb +59 -0
- data/lib/diffend/request.rb +165 -0
- data/lib/diffend/voting.rb +71 -12
- data/lib/diffend/voting/versions/local.rb +156 -52
- data/lib/diffend/voting/versions/remote.rb +46 -14
- data/scripts/generate_payload_for_file.rb +1 -1
- metadata +10 -4
- metadata.gz.sig +0 -0
- data/lib/diffend/voting/request.rb +0 -191
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e6f2f5188a60431f6125d9b82e75f6edb661bf9c805ff13f685b962555c2cdb2
|
|
4
|
+
data.tar.gz: 3b4161909c2c494a37b3e8e3f9839f2fb86dd7c5712ca200cfb40e3c77e6bba6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a305d14cb1c2fe8166de8a830a465ed0647b690aec10ec917cf31348944a6f8f3867b75053f2817ab04153a27bc141064bc2ecc46dc73a77f68850011592c11c
|
|
7
|
+
data.tar.gz: f279c3f69cfcd07706a4c4652741d7ebc9423d222724d2c0093fa363f3be25970216d5adcaf156825db1edde6a8d6fb3d990f31a8d7480b656ff23e2a23490bc
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -3,16 +3,27 @@ name: ci
|
|
|
3
3
|
jobs:
|
|
4
4
|
specs:
|
|
5
5
|
runs-on: ubuntu-latest
|
|
6
|
+
|
|
6
7
|
strategy:
|
|
7
8
|
fail-fast: false
|
|
8
9
|
matrix:
|
|
9
10
|
ruby:
|
|
10
11
|
- '2.7'
|
|
12
|
+
- '2.6'
|
|
13
|
+
- '2.5'
|
|
14
|
+
- 'jruby'
|
|
11
15
|
include:
|
|
12
16
|
- ruby: '2.7'
|
|
13
17
|
coverage: 'true'
|
|
18
|
+
|
|
14
19
|
steps:
|
|
15
20
|
- uses: actions/checkout@v2
|
|
21
|
+
- uses: actions/cache@v2
|
|
22
|
+
with:
|
|
23
|
+
path: vendor/bundle
|
|
24
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
|
25
|
+
restore-keys: |
|
|
26
|
+
${{ runner.os }}-gems-
|
|
16
27
|
- name: Install package dependencies
|
|
17
28
|
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
|
|
18
29
|
- name: Set up Ruby
|
|
@@ -22,10 +33,9 @@ jobs:
|
|
|
22
33
|
- name: Install latest bundler
|
|
23
34
|
run: |
|
|
24
35
|
gem install bundler --no-document
|
|
25
|
-
bundle config set without 'tools benchmarks docs'
|
|
26
36
|
- name: Bundle install
|
|
27
37
|
run: |
|
|
28
|
-
bundle config
|
|
38
|
+
bundle config path vendor/bundle
|
|
29
39
|
bundle install --jobs 4 --retry 3
|
|
30
40
|
- name: Run all tests
|
|
31
41
|
env:
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased][master]
|
|
4
|
+
|
|
5
|
+
## [0.2.25] (2020-09-09)
|
|
6
|
+
- add support for a warn verdict ([#34](https://github.com/diffend-io/diffend-ruby/pull/34))
|
|
7
|
+
|
|
8
|
+
## [0.2.24] (2020-09-08)
|
|
9
|
+
- better error handling of response ([#28](https://github.com/diffend-io/diffend-ruby/pull/28))
|
|
10
|
+
- fix jruby specs ([#29](https://github.com/diffend-io/diffend-ruby/pull/29))
|
|
11
|
+
- handle request server errors ([#30](https://github.com/diffend-io/diffend-ruby/pull/30))
|
|
12
|
+
- better detection of gem source ([#31](https://github.com/diffend-io/diffend-ruby/pull/31))
|
|
13
|
+
- detect if we are running outdated version of the plugin ([#32](https://github.com/diffend-io/diffend-ruby/pull/32))
|
|
14
|
+
|
|
15
|
+
## [0.2.23] (2020-09-06)
|
|
16
|
+
- fix how we build gem platform ([#26](https://github.com/diffend-io/diffend-ruby/pull/26))
|
|
17
|
+
- test against jruby, ruby-2.5 and ruby-2.6 ([#25](https://github.com/diffend-io/diffend-ruby/pull/25))
|
|
18
|
+
|
|
19
|
+
## [0.2.22] (2020-09-03)
|
|
20
|
+
- fix how we build host command
|
|
21
|
+
|
|
22
|
+
## [0.2.21] (2020-09-03)
|
|
23
|
+
- bring back support for ruby 2.5.x
|
|
24
|
+
|
|
25
|
+
## [0.2.20] (2020-09-03)
|
|
26
|
+
- expose host command ([#21](https://github.com/diffend-io/diffend-ruby/pull/21))
|
|
27
|
+
- expose host pid ([#20](https://github.com/diffend-io/diffend-ruby/pull/20))
|
|
28
|
+
- use `Bundler.feature_flag.default_cli_command` which is used as the default task if no command provided, instead of `Diffend::Commands::INSTALL` ([#19](https://github.com/diffend-io/diffend-ruby/pull/19))
|
|
29
|
+
- better error handling ([#18](https://github.com/diffend-io/diffend-ruby/pull/18))
|
|
30
|
+
- better detection of gem versions ([#17](https://github.com/diffend-io/diffend-ruby/pull/17))
|
|
31
|
+
- introduce `Diffend::BuildBundlerDefinition` ([#16](https://github.com/diffend-io/diffend-ruby/pull/16))
|
|
32
|
+
|
|
33
|
+
## [0.2.19] (2020-08-18)
|
|
34
|
+
|
|
35
|
+
- better detection of gem sources ([#13](https://github.com/diffend-io/diffend-ruby/pull/13))
|
|
36
|
+
|
|
37
|
+
## [0.2.18] (2020-08-05)
|
|
38
|
+
|
|
39
|
+
- use `Etc.getpwuid` instead of `Etc.getlogin` for fetching host user ([#11](https://github.com/diffend-io/diffend-ruby/pull/11))
|
|
40
|
+
|
|
41
|
+
## [0.2.17] (2020-08-05)
|
|
42
|
+
|
|
43
|
+
- introduce config validation ([#9](https://github.com/diffend-io/diffend-ruby/pull/9))
|
|
44
|
+
|
|
45
|
+
## [0.2.16] (2020-07-28)
|
|
46
|
+
|
|
47
|
+
- report unexpected errors ([#8](https://github.com/diffend-io/diffend-ruby/pull/8))
|
|
48
|
+
|
|
49
|
+
## 0.2.15 (2020-06-07)
|
|
50
|
+
|
|
51
|
+
- initial release
|
|
52
|
+
|
|
53
|
+
[master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.25...HEAD
|
|
54
|
+
[0.2.25]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.24...v0.2.25
|
|
55
|
+
[0.2.24]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.23...v0.2.24
|
|
56
|
+
[0.2.23]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.22...v0.2.23
|
|
57
|
+
[0.2.22]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.21...v0.2.22
|
|
58
|
+
[0.2.21]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.20...v0.2.21
|
|
59
|
+
[0.2.20]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.19...v0.2.20
|
|
60
|
+
[0.2.19]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.18...v0.2.19
|
|
61
|
+
[0.2.18]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.17...v0.2.18
|
|
62
|
+
[0.2.17]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.16...v0.2.17
|
|
63
|
+
[0.2.16]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.15...v0.2.16
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
diffend (0.2.
|
|
4
|
+
diffend (0.2.25)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
9
|
byebug (11.1.3)
|
|
10
|
+
coderay (1.1.3)
|
|
10
11
|
diff-lcs (1.4.4)
|
|
12
|
+
ffi (1.13.1-java)
|
|
13
|
+
method_source (1.0.0)
|
|
14
|
+
pry (0.13.1-java)
|
|
15
|
+
coderay (~> 1.1)
|
|
16
|
+
method_source (~> 1.0)
|
|
17
|
+
spoon (~> 0.0)
|
|
11
18
|
rake (13.0.1)
|
|
12
19
|
rspec (3.9.0)
|
|
13
20
|
rspec-core (~> 3.9.0)
|
|
@@ -22,14 +29,18 @@ GEM
|
|
|
22
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
23
30
|
rspec-support (~> 3.9.0)
|
|
24
31
|
rspec-support (3.9.3)
|
|
32
|
+
spoon (0.0.6)
|
|
33
|
+
ffi
|
|
25
34
|
|
|
26
35
|
PLATFORMS
|
|
36
|
+
java
|
|
27
37
|
ruby
|
|
28
38
|
|
|
29
39
|
DEPENDENCIES
|
|
30
40
|
bundler
|
|
31
41
|
byebug
|
|
32
42
|
diffend!
|
|
43
|
+
pry
|
|
33
44
|
rake
|
|
34
45
|
rspec
|
|
35
46
|
|
data/{LICENSE → LICENSE.md}
RENAMED
|
File without changes
|
data/lib/diffend.rb
CHANGED
|
@@ -5,16 +5,21 @@
|
|
|
5
5
|
].each(&method(:require))
|
|
6
6
|
|
|
7
7
|
%w[
|
|
8
|
+
build_bundler_definition
|
|
8
9
|
errors
|
|
9
10
|
config/fetcher
|
|
10
11
|
config/file_finder
|
|
11
12
|
config/validator
|
|
12
13
|
commands
|
|
14
|
+
handle_errors/messages
|
|
15
|
+
handle_errors/build_exception_payload
|
|
16
|
+
handle_errors/display_to_stdout
|
|
17
|
+
handle_errors/report
|
|
18
|
+
request
|
|
13
19
|
voting
|
|
14
20
|
].each { |file| require "diffend/#{file}" }
|
|
15
21
|
|
|
16
22
|
%w[
|
|
17
|
-
request
|
|
18
23
|
versions/local
|
|
19
24
|
versions/remote
|
|
20
25
|
].each { |file| require "diffend/voting/#{file}" }
|
|
@@ -22,7 +27,7 @@
|
|
|
22
27
|
# Diffend main namespace
|
|
23
28
|
module Diffend
|
|
24
29
|
# Current plugin version
|
|
25
|
-
VERSION = '0.2.
|
|
30
|
+
VERSION = '0.2.25'
|
|
26
31
|
# Diffend homepage
|
|
27
32
|
HOMEPAGE = 'https://diffend.io'
|
|
28
33
|
|
|
@@ -30,35 +35,80 @@ module Diffend
|
|
|
30
35
|
# Registers the plugin and add before install all hook
|
|
31
36
|
def register
|
|
32
37
|
Bundler::Plugin.add_hook('before-install-all') do |_|
|
|
33
|
-
|
|
34
|
-
command,
|
|
35
|
-
build_definition(command)
|
|
36
|
-
)
|
|
38
|
+
execute
|
|
37
39
|
end
|
|
38
40
|
end
|
|
39
41
|
|
|
40
|
-
#
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
# @return [Bundler::Definition]
|
|
45
|
-
def build_definition(command)
|
|
46
|
-
unlock = command == 'update' ? true : nil
|
|
42
|
+
# Execute diffend plugin
|
|
43
|
+
def execute
|
|
44
|
+
detect_installed_version
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
config = fetch_config
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
Diffend::Voting.call(
|
|
49
|
+
command,
|
|
50
|
+
config,
|
|
51
|
+
Diffend::BuildBundlerDefinition.call(
|
|
52
|
+
command,
|
|
53
|
+
Bundler.default_gemfile,
|
|
54
|
+
Bundler.default_lockfile
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
rescue StandardError => e
|
|
58
|
+
Diffend::HandleErrors::Report.call(
|
|
59
|
+
exception: e,
|
|
60
|
+
config: config,
|
|
61
|
+
message: :unhandled_exception,
|
|
62
|
+
report: true
|
|
54
63
|
)
|
|
55
64
|
end
|
|
56
65
|
|
|
66
|
+
def detect_installed_version
|
|
67
|
+
return if installed_version == VERSION
|
|
68
|
+
|
|
69
|
+
build_outdated_version_message(installed_version)
|
|
70
|
+
.tap(&Bundler.ui.method(:error))
|
|
71
|
+
|
|
72
|
+
exit 1
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# @param version [Hash] installed version
|
|
76
|
+
#
|
|
77
|
+
# @return [String]
|
|
78
|
+
def build_outdated_version_message(version)
|
|
79
|
+
<<~MSG
|
|
80
|
+
\nYou are running an outdated version (#{version}) of the plugin, which will lead to issues.
|
|
81
|
+
\nPlease upgrade to the latest one (#{VERSION}) by executing "rm -rf .bundle/plugin".\n
|
|
82
|
+
MSG
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# @return [String] installed plugin version
|
|
86
|
+
def installed_version
|
|
87
|
+
Bundler::Plugin
|
|
88
|
+
.index
|
|
89
|
+
.plugin_path('diffend')
|
|
90
|
+
.basename
|
|
91
|
+
.to_s
|
|
92
|
+
.split('-')
|
|
93
|
+
.last
|
|
94
|
+
end
|
|
95
|
+
|
|
57
96
|
# Command that was run with bundle
|
|
58
97
|
#
|
|
59
98
|
# @return [String]
|
|
60
99
|
def command
|
|
61
|
-
ARGV.first ||
|
|
100
|
+
ARGV.first || Bundler.feature_flag.default_cli_command.to_s
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Fetch diffend config file
|
|
104
|
+
#
|
|
105
|
+
# @return [OpenStruct, nil] configuration object
|
|
106
|
+
#
|
|
107
|
+
# @raise [Errors::MissingConfigurationFile] when no config file
|
|
108
|
+
def fetch_config
|
|
109
|
+
Config::Fetcher.call(
|
|
110
|
+
File.expand_path('..', Bundler.bin_path)
|
|
111
|
+
)
|
|
62
112
|
end
|
|
63
113
|
end
|
|
64
114
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Diffend
|
|
4
|
+
# Builds bundler definition used within the plugin
|
|
5
|
+
module BuildBundlerDefinition
|
|
6
|
+
class << self
|
|
7
|
+
# Build clean instance of bundler definition, as we don't want to pollute the main one
|
|
8
|
+
#
|
|
9
|
+
# @param command [String] bundler command that we are executing
|
|
10
|
+
# @param gemfile [String] path to Gemfile
|
|
11
|
+
# @param lockfile [String] path to Gemfile.lock
|
|
12
|
+
#
|
|
13
|
+
# @return [Bundler::Definition]
|
|
14
|
+
def call(command, gemfile, lockfile)
|
|
15
|
+
unlock = command == 'update' ? true : nil
|
|
16
|
+
|
|
17
|
+
Bundler.configure
|
|
18
|
+
Bundler::Fetcher.disable_endpoint = nil
|
|
19
|
+
|
|
20
|
+
Bundler::Definition
|
|
21
|
+
.build(gemfile, lockfile, unlock)
|
|
22
|
+
.tap(&:validate_runtime!)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
data/lib/diffend/errors.rb
CHANGED
|
@@ -19,9 +19,7 @@ module Diffend
|
|
|
19
19
|
ShareableKeyMissingInConfigurationFile = Class.new(BaseError)
|
|
20
20
|
# Raised when build_path is missing in configuration file
|
|
21
21
|
BuildPathMissingInConfigurationFile = Class.new(BaseError)
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
# When unsupported action returned from the endpoint
|
|
25
|
-
UnsupportedAction = Class.new(BaseError)
|
|
22
|
+
# Raised when server-side error occurs
|
|
23
|
+
RequestServerError = Class.new(BaseError)
|
|
26
24
|
end
|
|
27
25
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'securerandom'
|
|
4
|
+
|
|
5
|
+
module Diffend
|
|
6
|
+
module HandleErrors
|
|
7
|
+
# Module responsible for building exception payload
|
|
8
|
+
module BuildExceptionPayload
|
|
9
|
+
class << self
|
|
10
|
+
# Build exception payload
|
|
11
|
+
#
|
|
12
|
+
# @param exception [Exception, NilClass] expection that was raised
|
|
13
|
+
# @param payload [Hash] with versions to check
|
|
14
|
+
#
|
|
15
|
+
# @return [Hash]
|
|
16
|
+
def call(exception, payload)
|
|
17
|
+
{
|
|
18
|
+
request_id: SecureRandom.uuid,
|
|
19
|
+
payload: payload,
|
|
20
|
+
exception: {
|
|
21
|
+
class: exception&.class,
|
|
22
|
+
message: exception&.message,
|
|
23
|
+
backtrace: exception&.backtrace
|
|
24
|
+
}
|
|
25
|
+
}.freeze
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Diffend
|
|
4
|
+
module HandleErrors
|
|
5
|
+
# Module responsible for displaying exception payload to stdout
|
|
6
|
+
module DisplayToStdout
|
|
7
|
+
class << self
|
|
8
|
+
# Display exception payload to stdout
|
|
9
|
+
#
|
|
10
|
+
# @param exception_payload [Hash]
|
|
11
|
+
def call(exception_payload)
|
|
12
|
+
puts exception_payload.to_json
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Diffend
|
|
4
|
+
module HandleErrors
|
|
5
|
+
module Messages
|
|
6
|
+
PAYLOAD_DUMP = '^^^ Above is the dump of your request ^^^'
|
|
7
|
+
UNHANDLED_EXCEPTION = <<~MSG
|
|
8
|
+
\nSomething went really wrong. We recorded this incident in our system and will review it.\n
|
|
9
|
+
This is a bug, don't hesitate.\n
|
|
10
|
+
Create an issue at https://github.com/diffend-io/diffend-ruby/issues\n
|
|
11
|
+
MSG
|
|
12
|
+
UNSUPPORTED_RESPONSE = <<~MSG
|
|
13
|
+
\nAPI returned an unsupported response. We recorded this incident in our system and will review it.\n
|
|
14
|
+
This is a bug, don't hesitate.\n
|
|
15
|
+
Create an issue at https://github.com/diffend-io/diffend-ruby/issues\n
|
|
16
|
+
MSG
|
|
17
|
+
UNSUPPORTED_VERDICT = <<~MSG
|
|
18
|
+
\nAPI returned an unsupported verdict. We recorded this incident in our system and will review it.\n
|
|
19
|
+
This is a bug, don't hesitate.\n
|
|
20
|
+
Create an issue at https://github.com/diffend-io/diffend-ruby/issues\n
|
|
21
|
+
MSG
|
|
22
|
+
REQUEST_ERROR = <<~MSG
|
|
23
|
+
\nWe were unable to process your request at this time. We recorded this incident in our system and will review it.\n
|
|
24
|
+
If you think that this is a bug, don't hesitate.\n
|
|
25
|
+
Create an issue at https://github.com/diffend-io/diffend-ruby/issues\n
|
|
26
|
+
MSG
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Diffend
|
|
4
|
+
module HandleErrors
|
|
5
|
+
# Module responsible for reporting errors to diffend
|
|
6
|
+
module Report
|
|
7
|
+
class << self
|
|
8
|
+
# Execute request to Diffend
|
|
9
|
+
#
|
|
10
|
+
# @param exception [Exception] expection that was raised
|
|
11
|
+
# @param payload [Hash] with versions to check
|
|
12
|
+
# @param config [OpenStruct] Diffend config
|
|
13
|
+
# @param message [Symbol] message that we want to display
|
|
14
|
+
# @param report [Boolean] if true we will report the issue to diffend
|
|
15
|
+
#
|
|
16
|
+
# @return [Net::HTTPResponse] response from Diffend
|
|
17
|
+
def call(config:, message:, exception: nil, payload: {}, report: false)
|
|
18
|
+
exception_payload = prepare_exception_payload(exception, payload)
|
|
19
|
+
|
|
20
|
+
Bundler.ui.error(Diffend::HandleErrors::Messages::PAYLOAD_DUMP)
|
|
21
|
+
Bundler.ui.error(Diffend::HandleErrors::Messages.const_get(message.to_s.upcase))
|
|
22
|
+
|
|
23
|
+
if report
|
|
24
|
+
Diffend::Request.call(
|
|
25
|
+
config,
|
|
26
|
+
errors_url(config.project_id),
|
|
27
|
+
exception_payload
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
exit 1
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Prepare exception payload and display it to stdout
|
|
35
|
+
#
|
|
36
|
+
# @param exception [Exception] expection that was raised
|
|
37
|
+
# @param payload [Hash] with versions to check
|
|
38
|
+
#
|
|
39
|
+
# @return [Hash]
|
|
40
|
+
def prepare_exception_payload(exception, payload)
|
|
41
|
+
Diffend::HandleErrors::BuildExceptionPayload
|
|
42
|
+
.call(exception, payload)
|
|
43
|
+
.tap(&Diffend::HandleErrors::DisplayToStdout.method(:call))
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Provides diffend errors endpoint url
|
|
47
|
+
#
|
|
48
|
+
# @param project_id [String] diffend project_id
|
|
49
|
+
#
|
|
50
|
+
# @return [String] diffend endpoint
|
|
51
|
+
def errors_url(project_id)
|
|
52
|
+
return ENV['DIFFEND_ERROR_URL'] if ENV.key?('DIFFEND_ERROR_URL')
|
|
53
|
+
|
|
54
|
+
"https://my.diffend.io/api/projects/#{project_id}/errors"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|