diffend 0.2.36 → 0.2.41

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.github/workflows/ci.yml +34 -8
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +31 -1
  7. data/Gemfile +1 -0
  8. data/Gemfile.lock +11 -7
  9. data/Rakefile +40 -0
  10. data/lib/diffend/build_bundler_definition.rb +4 -4
  11. data/lib/diffend/bundle_secure.rb +23 -0
  12. data/lib/diffend/commands.rb +2 -0
  13. data/lib/diffend/config.rb +34 -7
  14. data/lib/diffend/configs/error_messages.rb +38 -0
  15. data/lib/diffend/configs/fetcher.rb +11 -28
  16. data/lib/diffend/configs/validator.rb +4 -34
  17. data/lib/diffend/enabled.rb +22 -0
  18. data/lib/diffend/errors.rb +2 -0
  19. data/lib/diffend/execute.rb +4 -4
  20. data/lib/diffend/handle_errors/report.rb +4 -4
  21. data/lib/diffend/integration_repository.rb +92 -0
  22. data/lib/diffend/local_context.rb +1 -1
  23. data/lib/diffend/local_context/host.rb +0 -12
  24. data/lib/diffend/local_context/packages.rb +36 -32
  25. data/lib/diffend/local_context/platform.rb +1 -1
  26. data/lib/diffend/logger.rb +9 -9
  27. data/lib/diffend/monitor.rb +32 -10
  28. data/lib/diffend/plugin.rb +12 -15
  29. data/lib/diffend/repository.rb +109 -0
  30. data/lib/diffend/request.rb +0 -1
  31. data/lib/diffend/request_object.rb +1 -1
  32. data/lib/diffend/request_verdict.rb +9 -9
  33. data/lib/diffend/shell.rb +44 -0
  34. data/lib/diffend/track.rb +4 -4
  35. data/lib/diffend/version.rb +1 -1
  36. data/plugins.rb +1 -0
  37. data/repositories/.diffend.yml +3 -0
  38. data/repositories/bundler_2_1_4/install_with_gemfile_lock/.diffend.yml +3 -0
  39. data/repositories/bundler_2_1_4/install_with_gemfile_lock/Gemfile +6 -0
  40. data/repositories/bundler_2_1_4/install_with_gemfile_lock/Gemfile.lock +22 -0
  41. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
  42. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_added_gem/Gemfile +6 -0
  43. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
  44. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/.diffend.yml +3 -0
  45. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
  46. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
  47. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
  48. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_locked_gem_version/.diffend.yml +3 -0
  49. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
  50. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +19 -0
  51. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
  52. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
  53. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_removed_gem/Gemfile.lock +43 -0
  54. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/.diffend.yml +3 -0
  55. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/.ruby-version +1 -0
  56. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/Gemfile +10 -0
  57. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/Gemfile.lock +32 -0
  58. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/gem-with-two-platforms.gemspec +16 -0
  59. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
  60. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
  61. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
  62. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
  63. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_sources/Gemfile +6 -0
  64. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_sources/Gemfile.lock +19 -0
  65. data/repositories/bundler_2_1_4/install_without_gemfile_lock/.diffend.yml +3 -0
  66. data/repositories/bundler_2_1_4/install_without_gemfile_lock/Gemfile +5 -0
  67. data/repositories/bundler_2_1_4/update_with_gemfile_lock/.diffend.yml +3 -0
  68. data/repositories/bundler_2_1_4/update_with_gemfile_lock/Gemfile +5 -0
  69. data/repositories/bundler_2_1_4/update_with_gemfile_lock/Gemfile.lock +16 -0
  70. data/repositories/bundler_2_1_4/update_with_gemfile_lock/README.md +1 -0
  71. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
  72. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/Gemfile +6 -0
  73. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
  74. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/README.md +1 -0
  75. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
  76. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
  77. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/Gemfile.lock +43 -0
  78. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/README.md +1 -0
  79. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
  80. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
  81. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
  82. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
  83. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
  84. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/Gemfile +6 -0
  85. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/Gemfile.lock +44 -0
  86. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/README.md +1 -0
  87. data/repositories/bundler_2_1_4/update_without_gemfile_lock/.diffend.yml +3 -0
  88. data/repositories/bundler_2_1_4/update_without_gemfile_lock/Gemfile +5 -0
  89. data/repositories/bundler_2_1_4/update_without_gemfile_lock/README.md +1 -0
  90. data/repositories/bundler_2_2_7/install_with_gemfile_lock/.diffend.yml +3 -0
  91. data/repositories/bundler_2_2_7/install_with_gemfile_lock/Gemfile +6 -0
  92. data/repositories/bundler_2_2_7/install_with_gemfile_lock/Gemfile.lock +21 -0
  93. data/repositories/bundler_2_2_7/install_with_gemfile_lock/README.md +1 -0
  94. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
  95. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/Gemfile +6 -0
  96. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
  97. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/README.md +1 -0
  98. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/.diffend.yml +3 -0
  99. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
  100. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
  101. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
  102. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/.diffend.yml +3 -0
  103. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
  104. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +18 -0
  105. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/README.md +1 -0
  106. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
  107. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
  108. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/Gemfile.lock +41 -0
  109. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/README.md +1 -0
  110. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/.diffend.yml +3 -0
  111. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/Gemfile +10 -0
  112. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/Gemfile.lock +30 -0
  113. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/README.md +1 -0
  114. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/gem-with-two-platforms.gemspec +16 -0
  115. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
  116. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
  117. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
  118. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
  119. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
  120. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/Gemfile +6 -0
  121. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/Gemfile.lock +19 -0
  122. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/README.md +1 -0
  123. data/repositories/bundler_2_2_7/install_without_gemfile_lock/.diffend.yml +3 -0
  124. data/repositories/bundler_2_2_7/install_without_gemfile_lock/Gemfile +5 -0
  125. data/repositories/bundler_2_2_7/install_without_gemfile_lock/README.md +1 -0
  126. data/repositories/bundler_2_2_7/update_with_gemfile_lock/.diffend.yml +3 -0
  127. data/repositories/bundler_2_2_7/update_with_gemfile_lock/Gemfile +5 -0
  128. data/repositories/bundler_2_2_7/update_with_gemfile_lock/Gemfile.lock +16 -0
  129. data/repositories/bundler_2_2_7/update_with_gemfile_lock/README.md +1 -0
  130. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
  131. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/Gemfile +6 -0
  132. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
  133. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/README.md +1 -0
  134. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
  135. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
  136. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
  137. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
  138. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +18 -0
  139. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_locked_gem_version/README.md +1 -0
  140. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
  141. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
  142. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_removed_gem/Gemfile.lock +41 -0
  143. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
  144. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
  145. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
  146. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
  147. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
  148. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/Gemfile +6 -0
  149. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/Gemfile.lock +42 -0
  150. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/README.md +1 -0
  151. data/repositories/bundler_2_2_7/update_without_gemfile_lock/.diffend.yml +3 -0
  152. data/repositories/bundler_2_2_7/update_without_gemfile_lock/Gemfile +5 -0
  153. data/repositories/diffend.json +9 -0
  154. metadata +127 -3
  155. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76c744c4aef5eaa735b131f3f866f9e89d01b9ae79e04cfa1a922419f4be4a3c
