diffend 0.2.40 → 0.2.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) 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 +3 -0
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +23 -1
  7. data/Gemfile.lock +3 -2
  8. data/Rakefile +43 -0
  9. data/certs/mensfeld.pem +21 -21
  10. data/diffend.gemspec +1 -1
  11. data/lib/diffend/commands.rb +2 -0
  12. data/lib/diffend/configs/error_messages.rb +11 -0
  13. data/lib/diffend/configs/validator.rb +22 -0
  14. data/lib/diffend/errors.rb +2 -0
  15. data/lib/diffend/execute.rb +4 -3
  16. data/lib/diffend/handle_errors/report.rb +4 -4
  17. data/lib/diffend/integration_repository.rb +92 -0
  18. data/lib/diffend/local_context/host.rb +12 -1
  19. data/lib/diffend/local_context/packages.rb +10 -27
  20. data/lib/diffend/plugin.rb +3 -0
  21. data/lib/diffend/repository.rb +109 -0
  22. data/lib/diffend/request_object.rb +1 -1
  23. data/lib/diffend/request_verdict.rb +4 -4
  24. data/lib/diffend/shell.rb +44 -0
  25. data/lib/diffend/track.rb +4 -4
  26. data/lib/diffend/version.rb +1 -1
  27. data/repositories/.diffend.yml +3 -0
  28. data/repositories/bundler_2_1_4/install_with_gemfile_lock/.diffend.yml +3 -0
  29. data/repositories/bundler_2_1_4/install_with_gemfile_lock/Gemfile +6 -0
  30. data/repositories/bundler_2_1_4/install_with_gemfile_lock/Gemfile.lock +22 -0
  31. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
  32. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_added_gem/Gemfile +6 -0
  33. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
  34. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/.diffend.yml +3 -0
  35. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
  36. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
  37. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
  38. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_locked_gem_version/.diffend.yml +3 -0
  39. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
  40. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +19 -0
  41. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
  42. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
  43. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_removed_gem/Gemfile.lock +43 -0
  44. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/.diffend.yml +3 -0
  45. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/.ruby-version +1 -0
  46. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/Gemfile +10 -0
  47. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/Gemfile.lock +32 -0
  48. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_platforms/gem-with-two-platforms.gemspec +16 -0
  49. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
  50. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
  51. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
  52. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
  53. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_sources/Gemfile +6 -0
  54. data/repositories/bundler_2_1_4/install_with_gemfile_lock_with_two_sources/Gemfile.lock +19 -0
  55. data/repositories/bundler_2_1_4/install_without_gemfile_lock/.diffend.yml +3 -0
  56. data/repositories/bundler_2_1_4/install_without_gemfile_lock/Gemfile +5 -0
  57. data/repositories/bundler_2_1_4/update_with_gemfile_lock/.diffend.yml +3 -0
  58. data/repositories/bundler_2_1_4/update_with_gemfile_lock/Gemfile +5 -0
  59. data/repositories/bundler_2_1_4/update_with_gemfile_lock/Gemfile.lock +16 -0
  60. data/repositories/bundler_2_1_4/update_with_gemfile_lock/README.md +1 -0
  61. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
  62. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/Gemfile +6 -0
  63. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
  64. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_added_gem/README.md +1 -0
  65. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
  66. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
  67. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/Gemfile.lock +43 -0
  68. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_removed_gem/README.md +1 -0
  69. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
  70. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
  71. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
  72. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
  73. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
  74. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/Gemfile +6 -0
  75. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/Gemfile.lock +44 -0
  76. data/repositories/bundler_2_1_4/update_with_gemfile_lock_with_two_sources/README.md +1 -0
  77. data/repositories/bundler_2_1_4/update_without_gemfile_lock/.diffend.yml +3 -0
  78. data/repositories/bundler_2_1_4/update_without_gemfile_lock/Gemfile +5 -0
  79. data/repositories/bundler_2_1_4/update_without_gemfile_lock/README.md +1 -0
  80. data/repositories/bundler_2_2_17/install_with_gemfile_lock/.diffend.yml +3 -0
  81. data/repositories/bundler_2_2_17/install_with_gemfile_lock/Gemfile +6 -0
  82. data/repositories/bundler_2_2_17/install_with_gemfile_lock/Gemfile.lock +21 -0
  83. data/repositories/bundler_2_2_17/install_with_gemfile_lock/README.md +1 -0
  84. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
  85. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_added_gem/Gemfile +6 -0
  86. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
  87. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_added_gem/README.md +1 -0
  88. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_changed_gem_version/.diffend.yml +3 -0
  89. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
  90. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
  91. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
  92. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_locked_gem_version/.diffend.yml +3 -0
  93. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
  94. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +18 -0
  95. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_locked_gem_version/README.md +1 -0
  96. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
  97. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
  98. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_removed_gem/Gemfile.lock +41 -0
  99. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_removed_gem/README.md +1 -0
  100. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_platforms/.diffend.yml +3 -0
  101. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_platforms/Gemfile +10 -0
  102. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_platforms/Gemfile.lock +30 -0
  103. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_platforms/README.md +1 -0
  104. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_platforms/gem-with-two-platforms.gemspec +16 -0
  105. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
  106. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
  107. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
  108. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
  109. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
  110. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_sources/Gemfile +6 -0
  111. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_sources/Gemfile.lock +19 -0
  112. data/repositories/bundler_2_2_17/install_with_gemfile_lock_with_two_sources/README.md +1 -0
  113. data/repositories/bundler_2_2_17/install_without_gemfile_lock/.diffend.yml +3 -0
  114. data/repositories/bundler_2_2_17/install_without_gemfile_lock/Gemfile +5 -0
  115. data/repositories/bundler_2_2_17/install_without_gemfile_lock/README.md +1 -0
  116. data/repositories/bundler_2_2_17/update_with_gemfile_lock/.diffend.yml +3 -0
  117. data/repositories/bundler_2_2_17/update_with_gemfile_lock/Gemfile +5 -0
  118. data/repositories/bundler_2_2_17/update_with_gemfile_lock/Gemfile.lock +16 -0
  119. data/repositories/bundler_2_2_17/update_with_gemfile_lock/README.md +1 -0
  120. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
  121. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_added_gem/Gemfile +6 -0
  122. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
  123. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_added_gem/README.md +1 -0
  124. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
  125. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
  126. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
  127. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
  128. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +18 -0
  129. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_locked_gem_version/README.md +1 -0
  130. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
  131. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
  132. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_removed_gem/Gemfile.lock +41 -0
  133. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
  134. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
  135. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
  136. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
  137. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
  138. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_two_sources/Gemfile +6 -0
  139. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_two_sources/Gemfile.lock +42 -0
  140. data/repositories/bundler_2_2_17/update_with_gemfile_lock_with_two_sources/README.md +1 -0
  141. data/repositories/bundler_2_2_17/update_without_gemfile_lock/.diffend.yml +3 -0
  142. data/repositories/bundler_2_2_17/update_without_gemfile_lock/Gemfile +5 -0
  143. data/repositories/bundler_2_2_7/install_with_gemfile_lock/.diffend.yml +3 -0
  144. data/repositories/bundler_2_2_7/install_with_gemfile_lock/Gemfile +6 -0
  145. data/repositories/bundler_2_2_7/install_with_gemfile_lock/Gemfile.lock +21 -0
  146. data/repositories/bundler_2_2_7/install_with_gemfile_lock/README.md +1 -0
  147. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
  148. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/Gemfile +6 -0
  149. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
  150. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_added_gem/README.md +1 -0
  151. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/.diffend.yml +3 -0
  152. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
  153. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
  154. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
  155. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/.diffend.yml +3 -0
  156. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
  157. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +18 -0
  158. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_locked_gem_version/README.md +1 -0
  159. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
  160. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
  161. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/Gemfile.lock +41 -0
  162. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_removed_gem/README.md +1 -0
  163. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/.diffend.yml +3 -0
  164. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/Gemfile +10 -0
  165. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/Gemfile.lock +30 -0
  166. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/README.md +1 -0
  167. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_platforms/gem-with-two-platforms.gemspec +16 -0
  168. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
  169. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
  170. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
  171. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
  172. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
  173. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/Gemfile +6 -0
  174. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/Gemfile.lock +19 -0
  175. data/repositories/bundler_2_2_7/install_with_gemfile_lock_with_two_sources/README.md +1 -0
  176. data/repositories/bundler_2_2_7/install_without_gemfile_lock/.diffend.yml +3 -0
  177. data/repositories/bundler_2_2_7/install_without_gemfile_lock/Gemfile +5 -0
  178. data/repositories/bundler_2_2_7/install_without_gemfile_lock/README.md +1 -0
  179. data/repositories/bundler_2_2_7/update_with_gemfile_lock/.diffend.yml +3 -0
  180. data/repositories/bundler_2_2_7/update_with_gemfile_lock/Gemfile +5 -0
  181. data/repositories/bundler_2_2_7/update_with_gemfile_lock/Gemfile.lock +16 -0
  182. data/repositories/bundler_2_2_7/update_with_gemfile_lock/README.md +1 -0
  183. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/.diffend.yml +3 -0
  184. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/Gemfile +6 -0
  185. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/Gemfile.lock +16 -0
  186. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_added_gem/README.md +1 -0
  187. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_changed_gem_version/Gemfile +6 -0
  188. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_changed_gem_version/Gemfile.lock +18 -0
  189. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_changed_gem_version/README.md +1 -0
  190. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_locked_gem_version/Gemfile +6 -0
  191. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_locked_gem_version/Gemfile.lock +18 -0
  192. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_locked_gem_version/README.md +1 -0
  193. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_removed_gem/.diffend.yml +3 -0
  194. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_removed_gem/Gemfile +5 -0
  195. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_removed_gem/Gemfile.lock +41 -0
  196. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/.diffend.yml +3 -0
  197. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/Gemfile +6 -0
  198. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/Gemfile.lock +17 -0
  199. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_primary_sources/README.md +1 -0
  200. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/.diffend.yml +3 -0
  201. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/Gemfile +6 -0
  202. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/Gemfile.lock +42 -0
  203. data/repositories/bundler_2_2_7/update_with_gemfile_lock_with_two_sources/README.md +1 -0
  204. data/repositories/bundler_2_2_7/update_without_gemfile_lock/.diffend.yml +3 -0
  205. data/repositories/bundler_2_2_7/update_without_gemfile_lock/Gemfile +5 -0
  206. data/repositories/diffend.json +9 -0
  207. metadata +214 -31
  208. metadata.gz.sig +0 -0
  209. data/certs/tomaszpajor.pem +0 -25
