diffend 0.2.38 → 0.2.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.github/workflows/ci.yml +26 -2
- data/CHANGELOG.md +25 -1
- data/Gemfile.lock +4 -4
- data/Rakefile +40 -0
- data/lib/diffend/commands.rb +2 -0
- data/lib/diffend/errors.rb +2 -0
- data/lib/diffend/execute.rb +3 -2
- data/lib/diffend/handle_errors/report.rb +4 -4
- data/lib/diffend/integration_repository.rb +92 -0
- data/lib/diffend/local_context/host.rb +12 -13
- data/lib/diffend/local_context/packages.rb +6 -27
- data/lib/diffend/monitor.rb +4 -0
- data/lib/diffend/plugin.rb +3 -0
- data/lib/diffend/repository.rb +109 -0
- data/lib/diffend/request.rb +0 -1
- data/lib/diffend/request_object.rb +1 -1
- data/lib/diffend/request_verdict.rb +4 -4
- data/lib/diffend/shell.rb +44 -0
- data/lib/diffend/track.rb +4 -4
- data/lib/diffend/version.rb +1 -1
- data/repositories/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock/Gemfile +6 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock/Gemfile.lock +22 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_added_gem/Gemfile +6 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_locked_gem_version/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +19 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_removed_gem/Gemfile.lock +43 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/.ruby-version +1 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/Gemfile +10 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/Gemfile.lock +32 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/gem-with-two-platforms.gemspec +16 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_sources/Gemfile +6 -0
- data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_sources/Gemfile.lock +19 -0
- data/repositories/bundler_2_1_4/install_without_gemfile_lock/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/install_without_gemfile_lock/Gemfile +5 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock/Gemfile +5 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock/Gemfile.lock +16 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock/README.md +1 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/Gemfile +6 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/README.md +1 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/Gemfile.lock +43 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/README.md +1 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/Gemfile +6 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/Gemfile.lock +44 -0
- data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/README.md +1 -0
- data/repositories/bundler_2_1_4/update_without_gemfile_lock/.diffend.yml +3 -0
- data/repositories/bundler_2_1_4/update_without_gemfile_lock/Gemfile +5 -0
- data/repositories/bundler_2_1_4/update_without_gemfile_lock/README.md +1 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock/Gemfile +6 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock/Gemfile.lock +21 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock/README.md +1 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/Gemfile +6 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/README.md +1 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +18 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/README.md +1 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/Gemfile.lock +41 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/README.md +1 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/Gemfile +10 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/Gemfile.lock +30 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/README.md +1 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/gem-with-two-platforms.gemspec +16 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/Gemfile +6 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/Gemfile.lock +19 -0
- data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/README.md +1 -0
- data/repositories/bundler_2_2_7/install_without_gemfile_lock/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/install_without_gemfile_lock/Gemfile +5 -0
- data/repositories/bundler_2_2_7/install_without_gemfile_lock/README.md +1 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock/Gemfile +5 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock/Gemfile.lock +16 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock/README.md +1 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/Gemfile +6 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/README.md +1 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +18 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_locked_gem_version/README.md +1 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_removed_gem/Gemfile.lock +41 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/Gemfile +6 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/Gemfile.lock +42 -0
- data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/README.md +1 -0
- data/repositories/bundler_2_2_7/update_without_gemfile_lock/.diffend.yml +3 -0
- data/repositories/bundler_2_2_7/update_without_gemfile_lock/Gemfile +5 -0
- data/repositories/diffend.json +9 -0
- metadata +123 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00ff9a1819f62275a52e0d531ac9a3d9061e388867ec5e73ea0dc923a9ba30ed
|
4
|
+
data.tar.gz: '092ac2a98fd88ca4c8cc014aec5a2e485c6a280b17e44e3000b99d5dddbb0bf3'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f6d630a67a621c4a92c1835340ef2195834ba9c2717de4d4da4256b31cbf709347d2129593b167de4dfb8bdf27d771127b9fcefdde2e3b4ee5cfe05b8f2e666
|
7
|
+
data.tar.gz: feee0a4cd775f6aa3a7324294975e20c9edb51fb9bc733c33765bc0f3c31a130315f94d92779acab7d5ac6f3b3783d9b9ed992f48fd741a5069e58d88cbcdd03
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -2,8 +2,11 @@ name: ci
|
|
2
2
|
|
3
3
|
jobs:
|
4
4
|
specs:
|
5
|
-
|
5
|
+
needs:
|
6
|
+
- diffend
|
7
|
+
- coditsu
|
6
8
|
|
9
|
+
runs-on: ubuntu-latest
|
7
10
|
strategy:
|
8
11
|
fail-fast: false
|
9
12
|
matrix:
|
@@ -15,7 +18,7 @@ jobs:
|
|
15
18
|
- 'jruby-9.2.14.0'
|
16
19
|
bundler:
|
17
20
|
- '2.1.4'
|
18
|
-
- '2.2.
|
21
|
+
- '2.2.7'
|
19
22
|
include:
|
20
23
|
- ruby: '2.7'
|
21
24
|
coverage: 'true'
|
@@ -45,6 +48,27 @@ jobs:
|
|
45
48
|
env:
|
46
49
|
GITHUB_COVERAGE: ${{matrix.coverage}}
|
47
50
|
run: bundle _${{matrix.bundler}}_ exec rspec
|
51
|
+
- name: Run integration tests
|
52
|
+
run: bundle _${{matrix.bundler}}_ exec rake integration_suite
|
53
|
+
|
54
|
+
diffend:
|
55
|
+
runs-on: ubuntu-latest
|
56
|
+
strategy:
|
57
|
+
fail-fast: false
|
58
|
+
steps:
|
59
|
+
- uses: actions/checkout@v2
|
60
|
+
with:
|
61
|
+
fetch-depth: 0
|
62
|
+
- name: Set up Ruby
|
63
|
+
uses: ruby/setup-ruby@v1
|
64
|
+
with:
|
65
|
+
ruby-version: 3.0
|
66
|
+
- name: Install latest bundler
|
67
|
+
run: gem install bundler --no-document
|
68
|
+
- name: Install Diffend plugin
|
69
|
+
run: bundle plugin install diffend
|
70
|
+
- name: Bundle Secure
|
71
|
+
run: bundle secure
|
48
72
|
|
49
73
|
coditsu:
|
50
74
|
runs-on: ubuntu-latest
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,25 @@
|
|
2
2
|
|
3
3
|
## [Unreleased][master]
|
4
4
|
|
5
|
+
## [0.2.43] (2021-03-16)
|
6
|
+
- introduce `DIFFEND_TAGS` ([#119](https://github.com/diffend-io/diffend-ruby/pull/119))
|
7
|
+
- add support for `bundle add` command ([#118](https://github.com/diffend-io/diffend-ruby/pull/118))
|
8
|
+
|
9
|
+
## [0.2.42] (2021-03-09)
|
10
|
+
- introduce `DIFFEND_SKIP_DENY` flag
|
11
|
+
- fix config not being passed properly to `build_error` in `Diffend::Execute` ([#116](https://github.com/diffend-io/diffend-ruby/pull/116))
|
12
|
+
|
13
|
+
## [0.2.41] (2021-03-09)
|
14
|
+
- introduce integration specs ([#107](https://github.com/diffend-io/diffend-ruby/pull/107))
|
15
|
+
- use `Bundler::Definition.resolve` for specs ([#112](https://github.com/diffend-io/diffend-ruby/pull/112))
|
16
|
+
|
17
|
+
## [0.2.40] (2021-02-23)
|
18
|
+
- don't expose ips, we can identify instance by a hostname ([#108](https://github.com/diffend-io/diffend-ruby/pull/108))
|
19
|
+
- don't set `verify_mode` when creating request in `Diffend::Request`, use default value set by `use_ssl` flag instead ([#109](https://github.com/diffend-io/diffend-ruby/pull/109))
|
20
|
+
|
21
|
+
## [0.2.39] (2021-01-18)
|
22
|
+
- handle a case if we start to fast and some gems require things it may break the execution ([#101](https://github.com/diffend-io/diffend-ruby/pull/101))
|
23
|
+
|
5
24
|
## [0.2.38] (2021-01-15)
|
6
25
|
- allow executing `bundle secure` without plugin being present in the Gemfile ([#96](https://github.com/diffend-io/diffend-ruby/pull/96))
|
7
26
|
- be explicit about `Bundler` scope ([#97](https://github.com/diffend-io/diffend-ruby/pull/97))
|
@@ -119,7 +138,12 @@
|
|
119
138
|
|
120
139
|
- initial release
|
121
140
|
|
122
|
-
[master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.
|
141
|
+
[master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.43...HEAD
|
142
|
+
[0.2.43]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.42...v0.2.43
|
143
|
+
[0.2.42]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.41...v0.2.42
|
144
|
+
[0.2.41]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.40...v0.2.41
|
145
|
+
[0.2.40]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.39...v0.2.40
|
146
|
+
[0.2.39]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.38...v0.2.39
|
123
147
|
[0.2.38]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.37...v0.2.38
|
124
148
|
[0.2.37]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.36...v0.2.37
|
125
149
|
[0.2.36]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.35...v0.2.36
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
diffend (0.2.
|
4
|
+
diffend (0.2.43)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -18,10 +18,10 @@ GEM
|
|
18
18
|
rspec-expectations (3.10.1)
|
19
19
|
diff-lcs (>= 1.2.0, < 2.0)
|
20
20
|
rspec-support (~> 3.10.0)
|
21
|
-
rspec-mocks (3.10.
|
21
|
+
rspec-mocks (3.10.2)
|
22
22
|
diff-lcs (>= 1.2.0, < 2.0)
|
23
23
|
rspec-support (~> 3.10.0)
|
24
|
-
rspec-support (3.10.
|
24
|
+
rspec-support (3.10.2)
|
25
25
|
|
26
26
|
PLATFORMS
|
27
27
|
java
|
@@ -37,4 +37,4 @@ DEPENDENCIES
|
|
37
37
|
rspec
|
38
38
|
|
39
39
|
BUNDLED WITH
|
40
|
-
2.2.
|
40
|
+
2.2.7
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
%w[
|
4
|
+
bundler/setup
|
5
|
+
].each(&method(:require))
|
6
|
+
|
7
|
+
require 'diffend/errors'
|
8
|
+
require 'diffend/config'
|
9
|
+
require 'diffend/shell'
|
10
|
+
require 'diffend/repository'
|
11
|
+
require 'diffend/integration_repository'
|
12
|
+
|
13
|
+
task :integration_suite do
|
14
|
+
Diffend::Repository::SUPPORTED.each do |command, repositories|
|
15
|
+
repositories.each do |repository_name|
|
16
|
+
repository = Diffend::IntegrationRepository.new(command, repository_name)
|
17
|
+
repository.repository.isolate do |path|
|
18
|
+
start = Time.now.to_f
|
19
|
+
|
20
|
+
repository.config?(path)
|
21
|
+
|
22
|
+
Bundler.with_unbundled_env do
|
23
|
+
repository.install_plugin(path)
|
24
|
+
|
25
|
+
cmd = Diffend::Shell.call_in_path(path, "bundle #{command}")
|
26
|
+
|
27
|
+
unless cmd[:exit_code].zero?
|
28
|
+
puts "#{repository.full_name} FAILED"
|
29
|
+
puts cmd[:stderr]
|
30
|
+
exit 1
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
took = Time.now.to_f - start
|
35
|
+
|
36
|
+
puts "#{repository.full_name} OK, took #{took.round(1)}s"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/diffend/commands.rb
CHANGED
data/lib/diffend/errors.rb
CHANGED
@@ -21,5 +21,7 @@ module Diffend
|
|
21
21
|
HandledException = Class.new(BaseError)
|
22
22
|
# Raised when we are unable to resolve dependencies
|
23
23
|
DependenciesResolveException = Class.new(BaseError)
|
24
|
+
# Failure of a shell command execution
|
25
|
+
FailedShellCommand = Class.new(BaseError)
|
24
26
|
end
|
25
27
|
end
|
data/lib/diffend/execute.rb
CHANGED
@@ -43,8 +43,9 @@ module Diffend
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
# @param config [Diffend::Config]
|
46
47
|
# @param response [Hash] response from diffend API
|
47
|
-
def build_error(response)
|
48
|
+
def build_error(config, response)
|
48
49
|
build_error_message(response)
|
49
50
|
.tap(&config.logger.method(:error))
|
50
51
|
|
@@ -65,7 +66,7 @@ module Diffend
|
|
65
66
|
build_deny_message(config.command, response)
|
66
67
|
.tap(&config.logger.method(:error))
|
67
68
|
|
68
|
-
exit 1
|
69
|
+
exit 1 unless ENV.key?('DIFFEND_SKIP_DENY')
|
69
70
|
else
|
70
71
|
Diffend::HandleErrors::Report.call(
|
71
72
|
config: config,
|
@@ -39,10 +39,10 @@ module Diffend
|
|
39
39
|
# @return [Diffend::RequestObject]
|
40
40
|
def build_request_object(config, payload)
|
41
41
|
Diffend::RequestObject.new(
|
42
|
-
config
|
43
|
-
|
44
|
-
payload
|
45
|
-
|
42
|
+
config,
|
43
|
+
config.errors_url,
|
44
|
+
payload,
|
45
|
+
:post
|
46
46
|
)
|
47
47
|
end
|
48
48
|
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Diffend
|
4
|
+
# Repository for integrations
|
5
|
+
class IntegrationRepository
|
6
|
+
# Plugin code entry in Gemfile
|
7
|
+
GEMFILE_PLUGIN_ENTRY = 'plugin \'diffend\''
|
8
|
+
# Gemfile file name
|
9
|
+
GEMFILE_FILE_NAME = 'Gemfile'
|
10
|
+
# Gemfile backup file name
|
11
|
+
GEMFILE_BACKUP_FILE_NAME = 'Gemfile.backup'
|
12
|
+
# Plugin install command
|
13
|
+
PLUGIN_INSTALL_COMMAND = 'bundle plugin install diffend'
|
14
|
+
|
15
|
+
attr_reader :command, :name, :repository
|
16
|
+
|
17
|
+
# @param command [String] command executed via bundler
|
18
|
+
# @param name [String] repository name
|
19
|
+
def initialize(command, name)
|
20
|
+
@command = command
|
21
|
+
@name = name
|
22
|
+
@repository = Diffend::Repository.new(command, name)
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String] full name of the repository with command
|
26
|
+
def full_name
|
27
|
+
"#{command}_#{name}"
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param path [String] path to the repository
|
31
|
+
def config?(path)
|
32
|
+
# check if .diffend.yml exists
|
33
|
+
return if File.exist?(File.join(path, Diffend::Config::FILENAME))
|
34
|
+
|
35
|
+
puts "Diffend configuration does not exist for #{command} #{name}"
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param path [String] path to the repository
|
40
|
+
def install_plugin(path)
|
41
|
+
cmd = Diffend::Shell.call_in_path(path, PLUGIN_INSTALL_COMMAND)
|
42
|
+
|
43
|
+
unless cmd[:exit_code].zero?
|
44
|
+
puts "#{PLUGIN_INSTALL_COMMAND} failed"
|
45
|
+
puts cmd[:stderr]
|
46
|
+
exit 1
|
47
|
+
end
|
48
|
+
|
49
|
+
switch_plugin_to_development(path, cmd[:stdout])
|
50
|
+
add_plugin_to_gemfile(path)
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
# @param path [String] path to the repository
|
56
|
+
# @param stdout [String] stdout from plugin install command
|
57
|
+
def switch_plugin_to_development(path, stdout)
|
58
|
+
installed_version = stdout.scan(/Installing diffend (\d*\.\d*\.\d*)/)[0][0]
|
59
|
+
diffend_working_path = File.expand_path('..', Bundler.bin_path)
|
60
|
+
bundler_plugins_path = File.join(path, '.bundle/plugin/gems')
|
61
|
+
bundler_diffend_plugin_path = File.join(bundler_plugins_path, "diffend-#{installed_version}")
|
62
|
+
FileUtils.mv(bundler_diffend_plugin_path, "#{bundler_diffend_plugin_path}-")
|
63
|
+
FileUtils.ln_s(diffend_working_path, bundler_diffend_plugin_path)
|
64
|
+
end
|
65
|
+
|
66
|
+
# @param path [String] path to the repository
|
67
|
+
def add_plugin_to_gemfile(path)
|
68
|
+
gemfile_path = File.join(path, GEMFILE_FILE_NAME)
|
69
|
+
|
70
|
+
FileUtils.mv(gemfile_path, File.join(path, GEMFILE_BACKUP_FILE_NAME))
|
71
|
+
file = File.open(gemfile_path, 'w')
|
72
|
+
source_detected = nil
|
73
|
+
|
74
|
+
File.readlines(
|
75
|
+
File.join(path, GEMFILE_BACKUP_FILE_NAME)
|
76
|
+
).each do |line|
|
77
|
+
if line.start_with?('source') && source_detected.nil?
|
78
|
+
source_detected = true
|
79
|
+
elsif source_detected
|
80
|
+
source_detected = false
|
81
|
+
file.write("\n#{GEMFILE_PLUGIN_ENTRY}\n")
|
82
|
+
end
|
83
|
+
|
84
|
+
file.write(line)
|
85
|
+
end
|
86
|
+
|
87
|
+
file.close
|
88
|
+
|
89
|
+
FileUtils.rm(File.join(path, GEMFILE_BACKUP_FILE_NAME))
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -16,7 +16,6 @@ module Diffend
|
|
16
16
|
|
17
17
|
{
|
18
18
|
'command' => command,
|
19
|
-
'ips' => ips,
|
20
19
|
'name' => uname[:nodename],
|
21
20
|
'system' => {
|
22
21
|
'machine' => uname[:machine],
|
@@ -53,22 +52,11 @@ module Diffend
|
|
53
52
|
end
|
54
53
|
end
|
55
54
|
|
56
|
-
# Build host ips, except localhost and loopback
|
57
|
-
#
|
58
|
-
# @return [Array<String>]
|
59
|
-
def ips
|
60
|
-
Socket.ip_address_list.map do |ip|
|
61
|
-
next if ip.ipv4_loopback? || ip.ipv6_loopback? || ip.ipv6_linklocal?
|
62
|
-
|
63
|
-
ip.ip_address
|
64
|
-
end.compact
|
65
|
-
end
|
66
|
-
|
67
55
|
# Build host tags
|
68
56
|
#
|
69
57
|
# @return [Array]
|
70
58
|
def tags
|
71
|
-
tags =
|
59
|
+
tags = prepare_user_tags
|
72
60
|
|
73
61
|
if ENV.key?('GITHUB_ACTIONS')
|
74
62
|
tags << 'ci'
|
@@ -83,6 +71,17 @@ module Diffend
|
|
83
71
|
tags
|
84
72
|
end
|
85
73
|
|
74
|
+
# Prepare user tags
|
75
|
+
#
|
76
|
+
# @return [Array]
|
77
|
+
def prepare_user_tags
|
78
|
+
if ENV.key?('DIFFEND_TAGS')
|
79
|
+
ENV['DIFFEND_TAGS'].split(',')
|
80
|
+
else
|
81
|
+
[]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
86
85
|
# @param str [String] that we want to clean and truncate
|
87
86
|
def clean(str)
|
88
87
|
str
|
@@ -39,8 +39,7 @@ module Diffend
|
|
39
39
|
::Bundler.ui.silence { instance.resolve }
|
40
40
|
|
41
41
|
case command
|
42
|
-
when Commands::INSTALL, Commands::EXEC, Commands::SECURE then instance.
|
43
|
-
when Commands::UPDATE then instance.build_update
|
42
|
+
when Commands::INSTALL, Commands::EXEC, Commands::SECURE, Commands::UPDATE, Commands::ADD then instance.build
|
44
43
|
else
|
45
44
|
raise ArgumentError, "invalid command: #{command}"
|
46
45
|
end
|
@@ -65,35 +64,15 @@ module Diffend
|
|
65
64
|
@cached ? @definition.resolve_with_cache! : @definition.resolve_remotely!
|
66
65
|
end
|
67
66
|
|
68
|
-
# Build
|
67
|
+
# Build specification
|
69
68
|
#
|
70
69
|
# @return [Hash]
|
71
|
-
def
|
70
|
+
def build
|
72
71
|
hash = build_main
|
73
72
|
|
74
|
-
@definition.
|
75
|
-
|
76
|
-
|
77
|
-
locked_spec = @locked_specs.find { |s| s.name == spec.name }
|
78
|
-
|
79
|
-
hash['dependencies'][spec.name] = {
|
80
|
-
'platform' => build_spec_platform(spec, locked_spec),
|
81
|
-
'source' => build_spec_source(spec),
|
82
|
-
'type' => build_dependency_type(spec.name),
|
83
|
-
'versions' => build_versions(spec, locked_spec)
|
84
|
-
}
|
85
|
-
end
|
86
|
-
|
87
|
-
hash
|
88
|
-
end
|
89
|
-
|
90
|
-
# Build update specification
|
91
|
-
#
|
92
|
-
# @return [Hash]
|
93
|
-
def build_update
|
94
|
-
hash = build_main
|
95
|
-
|
96
|
-
@definition.specs.each do |spec|
|
73
|
+
@definition.resolve.each do |spec|
|
74
|
+
# Skip metadata
|
75
|
+
next if spec.instance_variable_get(:@specification).nil?
|
97
76
|
next if skip?(spec.source)
|
98
77
|
|
99
78
|
locked_spec = @locked_specs.find { |s| s.name == spec.name }
|
data/lib/diffend/monitor.rb
CHANGED
@@ -39,6 +39,10 @@ Thread.new do
|
|
39
39
|
config = nil
|
40
40
|
retry_count = 0
|
41
41
|
|
42
|
+
# There is an issue if we start to fast and there are gems that require things,
|
43
|
+
# it may break the execution. That's why we want to give the application time to boot.
|
44
|
+
sleep(0.5)
|
45
|
+
|
42
46
|
loop do
|
43
47
|
config = Diffend::Config.new(
|
44
48
|
command: Diffend::Commands::EXEC,
|