4
- data.tar.gz: 3ebbd02c2a0b693e57d9b4d7d73c8c9e490236189983a30e7c24caaffb7b5843
3
+ metadata.gz: cc35a87fc80048201e46cf210e72c4359849b9c17b3208a885e151c2384be274
4
+ data.tar.gz: c438271e070263543f0cc7ae84911631bc8f57dd4804d2fe58d529caf7929e49
5
5
  SHA512:
6
- metadata.gz: a166de7306a536d75d20d50c5fe27f27fe77cc4a3332446a85543f42a617b180d3bc97a1a0800c5ada0189eb59d923e8d0a7bd823d3f2f9e31ef2113263a616f
7
- data.tar.gz: 5b1890d48842a54166c3eae9d500d43f8c81172f66df9b5f768460fd65e97a2460f542eba99970db8fceb630c97a6fd71f1dd9fe7170c425d5f89b06f448499c
6
+ metadata.gz: 6e41e7343c6c0f1137dab1999ceebc1c8df54c2950e92f68b592d4f2b03c5fc2e5817b9443068423f2ea1508cc78884c169a4551a61e2723bb5c931d6ce05ed4
7
+ data.tar.gz: 877952bdb836a09034b0e72862cf374a8049a46ee4b416125beaad3a9102b14a1d22878b4128e6efded825d0bc896fcf1873f046f111da9d5ced03907c2d3a1b
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -2,16 +2,23 @@ name: ci
2
2
 