@@ -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.build_install
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
@@ -63,37 +62,21 @@ module Diffend
63
62
  # Resolve definition
64
63
  def resolve
65
64
  @cached ? @definition.resolve_with_cache! : @definition.resolve_remotely!
66
- end
67
-
68
- # Build install specification
69
- #
70
- # @return [Hash]
71
- def build_install
72
- hash = build_main
73
-
74
- @definition.specs.each do |spec|
75
- next if skip?(spec.source)
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
65
 
87
- hash
66
+ # Despite bundler not materializing resolution, we always need to do so to get all the
67
+ # gems details
68
+ @definition.specs
88
69
  end
89
70
 
90
- # Build update specification
71
+ # Build specification
91
72
  #
92
73
  # @return [Hash]
93
- def build_update
74
+ def build
94
75
  hash = build_main
95
76
 
96
- @definition.specs.each do |spec|
77
+ @definition.resolve.each do |spec|
78
+ # Skip metadata
79
+ next if spec.instance_variable_get(:@specification).nil?
97
80
  next if skip?(spec.source)
98
81
 
99
82
  locked_spec = @locked_specs.find { |s| s.name == spec.name }
@@ -117,8 +100,8 @@ module Diffend
117
100
  def build_main
118
101
  {
119
102
  'dependencies' => {},
120
- 'sources' => build_sources,
121
103
  'plugins' => {},
104
+ 'sources' => build_sources,
122
105
  'platforms' => @definition.platforms.map(&:to_s)
123
106
  }
