diffend 0.2.37 → 0.2.42
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 +27 -3
- data/CHANGELOG.md +27 -1
- data/Gemfile.lock +4 -4
- data/Rakefile +40 -0
- data/lib/diffend/build_bundler_definition.rb +4 -4
- data/lib/diffend/bundle_secure.rb +1 -3
- data/lib/diffend/errors.rb +2 -0
- data/lib/diffend/execute.rb +6 -5
- data/lib/diffend/handle_errors/report.rb +4 -4
- data/lib/diffend/integration_repository.rb +92 -0
- data/lib/diffend/local_context.rb +1 -1
- data/lib/diffend/local_context/host.rb +0 -12
- data/lib/diffend/local_context/packages.rb +35 -31
- data/lib/diffend/local_context/platform.rb +1 -1
- data/lib/diffend/logger.rb +3 -3
- data/lib/diffend/monitor.rb +17 -5
- 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 +9 -9
- 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: 358cc105e2ad7cf14855c23c3f661c9473fcdc6bdf46ccd38c37a6239df84063
|
4
|
+
data.tar.gz: 6aee0be769db07c076d190aefb35c10ab432296c78b63221a76d82bf48aecaae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f396679d536dab840175ac5a80c65a25f6edb05a38830586c517afca1c9951ad57460fe396e581c4f25c53b3778dab59b9070c7a8d18bfd5ea5d9fada2d958
|
7
|
+
data.tar.gz: 6b104626a4f76adcfbbcc0a209245265c96afff5bba585f9d81eaedbffa17862174abaca664860d46096176b9a821ad8e2c5c127ce6d9247c1fd9f9fe5c557e6
|
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:
|
@@ -12,10 +15,10 @@ jobs:
|
|
12
15
|
- '2.7'
|
13
16
|
- '2.6'
|
14
17
|
- '2.5'
|
15
|
-
- 'jruby-9.2.
|
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,26 @@
|
|
2
2
|
|
3
3
|
## [Unreleased][master]
|
4
4
|
|
5
|
+
## [0.2.42] (2021-03-09)
|
6
|
+
- introduce `DIFFEND_SKIP_DENY` flag
|
7
|
+
- fix config not being passed properly to `build_error` in `Diffend::Execute` ([#116](https://github.com/diffend-io/diffend-ruby/pull/116))
|
8
|
+
|
9
|
+
## [0.2.41] (2021-03-09)
|
10
|
+
- introduce integration specs ([#107](https://github.com/diffend-io/diffend-ruby/pull/107))
|
11
|
+
- use `Bundler::Definition.resolve` for specs ([#112](https://github.com/diffend-io/diffend-ruby/pull/112))
|
12
|
+
|
13
|
+
## [0.2.40] (2021-02-23)
|
14
|
+
- don't expose ips, we can identify instance by a hostname ([#108](https://github.com/diffend-io/diffend-ruby/pull/108))
|
15
|
+
- 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))
|
16
|
+
|
17
|
+
## [0.2.39] (2021-01-18)
|
18
|
+
- 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))
|
19
|
+
|
20
|
+
## [0.2.38] (2021-01-15)
|
21
|
+
- allow executing `bundle secure` without plugin being present in the Gemfile ([#96](https://github.com/diffend-io/diffend-ruby/pull/96))
|
22
|
+
- be explicit about `Bundler` scope ([#97](https://github.com/diffend-io/diffend-ruby/pull/97))
|
23
|
+
- switch to exponential backoff in `Diffend::Monitor` ([#98](https://github.com/diffend-io/diffend-ruby/pull/98))
|
24
|
+
|
5
25
|
## [0.2.37] (2021-01-05)
|
6
26
|
- add support for ENV loaded at runtime ([#92](https://github.com/diffend-io/diffend-ruby/pull/92))
|
7
27
|
- allow us to have more control over config errors ([#91](https://github.com/diffend-io/diffend-ruby/pull/91))
|
@@ -114,7 +134,13 @@
|
|
114
134
|
|
115
135
|
- initial release
|
116
136
|
|
117
|
-
[master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.
|
137
|
+
[master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.42...HEAD
|
138
|
+
[0.2.42]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.41...v0.2.42
|
139
|
+
[0.2.41]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.40...v0.2.41
|
140
|
+
[0.2.40]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.39...v0.2.40
|
141
|
+
[0.2.39]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.38...v0.2.39
|
142
|
+
[0.2.38]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.37...v0.2.38
|
143
|
+
[0.2.37]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.36...v0.2.37
|
118
144
|
[0.2.36]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.35...v0.2.36
|
119
145
|
[0.2.35]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.34...v0.2.35
|
120
146
|
[0.2.34]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.33...v0.2.34
|
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.42)
|
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
|
@@ -10,14 +10,14 @@ module Diffend
|
|
10
10
|
# @param gemfile [String] path to Gemfile
|
11
11
|
# @param lockfile [String] path to Gemfile.lock
|
12
12
|
#
|
13
|
-
# @return [Bundler::Definition]
|
13
|
+
# @return [::Bundler::Definition]
|
14
14
|
def call(command, gemfile, lockfile)
|
15
15
|
unlock = command == 'update' ? true : nil
|
16
16
|
|
17
|
-
Bundler.configure
|
18
|
-
Bundler::Fetcher.disable_endpoint = nil
|
17
|
+
::Bundler.configure
|
18
|
+
::Bundler::Fetcher.disable_endpoint = nil
|
19
19
|
|
20
|
-
Bundler::Definition
|
20
|
+
::Bundler::Definition
|
21
21
|
.build(gemfile, lockfile, unlock)
|
22
22
|
.tap(&:validate_runtime!)
|
23
23
|
end
|
@@ -3,15 +3,13 @@
|
|
3
3
|
module Diffend
|
4
4
|
# Extend bundler with a new secure command to be able to run Diffend separately
|
5
5
|
class BundleSecure
|
6
|
-
Bundler::Plugin::API.command(Diffend::Commands::SECURE, self)
|
6
|
+
::Bundler::Plugin::API.command(Diffend::Commands::SECURE, self)
|
7
7
|
|
8
8
|
# Execute diffend check
|
9
9
|
#
|
10
10
|
# @param _name [String] command name
|
11
11
|
# @param _args [Array] arguments from ARGV
|
12
12
|
def exec(_name, _args)
|
13
|
-
return unless Diffend::Enabled.call
|
14
|
-
|
15
13
|
config = Diffend::Config.new(
|
16
14
|
command: Diffend::Commands::SECURE,
|
17
15
|
severity: Diffend::Logger::INFO
|
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
@@ -17,12 +17,12 @@ module Diffend
|
|
17
17
|
|
18
18
|
# Build bundler definition
|
19
19
|
#
|
20
|
-
# @return [Bundler::Definition]
|
20
|
+
# @return [::Bundler::Definition]
|
21
21
|
def build_definition(command)
|
22
22
|
Diffend::BuildBundlerDefinition.call(
|
23
23
|
command,
|
24
|
-
Bundler.default_gemfile,
|
25
|
-
Bundler.default_lockfile
|
24
|
+
::Bundler.default_gemfile,
|
25
|
+
::Bundler.default_lockfile
|
26
26
|
)
|
27
27
|
end
|
28
28
|
|
@@ -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
|
@@ -7,7 +7,7 @@ module Diffend
|
|
7
7
|
# Build diffend, host, packages, and platform specific information
|
8
8
|
#
|
9
9
|
# @param config [Diffend::Config]
|
10
|
-
# @param definition [Bundler::Definition] definition for your source
|
10
|
+
# @param definition [::Bundler::Definition] definition for your source
|
11
11
|
#
|
12
12
|
# @return [Hash] payload for diffend endpoint
|
13
13
|
def call(config, definition)
|
@@ -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,17 +52,6 @@ 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]
|
@@ -9,8 +9,8 @@ module Diffend
|
|
9
9
|
ME_PATH = '.'
|
10
10
|
# Sources that we expect to match ourselves too
|
11
11
|
ME_SOURCES = [
|
12
|
-
Bundler::Source::Gemspec,
|
13
|
-
Bundler::Source::Path
|
12
|
+
::Bundler::Source::Gemspec,
|
13
|
+
::Bundler::Source::Path
|
14
14
|
].freeze
|
15
15
|
# List of dependency types
|
16
16
|
DEPENDENCIES_TYPES = {
|
@@ -32,11 +32,11 @@ module Diffend
|
|
32
32
|
|
33
33
|
class << self
|
34
34
|
# @param command [String] command executed via bundler
|
35
|
-
# @param definition [Bundler::Definition] definition for your source
|
35
|
+
# @param definition [::Bundler::Definition] definition for your source
|
36
36
|
def call(command, definition)
|
37
37
|
instance = new(command, definition)
|
38
38
|
|
39
|
-
Bundler.ui.silence { instance.resolve }
|
39
|
+
::Bundler.ui.silence { instance.resolve }
|
40
40
|
|
41
41
|
case command
|
42
42
|
when Commands::INSTALL, Commands::EXEC, Commands::SECURE then instance.build_install
|
@@ -48,7 +48,7 @@ module Diffend
|
|
48
48
|
end
|
49
49
|
|
50
50
|
# @param command [String] command executed via bundler
|
51
|
-
# @param definition [Bundler::Definition] definition for your source
|
51
|
+
# @param definition [::Bundler::Definition] definition for your source
|
52
52
|
#
|
53
53
|
# @return [Hash] local dependencies
|
54
54
|
def initialize(command, definition)
|
@@ -71,7 +71,9 @@ module Diffend
|
|
71
71
|
def build_install
|
72
72
|
hash = build_main
|
73
73
|
|
74
|
-
@definition.
|
74
|
+
@definition.resolve.each do |spec|
|
75
|
+
# Skip metadata
|
76
|
+
next if spec.instance_variable_get(:@specification).nil?
|
75
77
|
next if skip?(spec.source)
|
76
78
|
|
77
79
|
locked_spec = @locked_specs.find { |s| s.name == spec.name }
|
@@ -93,7 +95,9 @@ module Diffend
|
|
93
95
|
def build_update
|
94
96
|
hash = build_main
|
95
97
|
|
96
|
-
@definition.
|
98
|
+
@definition.resolve.each do |spec|
|
99
|
+
# Skip metadata
|
100
|
+
next if spec.instance_variable_get(:@specification).nil?
|
97
101
|
next if skip?(spec.source)
|
98
102
|
|
99
103
|
locked_spec = @locked_specs.find { |s| s.name == spec.name }
|
@@ -125,8 +129,8 @@ module Diffend
|
|
125
129
|
|
126
130
|
# Build gem versions
|
127
131
|
#
|
128
|
-
# @param spec [Bundler::StubSpecification, Bundler::LazySpecification, Gem::Specification]
|
129
|
-
# @param locked_spec [Bundler::LazySpecification, Gem::Specification, NilClass]
|
132
|
+
# @param spec [::Bundler::StubSpecification, ::Bundler::LazySpecification, Gem::Specification]
|
133
|
+
# @param locked_spec [::Bundler::LazySpecification, Gem::Specification, NilClass]
|
130
134
|
#
|
131
135
|
# @return [Array<String>]
|
132
136
|
def build_versions(spec, locked_spec = nil)
|
@@ -151,8 +155,8 @@ module Diffend
|
|
151
155
|
|
152
156
|
# Build gem platform
|
153
157
|
#
|
154
|
-
# @param spec [Bundler::StubSpecification, Bundler::LazySpecification, Gem::Specification]
|
155
|
-
# @param locked_spec [Bundler::LazySpecification, Gem::Specification, NilClass]
|
158
|
+
# @param spec [::Bundler::StubSpecification, ::Bundler::LazySpecification, Gem::Specification]
|
159
|
+
# @param locked_spec [::Bundler::LazySpecification, Gem::Specification, NilClass]
|
156
160
|
#
|
157
161
|
# @return [String]
|
158
162
|
def build_spec_platform(spec, locked_spec)
|
@@ -175,18 +179,18 @@ module Diffend
|
|
175
179
|
|
176
180
|
# Build gem source type
|
177
181
|
#
|
178
|
-
# @param source [Bundler::Source] gem source type
|
182
|
+
# @param source [::Bundler::Source] gem source type
|
179
183
|
#
|
180
184
|
# @return [Integer] internal gem source type
|
181
185
|
def build_spec_gem_source_type(source)
|
182
186
|
case source
|
183
|
-
when Bundler::Source::Metadata
|
187
|
+
when ::Bundler::Source::Metadata
|
184
188
|
GEM_SOURCES_TYPES[:local]
|
185
|
-
when Bundler::Source::Rubygems, Bundler::Source::Rubygems::Remote
|
189
|
+
when ::Bundler::Source::Rubygems, ::Bundler::Source::Rubygems::Remote
|
186
190
|
GEM_SOURCES_TYPES[:gemfile_source]
|
187
|
-
when Bundler::Source::Git
|
191
|
+
when ::Bundler::Source::Git
|
188
192
|
GEM_SOURCES_TYPES[:gemfile_git]
|
189
|
-
when Bundler::Source::Path
|
193
|
+
when ::Bundler::Source::Path
|
190
194
|
GEM_SOURCES_TYPES[:gemfile_path]
|
191
195
|
else
|
192
196
|
raise ArgumentError, "unknown source #{source.class}"
|
@@ -195,7 +199,7 @@ module Diffend
|
|
195
199
|
|
196
200
|
# Build gem source
|
197
201
|
#
|
198
|
-
# @param spec [Bundler::StubSpecification, Bundler::LazySpecification, Gem::Specification]
|
202
|
+
# @param spec [::Bundler::StubSpecification, ::Bundler::LazySpecification, Gem::Specification]
|
199
203
|
#
|
200
204
|
# @return [Hash]
|
201
205
|
def build_spec_source(spec)
|
@@ -209,16 +213,16 @@ module Diffend
|
|
209
213
|
|
210
214
|
# Figure out source for gem
|
211
215
|
#
|
212
|
-
# @param spec [Bundler::StubSpecification, Bundler::LazySpecification, Gem::Specification]
|
216
|
+
# @param spec [::Bundler::StubSpecification, ::Bundler::LazySpecification, Gem::Specification]
|
213
217
|
#
|
214
|
-
# @return [Bundler::Source] gem source type
|
218
|
+
# @return [::Bundler::Source] gem source type
|
215
219
|
def source_for_spec(spec)
|
216
220
|
return spec.remote if spec.remote
|
217
221
|
|
218
222
|
case spec.source
|
219
|
-
when Bundler::Source::Rubygems
|
220
|
-
Bundler::Source::Rubygems::Remote.new(spec.source.remotes.last)
|
221
|
-
when Bundler::Source::Metadata, Bundler::Source::Git, Bundler::Source::Path
|
223
|
+
when ::Bundler::Source::Rubygems
|
224
|
+
::Bundler::Source::Rubygems::Remote.new(spec.source.remotes.last)
|
225
|
+
when ::Bundler::Source::Metadata, ::Bundler::Source::Git, ::Bundler::Source::Path
|
222
226
|
spec.source
|
223
227
|
else
|
224
228
|
raise ArgumentError, "unknown source #{spec.source.class}"
|
@@ -227,25 +231,25 @@ module Diffend
|
|
227
231
|
|
228
232
|
# Build gem source name
|
229
233
|
#
|
230
|
-
# @param source [Bundler::Source] gem source type
|
234
|
+
# @param source [::Bundler::Source] gem source type
|
231
235
|
#
|
232
236
|
# @return [String]
|
233
237
|
def source_name_from_source(source)
|
234
238
|
case source
|
235
|
-
when Bundler::Source::Metadata
|
239
|
+
when ::Bundler::Source::Metadata
|
236
240
|
''
|
237
|
-
when Bundler::Source::Rubygems::Remote
|
241
|
+
when ::Bundler::Source::Rubygems::Remote
|
238
242
|
source_name(source.anonymized_uri)
|
239
|
-
when Bundler::Source::Git
|
243
|
+
when ::Bundler::Source::Git
|
240
244
|
source.instance_variable_get(:@safe_uri)
|
241
|
-
when Bundler::Source::Path
|
245
|
+
when ::Bundler::Source::Path
|
242
246
|
source.path
|
243
247
|
else
|
244
248
|
raise ArgumentError, "unknown source #{source.class}"
|
245
249
|
end
|
246
250
|
end
|
247
251
|
|
248
|
-
# @param uri [Bundler::URI]
|
252
|
+
# @param uri [::Bundler::URI]
|
249
253
|
#
|
250
254
|
# @return [String]
|
251
255
|
def source_name(uri)
|
@@ -272,7 +276,7 @@ module Diffend
|
|
272
276
|
|
273
277
|
# Build gem source type
|
274
278
|
#
|
275
|
-
# @param remotes [Array
|
279
|
+
# @param remotes [Array<::Bundler::URI>]
|
276
280
|
#
|
277
281
|
# @return [Integer] internal source type
|
278
282
|
def build_source_type(remotes)
|
@@ -281,7 +285,7 @@ module Diffend
|
|
281
285
|
|
282
286
|
# Checks if we should skip a source
|
283
287
|
#
|
284
|
-
# @param source [Bundler::Source] gem source type
|
288
|
+
# @param source [::Bundler::Source] gem source type
|
285
289
|
#
|
286
290
|
# @return [Boolean] true if we should skip this source, false otherwise
|
287
291
|
def skip?(source)
|
@@ -292,7 +296,7 @@ module Diffend
|
|
292
296
|
|
293
297
|
# Checks if it's a self source, this happens for repositories that are a gem
|
294
298
|
#
|
295
|
-
# @param source [Bundler::Source] gem source type
|
299
|
+
# @param source [::Bundler::Source] gem source type
|
296
300
|
#
|
297
301
|
# @return [Boolean] true if it's a self source, false otherwise
|
298
302
|
def me?(source)
|