3
3
  jobs:
4
4
  specs:
5
- runs-on: ubuntu-latest
5
+ needs:
6
+ - diffend
7
+ - coditsu
6
8
 
9
+ runs-on: ubuntu-latest
7
10
  strategy:
8
11
  fail-fast: false
9
12
  matrix:
10
13
  ruby:
14
+ - '3.0'
11
15
  - '2.7'
12
16
  - '2.6'
13
17
  - '2.5'
14
- - 'jruby'
18
+ - 'jruby-9.2.14.0'
19
+ bundler:
20
+ - '2.1.4'
21
+ - '2.2.7'
15
22
  include:
16
23
  - ruby: '2.7'
17
24
  coverage: 'true'
@@ -30,19 +37,38 @@ jobs:
30
37
  uses: ruby/setup-ruby@v1
31
38
  with:
32
39
  ruby-version: ${{matrix.ruby}}
33
- - name: Install latest bundler
34
- run: |
35
- gem install bundler --no-document
40
+ bundler: ${{matrix.bundler}}
36
41
  - name: Bundle install
37
42
  env:
38
43
  DIFFEND_DEVELOPMENT: true
39
44
  run: |
40
- bundle config path vendor/bundle
41
- bundle install --jobs 4 --retry 3
45
+ bundle _${{matrix.bundler}}_ config path vendor/bundle
46
+ bundle _${{matrix.bundler}}_ install --jobs 4 --retry 3
42
47
  - name: Run all tests
43
48
  env:
44
49
  GITHUB_COVERAGE: ${{matrix.coverage}}
45
- run: bundle exec rspec
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
46
72
 
47
73
  coditsu:
48
74
  runs-on: ubuntu-latest
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.2
1
+ 3.0.0
data/CHANGELOG.md CHANGED
@@ -1,6 +1,32 @@
1
1
  # Changelog
2
2
 
3
3
  ## [Unreleased][master]