124
107
  end
@@ -30,6 +30,9 @@
30
30
  request_verdict
31
31
  execute
32
32
  track
33
+ shell
34
+ repository
35
+ integration_repository
33
36
  ].each { |file| require "diffend/#{file}" }
34
37
 
35
38
  module Diffend
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ %w[
4
+ tmpdir
5
+ securerandom
6
+ ].each(&method(:require))
7
+
8
+ module Diffend
9
+ # Repository for specs
10
+ class Repository
11
+ # Repositories path
12
+ REPOSITORIES_PATH = File.join(
13
+ File.expand_path('..', Bundler.bin_path),
14
+ 'repositories'
15
+ ).freeze
16
+ # List of supported repositories split by command
17
+ SUPPORTED = {
18
+ 'install' => %w[
19
+ with_gemfile_lock
20
+ with_gemfile_lock_with_added_gem
21
+ with_gemfile_lock_with_changed_gem_version
22
+ with_gemfile_lock_with_locked_gem_version
23
+ with_gemfile_lock_with_removed_gem
24
+ with_gemfile_lock_with_two_platforms
25
+ with_gemfile_lock_with_two_primary_sources
26
+ with_gemfile_lock_with_two_sources
27
+ without_gemfile_lock
28
+ ].freeze,
29
+ 'update' => %w[
30
+ with_gemfile_lock
31
+ with_gemfile_lock_with_added_gem
32
+ with_gemfile_lock_with_removed_gem
33
+ with_gemfile_lock_with_two_primary_sources
34
+ with_gemfile_lock_with_two_sources
35
+ without_gemfile_lock
36
+ ].freeze
37
+ }.freeze
38
+
39
+ attr_reader :name, :path
40
+
41
+ # @param command [String] command executed via bundler
42
+ # @param name [String] repository name
43
+ def initialize(command, name)
44
+ @command = command
45
+ @name = name
46
+ @path = File.join(Dir.tmpdir, SecureRandom.uuid)
47
+ end
48
+
49
+ # Build repository path
50
+ #
51
+ # @return [String]
52
+ def orig_path
53
+ @orig_path ||= global_file_path(
54
+ File.join(
55
+ bundler_version_string,
56
+ "#{@command}_#{name}"
57
+ )
58
+ )
59
+ end
60
+
61
+ # Setup an isolated instance of a repository
62
+ def setup
63
+ FileUtils.cp_r(orig_path, path)
64
+ end
65
+
66
+ # Clean isolated instance of a repository
67
+ def clean
68
+ FileUtils.rm_rf(path)
69
+ end
70
+
71
+ # Execute tasks in an isolated instance of a repository
72
+ def isolate
73
+ setup
74
+ yield(path)
75
+ clean
76
+ end
77
+
78
+ # Build the path to a specified file within the repository
79
+ #
80
+ # @param file_name [String]
81
+ #
82
+ # @return [String]
83
+ def file_path(file_name)
84
+ File.join(
85
+ path,
86
+ file_name
87
+ )
88
+ end
89
+
90
+ # Build global path
91
+ #
92
+ # @param file_name [String]
93
+ #
94
+ # @return [String]
95
+ def global_file_path(file_name)
96
+ File.join(
97
+ REPOSITORIES_PATH,
98
+ file_name
99
+ )
100
+ end
101
+
102
+ # Build bundler version string
103
+ #
104
+ # @return [String]
105
+ def bundler_version_string
106
+ @bundler_version_string ||= "bundler_#{Bundler::VERSION.tr('.', '_')}"
107
+ end
108
+ end
109
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Diffend
4
4
  # Class responsible for preparing diffend request object
5
- RequestObject = Struct.new(:config, :url, :payload, :request_method, keyword_init: true)
5
+ RequestObject = Struct.new(:config, :url, :payload, :request_method)
6
6
  end
@@ -42,10 +42,10 @@ module Diffend
42
42
  # @return [Diffend::RequestObject]
43
43
  def build_request_object(config, payload)
44
44
  Diffend::RequestObject.new(
45
- config: config,
46
- url: config.commands_url,
47
- payload: payload,
48
- request_method: :post
45
+ config,
46
+ config.commands_url,
47
+ payload,
48
+ :post
49
49
  )
50
50
  end
51
51
  end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open3'
4
+
5
+ # Helper commands for running Linux shell commands
6
+ module Diffend
7
+ module Shell
8
+ class << self
9
+ # Allows to execute shell commands and handle errors, etc later
10
+ # (won't raise any errors but instead will catch all things)
11
+ # @param command_with_options [String] command that should be executed with
12
+ # all the arguments and options
13
+ # @param raise_on_invalid_exit [Boolean] raise exception when exit code is not 0
14
+ # @return [Hash] hash with 3 keys describing output
15
+ # (stdout, stderr, exit_code)
16
+ # @example Run ls
17
+ # SupportEngine::Shell.('ls') =>
18
+ # { stdout: "test.rb\n", stderr: '', exit_code: 0}
19
+ def call(command_with_options, raise_on_invalid_exit: true)
20
+ stdout_str, stderr_str, status = Open3.capture3(command_with_options)
21
+
22
+ result = {
23
+ stdout: stdout_str,
24
+ stderr: stderr_str,
25
+ exit_code: status.exitstatus
26
+ }
27
+
28
+ raise Diffend::Errors::FailedShellCommand, result.values.join(': ') \
29
+ if raise_on_invalid_exit && result[:exit_code] != 0
30
+
31
+ result
32
+ end
33
+
34
+ # @param path [String, Pathname] to a place where git repo is
35
+ # @param command [String] that we want to execute in path context
36
+ # @param raise_on_invalid_exit [Boolean] raise exception when exit code is not 0
37
+ # @return [Hash] hash with 3 keys describing output (stdout, stderr, exit_code)
38
+ def call_in_path(path, command, raise_on_invalid_exit: true)
39
+ command = ['cd', path.to_s, '&&', command]
40
+ call(command.join(' '), raise_on_invalid_exit: raise_on_invalid_exit)
41
+ end
42
+ end
43
+ end
44
+ end
data/lib/diffend/track.rb CHANGED
@@ -62,10 +62,10 @@ module Diffend
62
62
  # @return [Diffend::RequestObject]