4
+ - introduce integration specs ([#107](https://github.com/diffend-io/diffend-ruby/pull/107))
5
+ - use `Bundler::Definition.resolve` for specs ([#112](https://github.com/diffend-io/diffend-ruby/pull/112))
6
+
7
+ ## [0.2.40] (2021-02-23)
8
+ - don't expose ips, we can identify instance by a hostname ([#108](https://github.com/diffend-io/diffend-ruby/pull/108))
9
+ - 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))
10
+
11
+ ## [0.2.39] (2021-01-18)
12
+ - 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))
13
+
14
+ ## [0.2.38] (2021-01-15)
15
+ - allow executing `bundle secure` without plugin being present in the Gemfile ([#96](https://github.com/diffend-io/diffend-ruby/pull/96))
16
+ - be explicit about `Bundler` scope ([#97](https://github.com/diffend-io/diffend-ruby/pull/97))
17
+ - switch to exponential backoff in `Diffend::Monitor` ([#98](https://github.com/diffend-io/diffend-ruby/pull/98))
18
+
19
+ ## [0.2.37] (2021-01-05)
20
+ - add support for ENV loaded at runtime ([#92](https://github.com/diffend-io/diffend-ruby/pull/92))
21
+ - allow us to have more control over config errors ([#91](https://github.com/diffend-io/diffend-ruby/pull/91))
22
+ - add `bundle secure` command ([#90](https://github.com/diffend-io/diffend-ruby/pull/90))
23
+ - test against bundler 2.1 and 2.2 ([#83](https://github.com/diffend-io/diffend-ruby/pull/83))
24
+ - test against ruby 3.0.0 ([#89](https://github.com/diffend-io/diffend-ruby/pull/89))
25
+ - simplify how we build full json in specs ([#82](https://github.com/diffend-io/diffend-ruby/pull/82))
26
+ - simplify how we build bundler json in specs ([#84](https://github.com/diffend-io/diffend-ruby/pull/84))
27
+ - simplify how we build diffend json in specs ([#85](https://github.com/diffend-io/diffend-ruby/pull/85))
28
+ - simplify how we build rubygems json in specs ([#86](https://github.com/diffend-io/diffend-ruby/pull/86))
29
+ - simplify how we build packages platforms json in specs ([#87](https://github.com/diffend-io/diffend-ruby/pull/87))
4
30
 
5
31
  ## [0.2.36] (2020-12-06)
6
32
  - handle `Bundler::PermissionError` ([#79](https://github.com/diffend-io/diffend-ruby/pull/79))
@@ -102,7 +128,11 @@
102
128
 
103
129
  - initial release
104
130
 
105
- [master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.36...HEAD
131
+ [master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.40...HEAD
132
+ [0.2.40]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.39...v0.2.40
133
+ [0.2.39]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.38...v0.2.39
134
+ [0.2.38]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.37...v0.2.38
135
+ [0.2.37]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.36...v0.2.37
106
136
  [0.2.36]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.35...v0.2.36
107
137
  [0.2.35]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.34...v0.2.35
108
138
  [0.2.34]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.33...v0.2.34
data/Gemfile CHANGED
@@ -7,5 +7,6 @@ plugin 'diffend'
7
7
  gemspec
8
8
 
9
9
  group :development, :test do
10
+ gem 'byebug', platform: :ruby
10
11
  gem 'rspec'
11
12
  end
data/Gemfile.lock CHANGED
@@ -1,36 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- diffend (0.2.36)
4
+ diffend (0.2.41)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ byebug (11.1.3)
9
10
  diff-lcs (1.4.4)
10
- rake (13.0.1)
11
+ rake (13.0.3)
11
12
  rspec (3.10.0)
12
13
  rspec-core (~> 3.10.0)
13
14
  rspec-expectations (~> 3.10.0)
14
15
  rspec-mocks (~> 3.10.0)
15
- rspec-core (3.10.0)
16
+ rspec-core (3.10.1)
16
17
  rspec-support (~> 3.10.0)
17
- rspec-expectations (3.10.0)
18
+ rspec-expectations (3.10.1)
18
19
  diff-lcs (>= 1.2.0, < 2.0)
19
20
  rspec-support (~> 3.10.0)
20
- rspec-mocks (3.10.0)
21
+ rspec-mocks (3.10.2)
21
22
  diff-lcs (>= 1.2.0, < 2.0)
22
23
  rspec-support (~> 3.10.0)
23
- rspec-support (3.10.0)
24
+ rspec-support (3.10.2)
24
25
 
25
26
  PLATFORMS
26
27
  java
27
28
  ruby
29
+ universal-java-13
30
+ x86_64-darwin-19
28
31
 
29
32
  DEPENDENCIES
30
33
  bundler
34
+ byebug
31
35
  diffend!
32
36
  rake
33
37
  rspec
34
38
 
35
39
  BUNDLED WITH
36
- 2.1.4
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
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Diffend
4
+ # Extend bundler with a new secure command to be able to run Diffend separately
5
+ class BundleSecure
6
+ ::Bundler::Plugin::API.command(Diffend::Commands::SECURE, self)
7
+
8
+ # Execute diffend check
9
+ #
10
+ # @param _name [String] command name
11
+ # @param _args [Array] arguments from ARGV
12
+ def exec(_name, _args)
13
+ config = Diffend::Config.new(
14
+ command: Diffend::Commands::SECURE,
15
+ severity: Diffend::Logger::INFO
16
+ )
17
+
18
+ Diffend::LatestVersion.call(config)
19
+
20
+ Diffend::Execute.call(config)
21
+ end
22
+ end
23
+ end
@@ -9,5 +9,7 @@ module Diffend
9
9
  UPDATE = 'update'
10
10
  # Bundler exec command
11
11
  EXEC = 'exec'
12
+ # Bundler secure command introduced by diffend plugin
13
+ SECURE = 'secure'
12
14
  end
13
15
  end
@@ -3,29 +3,50 @@
3
3
  module Diffend
4
4
  # Diffend config object
5
5
  class Config
6
- attr_reader :project_id, :shareable_id, :shareable_key, :build_path, :env, :command
6
+ # Name of the diffend config file
7
+ FILENAME = '.diffend.yml'
8
+
9
+ attr_reader :project_id, :shareable_id, :shareable_key, :build_path, :env, :command, :errors
7
10
 
8
11
  # Build diffend config object
9
12
  #
13
+ # @param command [String] command executed via bundler
14
+ # @param severity [Integer] logging severity threshold
15
+ # @param build_path [String] path of the current build
16
+ #
10
17
  # @return [Diffend::Config]
11
18
  def initialize(command: nil, severity: nil, build_path: nil)
12
19
  @log_level = severity
20
+ @errors = []
13
21
  build(command, build_path)
14
- validate
22
+ Diffend::Configs::Validator.call(self)
15
23
  end
16
24
 
25
+ # Initialize logger
17
26
  def logger
18
27
  @logger ||= Diffend::Logger.new(@log_level)
19
28
  end
20
29
 
30
+ # @return [Boolean] true if config is valid, false otherwise
31
+ def valid?
32
+ @errors.empty?
33
+ end
34
+
35
+ # @return [Boolean] true if we want to ignore errors, false otherwise
21
36
  def ignore_errors?
22
37
  @ignore_errors
23
38
  end
24
39
 
40
+ # @return [Boolean] true if we are in development mode, false otherwise
25
41
  def development?
26
42
  @development
27
43
  end
28
44
 
45
+ # @return [Boolean] true if we are in deployment mode, false otherwise
46
+ def deployment?
47
+ !%w[development test].include?(env)
48
+ end
49
+
29
50
  # Provides diffend commands endpoint url
30
51
  #
31
52
  # @return [String]
@@ -51,19 +72,24 @@ module Diffend
51
72
  "https://my.diffend.io/api/projects/#{project_id}/bundle/#{request_id}/track"
52
73
  end
53
74
 
75
+ # Print config errors
76
+ def print_errors
77
+ @errors.each { |error| logger.fatal(error) }
78
+ end
79
+
54
80
  private
55
81
 
82
+ # @param command [String] command executed via bundler
83
+ # @param build_path [String] path of the current build
56
84
  def build(command, build_path)
57
85
  build_path ||= File.expand_path('..', ::Bundler.bin_path)
58
- hash = Diffend::Configs::Fetcher.call(logger, plugin_path, build_path)
86
+ hash = Diffend::Configs::Fetcher.call(plugin_path, build_path)
59
87
  hash['build_path'] = build_path
60
88
  hash['command'] = command || build_command
61
89
 
62
90
  hash.each { |key, value| instance_variable_set(:"@#{key}", value) }
63
- end
64
-
65
- def validate
66
- Diffend::Configs::Validator.call(self)
91
+ rescue Errors::MalformedConfigurationFile
92
+ @errors << Diffend::Configs::ErrorMessages.malformed_file
67
93
  end
68
94
 
69
95
  # Command that was run with bundle
@@ -73,6 +99,7 @@ module Diffend
73
99
  ARGV.first || ::Bundler.feature_flag.default_cli_command.to_s
74
100
  end
75
101
 
102
+ # @return [String] path to the plugin
76
103
  def plugin_path
77
104
  Pathname.new(File.expand_path('../..', __dir__))
78
105
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Diffend
4
+ # Module for all the components related to setting up the config
5
+ module Configs
6
+ # Class responsible for config error messages
7
+ module ErrorMessages
8
+ class << self
9
+ # @return [String] malformed configuration file message
10
+ def malformed_file
11
+ 'Your Diffend configuration file is malformed. Please re-setup.'
12
+ end
13
+
14
+ # Missing key message
15
+ #
16
+ # @param key [String] missing key
17
+ #
18
+ # @return [String]
19
+ def missing_key(key)
20
+ "Diffend configuration is missing #{key} key"
21
+ end
22
+
23
+ # Invalid key message
24
+ #
25
+ # @param config [Diffend::Config]
26
+ # @param key [String] invalid key
27
+ #
28
+ # @return [String]
29
+ def invalid_key(config, key)
30
+ <<~MSG
31
+ Diffend configuration value for #{key} is invalid.
32
+ Expected #{Validator::KNOWN_KEYS[key].join(' or ')}, was #{config.public_send(key).class}.
33
+ MSG
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -11,7 +11,6 @@ module Diffend
11
11
  # Class responsible for fetching the config from .diffend.yml
12
12
  module Fetcher
13
13
  class << self
14
- # @param logger [Diffend::Logger]
15
14
  # @param plugin_path [String] path of the plugin
16
15
  # @param build_path [String] path of the current build
17
16
  #
@@ -20,24 +19,9 @@ module Diffend
20
19
  # @example
21
20
  # details = Fetcher.new.call('./')
22
21
  # details.build_path #=> './'
23
- def call(logger, plugin_path, build_path)
24
- build(plugin_path, build_path)
25
- rescue Errors::MalformedConfigurationFile
26
- build_malformed_error_message(build_path)
27
- .tap(&logger.method(:fatal))
28
-
29
- raise Diffend::Errors::HandledException
30
- end
31
-
32
- private
33
-
34
- # @param plugin_path [String] path of the plugin
35
- # @param build_path [String] path of the current build
36
- #
37
- # @return [OpenStruct] open struct with config details
38
- def build(plugin_path, build_path)
22
+ def call(plugin_path, build_path)
39
23
  default_config = File.join(plugin_path, 'config', 'diffend.yml')
40
- project_config = File.join(build_path, '.diffend.yml')
24
+ project_config = File.join(build_path, Diffend::Config::FILENAME)
41
25
 
42
26
  hash = read_file(default_config)
43
27
 
@@ -48,19 +32,18 @@ module Diffend
48
32
  hash
49
33
  end
50
34
 
51
- def read_file(path)
52
- YAML.safe_load(ERB.new(File.read(path)).result)
35
+ private
36
+
37
+ # Load config file
38
+ #
39
+ # @param file_path [String]
40
+ #
41
+ # @return [Hash]
42
+ def read_file(file_path)
43
+ YAML.safe_load(ERB.new(File.read(file_path)).result)
53
44
  rescue Psych::SyntaxError
54
45
  raise Errors::MalformedConfigurationFile
55
46
  end
56
-
57
- # @return [String] malformed configuration file message
58
- def build_malformed_error_message
59
- <<~MSG
60
- \nYour Diffend configuration file is malformed.\n
61
- Please re-setup.\n
62
- MSG
63
- end
64
47
  end
65
48
  end
66
49
  end