63
63
  def build_request_object(request_id)
64
64
  Diffend::RequestObject.new(
65
- config: @config,
66
- url: @config.track_url(request_id),
67
- payload: { id: request_id }.freeze,
68
- request_method: :put
65
+ @config,
66
+ @config.track_url(request_id),
67
+ { id: request_id }.freeze,
68
+ :put
69
69
  ).freeze
70
70
  end
71
71
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Diffend
4
4
  # Current version
5
- VERSION = '0.2.40'
5
+ VERSION = '0.2.45'
6
6
  end
@@ -0,0 +1,3 @@
1
+ project_id: '6f346200-b6d0-4456-93d6-93f6ea64629f'
2
+ shareable_id: 'a623a24f-c384-41ef-9b1f-020c902cee53'
3
+ shareable_key: 'fea22506-bf19-404e-b6cd-fb26ffb08b0c'
@@ -0,0 +1,3 @@
1
+ project_id: '6f346200-b6d0-4456-93d6-93f6ea64629f'
2
+ shareable_id: 'a623a24f-c384-41ef-9b1f-020c902cee53'
3
+ shareable_key: 'fea22506-bf19-404e-b6cd-fb26ffb08b0c'
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'dry-core'
6
+ gem 'nokogiri'
@@ -0,0 +1,22 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ concurrent-ruby (1.0.5)
5
+ concurrent-ruby (1.0.5-java)
6
+ dry-core (0.4.7)
7
+ concurrent-ruby (~> 1.0)
8
+ mini_portile2 (2.4.0)
9
+ nokogiri (1.10.10)
10
+ mini_portile2 (~> 2.4.0)
11
+ nokogiri (1.10.10-java)
12
+
13
+ PLATFORMS
14
+ java
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ dry-core
19
+ nokogiri
20
+
21
+ BUNDLED WITH
22
+ 2.1.4
@@ -0,0 +1,3 @@
1
+ project_id: '6f346200-b6d0-4456-93d6-93f6ea64629f'
2
+ shareable_id: 'a623a24f-c384-41ef-9b1f-020c902cee53'
3
+ shareable_key: 'fea22506-bf19-404e-b6cd-fb26ffb08b0c'
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'dry-core'
6
+ gem 'dry-struct'
@@ -0,0 +1,16 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ concurrent-ruby (1.1.6)
5
+ dry-core (0.4.9)
6
+ concurrent-ruby (~> 1.0)
7
+
8
+ PLATFORMS
9
+ java
10
+ ruby
11
+
12
+ DEPENDENCIES
13
+ dry-core
14
+
15
+ BUNDLED WITH
16
+ 2.1.4
@@ -0,0 +1,3 @@
1
+ project_id: '6f346200-b6d0-4456-93d6-93f6ea64629f'
2
+ shareable_id: 'a623a24f-c384-41ef-9b1f-020c902cee53'
3
+ shareable_key: 'fea22506-bf19-404e-b6cd-fb26ffb08b0c'
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'dry-core', '0.4.8'
6
+ gem 'dry-inflector'
@@ -0,0 +1,18 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ concurrent-ruby (1.0.5)
5
+ dry-core (0.4.7)
6
+ concurrent-ruby (~> 1.0)
7
+ dry-inflector (0.1.2)
8
+
9
+ PLATFORMS
10
+ java
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ dry-core (= 0.4.7)
15
+ dry-inflector
16
+
17
+ BUNDLED WITH
18
+ 2.1.4
@@ -0,0 +1 @@
1
+ Bundle on both latest `ruby` and `jruby`
@@ -0,0 +1,3 @@
1
+ project_id: '6f346200-b6d0-4456-93d6-93f6ea64629f'
2
+ shareable_id: 'a623a24f-c384-41ef-9b1f-020c902cee53'
3
+ shareable_key: 'fea22506-bf19-404e-b6cd-fb26ffb08b0c'
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'dry-core', '0.4.7'
6
+ gem 'dry-inflector'
@@ -0,0 +1,19 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ concurrent-ruby (1.0.5)
5
+ concurrent-ruby (1.0.5-java)
6
+ dry-core (0.4.7)
7
+ concurrent-ruby (~> 1.0)
8
+ dry-inflector (0.1.2)
9
+
10
+ PLATFORMS
11
+ java
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ dry-core (= 0.4.7)
16
+ dry-inflector
17
+
18
+ BUNDLED WITH
19
+ 2.1.4
@@ -0,0 +1,3 @@
1
+ project_id: '6f346200-b6d0-4456-93d6-93f6ea64629f'
2
+ shareable_id: 'a623a24f-c384-41ef-9b1f-020c902cee53'
3
+ shareable_key: 'fea22506-bf19-404e-b6cd-fb26ffb08b0c'
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'dry-core'
@@ -0,0 +1,43 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ concurrent-ruby (1.1.6)
5
+ dry-configurable (0.11.5)
6
+ concurrent-ruby (~> 1.0)
7
+ dry-core (~> 0.4, >= 0.4.7)
8
+ dry-equalizer (~> 0.2)
9
+ dry-container (0.7.2)
10
+ concurrent-ruby (~> 1.0)
11
+ dry-configurable (~> 0.1, >= 0.1.3)
12
+ dry-core (0.4.9)
13
+ concurrent-ruby (~> 1.0)
14
+ dry-equalizer (0.3.0)
15
+ dry-inflector (0.2.0)
16
+ dry-logic (1.0.6)
17
+ concurrent-ruby (~> 1.0)
18
+ dry-core (~> 0.2)
19
+ dry-equalizer (~> 0.2)
20
+ dry-struct (1.3.0)
21
+ dry-core (~> 0.4, >= 0.4.4)
22
+ dry-equalizer (~> 0.3)
23
+ dry-types (~> 1.3)
24
+ ice_nine (~> 0.11)
25
+ dry-types (1.4.0)
26
+ concurrent-ruby (~> 1.0)
27
+ dry-container (~> 0.3)
28
+ dry-core (~> 0.4, >= 0.4.4)
29
+ dry-equalizer (~> 0.3)
30
+ dry-inflector (~> 0.1, >= 0.1.2)
31
+ dry-logic (~> 1.0, >= 1.0.2)
32
+ ice_nine (0.11.2)
33
+
34
+ PLATFORMS
35
+ java
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ dry-core
40
+ dry-struct
41
+
42
+ BUNDLED WITH
43
+ 2.1.4