cloudsmith-api 0.51.34 → 0.52.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (395) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +14 -5
  4. data/build.json +1 -1
  5. data/docs/AlpinePackageUpload.md +63 -0
  6. data/docs/ConanPackageUpload.md +1 -0
  7. data/docs/EntitlementsCreate.md +1 -1
  8. data/docs/EntitlementsPartialUpdate.md +1 -1
  9. data/docs/EntitlementsRefresh.md +1 -1
  10. data/docs/MavenPackageUpload.md +1 -0
  11. data/docs/Package.md +2 -0
  12. data/docs/PackageCopy.md +2 -0
  13. data/docs/PackageMove.md +2 -0
  14. data/docs/PackagesApi.md +238 -39
  15. data/docs/PackagesCopy.md +1 -1
  16. data/docs/PackagesMove.md +0 -1
  17. data/docs/PackagesTag.md +10 -0
  18. data/docs/PackagesUploadAlpine.md +1 -0
  19. data/docs/PackagesUploadCargo.md +1 -0
  20. data/docs/PackagesUploadCocoapods.md +1 -0
  21. data/docs/PackagesUploadComposer.md +1 -0
  22. data/docs/PackagesUploadConan.md +3 -0
  23. data/docs/PackagesUploadCran.md +1 -0
  24. data/docs/PackagesUploadDart.md +1 -0
  25. data/docs/PackagesUploadDeb.md +3 -0
  26. data/docs/PackagesUploadDocker.md +1 -0
  27. data/docs/PackagesUploadGo.md +1 -0
  28. data/docs/PackagesUploadHelm.md +1 -0
  29. data/docs/PackagesUploadLuarocks.md +1 -0
  30. data/docs/PackagesUploadMaven.md +1 -0
  31. data/docs/PackagesUploadNpm.md +1 -0
  32. data/docs/PackagesUploadNuget.md +1 -0
  33. data/docs/PackagesUploadPython.md +1 -0
  34. data/docs/PackagesUploadRaw.md +1 -0
  35. data/docs/PackagesUploadRpm.md +1 -0
  36. data/docs/PackagesUploadRuby.md +1 -0
  37. data/docs/{PackagesResync.md → PackagesUploadTerraform.md} +3 -1
  38. data/docs/PackagesUploadVagrant.md +1 -0
  39. data/docs/PackagesValidateuploadAlpine.md +1 -0
  40. data/docs/PackagesValidateuploadCargo.md +1 -0
  41. data/docs/PackagesValidateuploadCocoapods.md +1 -0
  42. data/docs/PackagesValidateuploadComposer.md +1 -0
  43. data/docs/PackagesValidateuploadConan.md +3 -0
  44. data/docs/PackagesValidateuploadCran.md +1 -0
  45. data/docs/PackagesValidateuploadDart.md +1 -0
  46. data/docs/PackagesValidateuploadDeb.md +3 -0
  47. data/docs/PackagesValidateuploadDocker.md +1 -0
  48. data/docs/PackagesValidateuploadGo.md +1 -0
  49. data/docs/PackagesValidateuploadHelm.md +1 -0
  50. data/docs/PackagesValidateuploadLuarocks.md +1 -0
  51. data/docs/PackagesValidateuploadMaven.md +1 -0
  52. data/docs/PackagesValidateuploadNpm.md +1 -0
  53. data/docs/PackagesValidateuploadNuget.md +1 -0
  54. data/docs/PackagesValidateuploadPython.md +1 -0
  55. data/docs/PackagesValidateuploadRaw.md +1 -0
  56. data/docs/PackagesValidateuploadRpm.md +1 -0
  57. data/docs/PackagesValidateuploadRuby.md +1 -0
  58. data/docs/PackagesValidateuploadTerraform.md +10 -0
  59. data/docs/PackagesValidateuploadVagrant.md +1 -0
  60. data/docs/RawPackageUpload.md +1 -0
  61. data/docs/ReposCreate.md +4 -7
  62. data/docs/ReposPartialUpdate.md +3 -7
  63. data/docs/Repository.md +11 -10
  64. data/docs/RepositoryToken.md +3 -3
  65. data/docs/RepositoryTokenRefresh.md +3 -3
  66. data/docs/RepositoryTokenSyncTokens.md +3 -3
  67. data/docs/RepositoryWebhook.md +1 -0
  68. data/docs/StorageRegion.md +9 -0
  69. data/docs/StorageregionsApi.md +122 -0
  70. data/docs/VagrantPackageUpload.md +1 -0
  71. data/docs/WebhooksCreate.md +1 -0
  72. data/docs/WebhooksPartialUpdate.md +1 -0
  73. data/lib/cloudsmith-api.rb +6 -1
  74. data/lib/cloudsmith-api/api/packages_api.rb +237 -53
  75. data/lib/cloudsmith-api/api/storageregions_api.rb +119 -0
  76. data/lib/cloudsmith-api/models/alpine_package_upload.rb +743 -0
  77. data/lib/cloudsmith-api/models/conan_package_upload.rb +11 -1
  78. data/lib/cloudsmith-api/models/entitlements_create.rb +1 -1
  79. data/lib/cloudsmith-api/models/entitlements_partial_update.rb +1 -1
  80. data/lib/cloudsmith-api/models/entitlements_refresh.rb +1 -1
  81. data/lib/cloudsmith-api/models/maven_package_upload.rb +11 -1
  82. data/lib/cloudsmith-api/models/package.rb +21 -1
  83. data/lib/cloudsmith-api/models/package_copy.rb +21 -1
  84. data/lib/cloudsmith-api/models/package_move.rb +21 -1
  85. data/lib/cloudsmith-api/models/packages_copy.rb +1 -1
  86. data/lib/cloudsmith-api/models/packages_move.rb +4 -14
  87. data/lib/cloudsmith-api/models/packages_tag.rb +211 -0
  88. data/lib/cloudsmith-api/models/packages_upload_alpine.rb +14 -4
  89. data/lib/cloudsmith-api/models/packages_upload_cargo.rb +14 -4
  90. data/lib/cloudsmith-api/models/packages_upload_cocoapods.rb +14 -4
  91. data/lib/cloudsmith-api/models/packages_upload_composer.rb +14 -4
  92. data/lib/cloudsmith-api/models/packages_upload_conan.rb +34 -4
  93. data/lib/cloudsmith-api/models/packages_upload_cran.rb +14 -4
  94. data/lib/cloudsmith-api/models/packages_upload_dart.rb +14 -4
  95. data/lib/cloudsmith-api/models/packages_upload_deb.rb +34 -4
  96. data/lib/cloudsmith-api/models/packages_upload_docker.rb +14 -4
  97. data/lib/cloudsmith-api/models/packages_upload_go.rb +14 -4
  98. data/lib/cloudsmith-api/models/packages_upload_helm.rb +14 -4
  99. data/lib/cloudsmith-api/models/packages_upload_luarocks.rb +14 -4
  100. data/lib/cloudsmith-api/models/packages_upload_maven.rb +11 -1
  101. data/lib/cloudsmith-api/models/packages_upload_npm.rb +14 -4
  102. data/lib/cloudsmith-api/models/packages_upload_nuget.rb +14 -4
  103. data/lib/cloudsmith-api/models/packages_upload_python.rb +14 -4
  104. data/lib/cloudsmith-api/models/packages_upload_raw.rb +11 -1
  105. data/lib/cloudsmith-api/models/packages_upload_rpm.rb +14 -4
  106. data/lib/cloudsmith-api/models/packages_upload_ruby.rb +14 -4
  107. data/lib/cloudsmith-api/models/packages_upload_terraform.rb +214 -0
  108. data/lib/cloudsmith-api/models/packages_upload_vagrant.rb +11 -1
  109. data/lib/cloudsmith-api/models/packages_validateupload_alpine.rb +14 -4
  110. data/lib/cloudsmith-api/models/packages_validateupload_cargo.rb +14 -4
  111. data/lib/cloudsmith-api/models/packages_validateupload_cocoapods.rb +14 -4
  112. data/lib/cloudsmith-api/models/packages_validateupload_composer.rb +14 -4
  113. data/lib/cloudsmith-api/models/packages_validateupload_conan.rb +34 -4
  114. data/lib/cloudsmith-api/models/packages_validateupload_cran.rb +14 -4
  115. data/lib/cloudsmith-api/models/packages_validateupload_dart.rb +14 -4
  116. data/lib/cloudsmith-api/models/packages_validateupload_deb.rb +34 -4
  117. data/lib/cloudsmith-api/models/packages_validateupload_docker.rb +14 -4
  118. data/lib/cloudsmith-api/models/packages_validateupload_go.rb +14 -4
  119. data/lib/cloudsmith-api/models/packages_validateupload_helm.rb +14 -4
  120. data/lib/cloudsmith-api/models/packages_validateupload_luarocks.rb +14 -4
  121. data/lib/cloudsmith-api/models/packages_validateupload_maven.rb +11 -1
  122. data/lib/cloudsmith-api/models/packages_validateupload_npm.rb +14 -4
  123. data/lib/cloudsmith-api/models/packages_validateupload_nuget.rb +14 -4
  124. data/lib/cloudsmith-api/models/packages_validateupload_python.rb +14 -4
  125. data/lib/cloudsmith-api/models/packages_validateupload_raw.rb +11 -1
  126. data/lib/cloudsmith-api/models/packages_validateupload_rpm.rb +14 -4
  127. data/lib/cloudsmith-api/models/packages_validateupload_ruby.rb +14 -4
  128. data/lib/cloudsmith-api/models/packages_validateupload_terraform.rb +214 -0
  129. data/lib/cloudsmith-api/models/packages_validateupload_vagrant.rb +11 -1
  130. data/lib/cloudsmith-api/models/raw_package_upload.rb +11 -1
  131. data/lib/cloudsmith-api/models/repos_create.rb +17 -57
  132. data/lib/cloudsmith-api/models/repos_partial_update.rb +4 -44
  133. data/lib/cloudsmith-api/models/repository.rb +24 -24
  134. data/lib/cloudsmith-api/models/repository_token.rb +3 -3
  135. data/lib/cloudsmith-api/models/repository_token_refresh.rb +3 -3
  136. data/lib/cloudsmith-api/models/repository_token_sync_tokens.rb +3 -3
  137. data/lib/cloudsmith-api/models/repository_webhook.rb +11 -1
  138. data/lib/cloudsmith-api/models/{packages_resync.rb → storage_region.rb} +29 -9
  139. data/lib/cloudsmith-api/models/vagrant_package_upload.rb +11 -1
  140. data/lib/cloudsmith-api/models/webhooks_create.rb +11 -1
  141. data/lib/cloudsmith-api/models/webhooks_partial_update.rb +11 -1
  142. data/lib/cloudsmith-api/version.rb +1 -1
  143. data/spec/api/packages_api_spec.rb +59 -17
  144. data/spec/api/storageregions_api_spec.rb +58 -0
  145. data/spec/models/alpine_package_upload_spec.rb +372 -0
  146. data/spec/models/conan_package_upload_spec.rb +6 -0
  147. data/spec/models/maven_package_upload_spec.rb +6 -0
  148. data/spec/models/package_copy_spec.rb +12 -0
  149. data/spec/models/package_move_spec.rb +12 -0
  150. data/spec/models/package_spec.rb +12 -0
  151. data/spec/models/packages_move_spec.rb +0 -6
  152. data/spec/models/packages_tag_spec.rb +54 -0
  153. data/spec/models/packages_upload_alpine_spec.rb +6 -0
  154. data/spec/models/packages_upload_cargo_spec.rb +6 -0
  155. data/spec/models/packages_upload_cocoapods_spec.rb +6 -0
  156. data/spec/models/packages_upload_composer_spec.rb +6 -0
  157. data/spec/models/packages_upload_conan_spec.rb +18 -0
  158. data/spec/models/packages_upload_cran_spec.rb +6 -0
  159. data/spec/models/packages_upload_dart_spec.rb +6 -0
  160. data/spec/models/packages_upload_deb_spec.rb +18 -0
  161. data/spec/models/packages_upload_docker_spec.rb +6 -0
  162. data/spec/models/packages_upload_go_spec.rb +6 -0
  163. data/spec/models/packages_upload_helm_spec.rb +6 -0
  164. data/spec/models/packages_upload_luarocks_spec.rb +6 -0
  165. data/spec/models/packages_upload_maven_spec.rb +6 -0
  166. data/spec/models/packages_upload_npm_spec.rb +6 -0
  167. data/spec/models/packages_upload_nuget_spec.rb +6 -0
  168. data/spec/models/packages_upload_python_spec.rb +6 -0
  169. data/spec/models/packages_upload_raw_spec.rb +6 -0
  170. data/spec/models/packages_upload_rpm_spec.rb +6 -0
  171. data/spec/models/packages_upload_ruby_spec.rb +6 -0
  172. data/spec/models/packages_upload_terraform_spec.rb +54 -0
  173. data/spec/models/packages_upload_vagrant_spec.rb +6 -0
  174. data/spec/models/packages_validateupload_alpine_spec.rb +6 -0
  175. data/spec/models/packages_validateupload_cargo_spec.rb +6 -0
  176. data/spec/models/packages_validateupload_cocoapods_spec.rb +6 -0
  177. data/spec/models/packages_validateupload_composer_spec.rb +6 -0
  178. data/spec/models/packages_validateupload_conan_spec.rb +18 -0
  179. data/spec/models/packages_validateupload_cran_spec.rb +6 -0
  180. data/spec/models/packages_validateupload_dart_spec.rb +6 -0
  181. data/spec/models/packages_validateupload_deb_spec.rb +18 -0
  182. data/spec/models/packages_validateupload_docker_spec.rb +6 -0
  183. data/spec/models/packages_validateupload_go_spec.rb +6 -0
  184. data/spec/models/packages_validateupload_helm_spec.rb +6 -0
  185. data/spec/models/packages_validateupload_luarocks_spec.rb +6 -0
  186. data/spec/models/packages_validateupload_maven_spec.rb +6 -0
  187. data/spec/models/packages_validateupload_npm_spec.rb +6 -0
  188. data/spec/models/packages_validateupload_nuget_spec.rb +6 -0
  189. data/spec/models/packages_validateupload_python_spec.rb +6 -0
  190. data/spec/models/packages_validateupload_raw_spec.rb +6 -0
  191. data/spec/models/packages_validateupload_rpm_spec.rb +6 -0
  192. data/spec/models/packages_validateupload_ruby_spec.rb +6 -0
  193. data/spec/models/packages_validateupload_terraform_spec.rb +54 -0
  194. data/spec/models/packages_validateupload_vagrant_spec.rb +6 -0
  195. data/spec/models/raw_package_upload_spec.rb +6 -0
  196. data/spec/models/repos_create_spec.rb +3 -21
  197. data/spec/models/repos_partial_update_spec.rb +0 -24
  198. data/spec/models/repository_spec.rb +6 -0
  199. data/spec/models/repository_webhook_spec.rb +6 -0
  200. data/spec/models/{packages_resync_spec.rb → storage_region_spec.rb} +13 -7
  201. data/spec/models/vagrant_package_upload_spec.rb +6 -0
  202. data/spec/models/webhooks_create_spec.rb +6 -0
  203. data/spec/models/webhooks_partial_update_spec.rb +6 -0
  204. data/vendor/bundle/ruby/2.6.0/cache/diff-lcs-1.4.4.gem +0 -0
  205. data/vendor/bundle/ruby/2.6.0/cache/json-2.3.1.gem +0 -0
  206. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/autotest-fsevent-0.2.17/gem_make.out +1 -1
  207. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/ffi-1.13.1/gem_make.out +2 -2
  208. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/{json-2.3.0 → json-2.3.1}/gem.build_complete +0 -0
  209. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/{json-2.3.0 → json-2.3.1}/gem_make.out +5 -5
  210. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.3.1/json/ext/generator.so +0 -0
  211. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.3.1/json/ext/parser.so +0 -0
  212. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/{json-2.3.0 → json-2.3.1}/mkmf.log +0 -0
  213. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/.rspec +0 -0
  214. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/Code-of-Conduct.md +0 -0
  215. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/Contributing.md +118 -0
  216. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/History.md +319 -0
  217. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/License.md +0 -0
  218. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/Manifest.txt +8 -0
  219. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/README.rdoc +10 -10
  220. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/Rakefile +39 -22
  221. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/autotest/discover.rb +3 -0
  222. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/bin/htmldiff +7 -4
  223. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/bin/ldiff +4 -1
  224. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/docs/COPYING.txt +0 -0
  225. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/docs/artistic.txt +0 -0
  226. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/lib/diff-lcs.rb +3 -0
  227. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs.rb +184 -170
  228. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/array.rb +1 -1
  229. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/lib/diff/lcs/backports.rb +9 -0
  230. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/block.rb +1 -1
  231. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/callbacks.rb +15 -12
  232. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/change.rb +30 -37
  233. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/htmldiff.rb +17 -16
  234. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/hunk.rb +156 -74
  235. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/internals.rb +36 -39
  236. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/ldiff.rb +46 -42
  237. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/lib/diff/lcs/string.rb +1 -1
  238. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/change_spec.rb +31 -7
  239. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3/spec/ldiff_spec.rb → diff-lcs-1.4.4/spec/diff_spec.rb} +15 -11
  240. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/aX +1 -0
  241. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/bXaX +1 -0
  242. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/fixtures/ds1.csv +0 -0
  243. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/fixtures/ds2.csv +0 -0
  244. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff +4 -0
  245. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-c +7 -0
  246. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-e +3 -0
  247. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-f +3 -0
  248. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/fixtures/ldiff/output.diff-u +5 -0
  249. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/hunk_spec.rb +83 -0
  250. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/issues_spec.rb +154 -0
  251. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/lcs_spec.rb +10 -10
  252. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/ldiff_spec.rb +87 -0
  253. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/patch_spec.rb +93 -99
  254. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/sdiff_spec.rb +214 -0
  255. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/spec_helper.rb +118 -64
  256. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.4.4/spec/traverse_balanced_spec.rb +310 -0
  257. data/vendor/bundle/ruby/2.6.0/gems/{diff-lcs-1.3 → diff-lcs-1.4.4}/spec/traverse_sequences_spec.rb +28 -28
  258. data/vendor/bundle/ruby/2.6.0/gems/ffi-1.13.1/ext/ffi_c/Makefile +3 -3
  259. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/.gitignore +0 -0
  260. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/.travis.yml +2 -0
  261. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/CHANGES.md +33 -0
  262. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/Gemfile +0 -0
  263. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/README-json-jruby.md +0 -0
  264. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/README.md +16 -0
  265. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/Rakefile +8 -87
  266. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/VERSION +1 -0
  267. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/diagrams/.keep +0 -0
  268. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/fbuffer/fbuffer.h +0 -0
  269. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/generator/.sitearchdir.-.json.-.ext.time +0 -0
  270. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/generator/depend +0 -0
  271. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/generator/extconf.rb +0 -0
  272. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/generator/generator.c +71 -1
  273. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/generator/generator.h +0 -0
  274. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/ext/json/ext/generator/generator.so +0 -0
  275. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/.sitearchdir.-.json.-.ext.time +0 -0
  276. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/depend +0 -0
  277. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/extconf.rb +0 -0
  278. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/parser.c +71 -70
  279. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/parser.h +0 -0
  280. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/ext/parser/parser.rl +1 -0
  281. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/ext/json/ext/parser/parser.so +0 -0
  282. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/ext/json/extconf.rb +0 -0
  283. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/install.rb +0 -0
  284. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/ByteListTranscoder.java +0 -0
  285. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/Generator.java +0 -0
  286. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/GeneratorMethods.java +0 -0
  287. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/GeneratorService.java +0 -0
  288. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/GeneratorState.java +0 -0
  289. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/OptionsReader.java +0 -0
  290. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/Parser.java +0 -0
  291. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/Parser.rl +0 -0
  292. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/ParserService.java +0 -0
  293. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/RuntimeInfo.java +0 -0
  294. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/StringDecoder.java +0 -0
  295. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/StringEncoder.java +0 -0
  296. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/java/src/json/ext/Utils.java +0 -0
  297. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/json-java.gemspec +3 -3
  298. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/json.gemspec +139 -0
  299. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/json_pure.gemspec +8 -13
  300. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/lib/json.rb +412 -0
  301. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/bigdecimal.rb +0 -0
  302. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/complex.rb +0 -0
  303. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/core.rb +0 -0
  304. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/date.rb +0 -0
  305. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/date_time.rb +0 -0
  306. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/exception.rb +0 -0
  307. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/ostruct.rb +0 -0
  308. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/range.rb +0 -0
  309. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/rational.rb +0 -0
  310. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/regexp.rb +0 -0
  311. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/set.rb +0 -0
  312. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/struct.rb +0 -0
  313. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/symbol.rb +0 -0
  314. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/add/time.rb +0 -0
  315. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/lib/json/common.rb +691 -0
  316. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/ext.rb +0 -0
  317. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/ext/.keep +0 -0
  318. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/lib/json/ext/generator.so +0 -0
  319. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.1/lib/json/ext/parser.so +0 -0
  320. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/generic_object.rb +0 -0
  321. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/pure.rb +0 -0
  322. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/pure/generator.rb +1 -1
  323. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/pure/parser.rb +2 -2
  324. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/lib/json/version.rb +1 -1
  325. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/references/rfc7159.txt +0 -0
  326. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail10.json +0 -0
  327. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail11.json +0 -0
  328. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail12.json +0 -0
  329. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail13.json +0 -0
  330. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail14.json +0 -0
  331. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail18.json +0 -0
  332. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail19.json +0 -0
  333. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail2.json +0 -0
  334. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail20.json +0 -0
  335. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail21.json +0 -0
  336. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail22.json +0 -0
  337. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail23.json +0 -0
  338. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail24.json +0 -0
  339. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail25.json +0 -0
  340. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail27.json +0 -0
  341. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail28.json +0 -0
  342. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail3.json +0 -0
  343. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail4.json +0 -0
  344. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail5.json +0 -0
  345. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail6.json +0 -0
  346. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail7.json +0 -0
  347. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail8.json +0 -0
  348. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/fail9.json +0 -0
  349. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/obsolete_fail1.json +0 -0
  350. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass1.json +0 -0
  351. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass15.json +0 -0
  352. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass16.json +0 -0
  353. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass17.json +0 -0
  354. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass2.json +0 -0
  355. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass26.json +0 -0
  356. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/fixtures/pass3.json +0 -0
  357. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_addition_test.rb +0 -0
  358. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_common_interface_test.rb +0 -0
  359. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_encoding_test.rb +0 -0
  360. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_ext_parser_test.rb +0 -0
  361. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_fixtures_test.rb +6 -1
  362. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_generator_test.rb +0 -0
  363. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_generic_object_test.rb +0 -0
  364. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_parser_test.rb +0 -0
  365. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/json_string_matching_test.rb +0 -0
  366. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tests/test_helper.rb +0 -0
  367. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tools/diff.sh +0 -0
  368. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tools/fuzz.rb +0 -0
  369. data/vendor/bundle/ruby/2.6.0/gems/{json-2.3.0 → json-2.3.1}/tools/server.rb +0 -0
  370. data/vendor/bundle/ruby/2.6.0/specifications/{diff-lcs-1.3.gemspec → diff-lcs-1.4.4.gemspec} +11 -13
  371. data/vendor/bundle/ruby/2.6.0/specifications/{json-2.3.0.gemspec → json-2.3.1.gemspec} +0 -0
  372. data/vendor/bundle/ruby/2.6.0/specifications/sys-uname-1.2.1.gemspec +1 -1
  373. metadata +276 -249
  374. data/vendor/bundle/ruby/2.6.0/cache/diff-lcs-1.3.gem +0 -0
  375. data/vendor/bundle/ruby/2.6.0/cache/json-2.3.0.gem +0 -0
  376. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.3.0/json/ext/generator.so +0 -0
  377. data/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/json-2.3.0/json/ext/parser.so +0 -0
  378. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/Contributing.md +0 -83
  379. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/History.md +0 -220
  380. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/autotest/discover.rb +0 -1
  381. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/lib/diff-lcs.rb +0 -3
  382. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/spec/diff_spec.rb +0 -47
  383. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/spec/hunk_spec.rb +0 -72
  384. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/spec/issues_spec.rb +0 -49
  385. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/spec/sdiff_spec.rb +0 -214
  386. data/vendor/bundle/ruby/2.6.0/gems/diff-lcs-1.3/spec/traverse_balanced_spec.rb +0 -310
  387. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/LICENSE +0 -56
  388. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/VERSION +0 -1
  389. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/ext/json/ext/generator/generator.so +0 -0
  390. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/ext/json/ext/parser/parser.so +0 -0
  391. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/json.gemspec +0 -0
  392. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/lib/json.rb +0 -63
  393. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/lib/json/common.rb +0 -456
  394. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/lib/json/ext/generator.so +0 -0
  395. data/vendor/bundle/ruby/2.6.0/gems/json-2.3.0/lib/json/ext/parser.so +0 -0
@@ -14,6 +14,7 @@ docs/artistic.txt
14
14
  lib/diff-lcs.rb
15
15
  lib/diff/lcs.rb
16
16
  lib/diff/lcs/array.rb
17
+ lib/diff/lcs/backports.rb
17
18
  lib/diff/lcs/block.rb
18
19
  lib/diff/lcs/callbacks.rb
19
20
  lib/diff/lcs/change.rb
@@ -24,8 +25,15 @@ lib/diff/lcs/ldiff.rb
24
25
  lib/diff/lcs/string.rb
25
26
  spec/change_spec.rb
26
27
  spec/diff_spec.rb
28
+ spec/fixtures/aX
29
+ spec/fixtures/bXaX
27
30
  spec/fixtures/ds1.csv
28
31
  spec/fixtures/ds2.csv
32
+ spec/fixtures/ldiff/output.diff
33
+ spec/fixtures/ldiff/output.diff-c
34
+ spec/fixtures/ldiff/output.diff-e
35
+ spec/fixtures/ldiff/output.diff-f
36
+ spec/fixtures/ldiff/output.diff-u
29
37
  spec/hunk_spec.rb
30
38
  spec/issues_spec.rb
31
39
  spec/lcs_spec.rb
@@ -4,8 +4,7 @@ home :: https://github.com/halostatue/diff-lcs
4
4
  code :: https://github.com/halostatue/diff-lcs
5
5
  bugs :: https://github.com/halostatue/diff-lcs/issues
6
6
  rdoc :: http://rubydoc.info/github/halostatue/diff-lcs
7
- continuous integration :: {<img src="https://travis-ci.org/halostatue/diff-lcs.svg" />}[https://travis-ci.org/halostatue/diff-lcs]
8
- test coverage :: {<img src="https://coveralls.io/repos/halostatue/diff-lcs/badge.svg" alt="Coverage Status" />}[https://coveralls.io/r/halostatue/diff-lcs]
7
+ continuous integration :: {<img src="https://github.com/halostatue/diff-lcs/workflows/CI/badge.svg" />}[https://github.com/halostatue/diff-lcs/actions]
9
8
 
10
9
  == Description
11
10
 
@@ -13,10 +12,15 @@ Diff::LCS computes the difference between two Enumerable sequences using the
13
12
  McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
14
13
  to create a simple HTML diff output format and a standard diff-like tool.
15
14
 
16
- This is release 1.3, providing a tentative fix to a long-standing issue related
17
- to incorrect detection of a patch direction. Also modernizes the gem
18
- infrastructure, testing infrastructure, and provides a warning-free experience
19
- to Ruby 2.4 users.
15
+ This is release 1.4.3, providing a simple extension that allows for
16
+ Diff::LCS::Change objects to be treated implicitly as arrays and fixes a
17
+ number of formatting issues.
18
+
19
+ Ruby versions below 2.5 are soft-deprecated, which means that older versions
20
+ are no longer part of the CI test suite. If any changes have been introduced
21
+ that break those versions, bug reports and patches will be accepted, but it
22
+ will be up to the reporter to verify any fixes prior to release. The next
23
+ major release will completely break compatibility.
20
24
 
21
25
  == Synopsis
22
26
 
@@ -78,7 +82,3 @@ The algorithm is described in A Fast Algorithm for Computing Longest Common
78
82
  Subsequences</em>, CACM, vol.20, no.5, pp.350-353, May 1977, with a few minor
79
83
  improvements to improve the speed. A simplified description of the algorithm,
80
84
  originally written for the Perl version, was written by Mark-Jason Dominus.
81
-
82
- :include: Contributing.rdoc
83
-
84
- :include: License.rdoc
@@ -1,4 +1,4 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'rubygems'
4
4
  require 'rspec'
@@ -6,52 +6,69 @@ require 'hoe'
6
6
 
7
7
  Hoe.plugin :bundler
8
8
  Hoe.plugin :doofus
9
- Hoe.plugin :email unless ENV['CI'] or ENV['TRAVIS']
10
9
  Hoe.plugin :gemspec2
11
10
  Hoe.plugin :git
12
- Hoe.plugin :travis
13
11
 
14
- spec = Hoe.spec 'diff-lcs' do
12
+ if RUBY_VERSION < '1.9'
13
+ class Array #:nodoc:
14
+ def to_h
15
+ Hash[*flatten(1)]
16
+ end
17
+ end
18
+
19
+ class Gem::Specification #:nodoc:
20
+ def metadata=(*); end
21
+
22
+ def default_value(*); end
23
+ end
24
+
25
+ class Object #:nodoc:
26
+ def caller_locations(*)
27
+ []
28
+ end
29
+ end
30
+ end
31
+
32
+ _spec = Hoe.spec 'diff-lcs' do
15
33
  developer('Austin Ziegler', 'halostatue@gmail.com')
16
34
 
17
35
  require_ruby_version '>= 1.8'
18
36
 
19
37
  self.history_file = 'History.md'
20
38
  self.readme_file = 'README.rdoc'
21
- self.licenses = [ 'MIT', 'Artistic-2.0', 'GPL-2.0+' ]
39
+ self.licenses = ['MIT', 'Artistic-2.0', 'GPL-2.0+']
22
40
 
23
41
  extra_dev_deps << ['hoe-doofus', '~> 1.0']
24
42
  extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
25
43
  extra_dev_deps << ['hoe-git', '~> 1.6']
26
44
  extra_dev_deps << ['hoe-rubygems', '~> 1.0']
27
- extra_dev_deps << ['hoe-travis', '~> 1.2']
28
45
  extra_dev_deps << ['rspec', '>= 2.0', '< 4']
29
- extra_dev_deps << ['rake', '>= 10.0', '< 12']
46
+ extra_dev_deps << ['rake', '>= 10.0', '< 14']
30
47
  extra_dev_deps << ['rdoc', '>= 0']
31
48
  end
32
49
 
33
- unless Rake::Task.task_defined? :test
34
- task :test => :spec
35
- Rake::Task['travis'].prerequisites.replace(%w(spec))
36
- end
37
-
38
50
  if RUBY_VERSION >= '2.0' && RUBY_ENGINE == 'ruby'
39
51
  namespace :spec do
40
- task :coveralls do
41
- if ENV['CI'] or ENV['TRAVIS']
42
- ENV['COVERALLS'] = 'yes'
43
- Rake::Task['spec'].execute
44
- else
45
- Rake::Task['spec:coverage'].execute
46
- end
47
- end
48
-
49
52
  desc "Runs test coverage. Only works Ruby 2.0+ and assumes 'simplecov' is installed."
50
53
  task :coverage do
51
54
  ENV['COVERAGE'] = 'yes'
52
55
  Rake::Task['spec'].execute
53
56
  end
54
57
  end
58
+ end
59
+
60
+ task :ruby18 do
61
+ puts <<-MESSAGE
62
+ You are starting a barebones Ruby 1.8 docker environment. You will need to
63
+ do the following:
64
+
65
+ - mv Gemfile.lock{,.v2}
66
+ - gem install bundler --version 1.17.2 --no-ri --no-rdoc
67
+ - ruby -S bundle
68
+ - rake
69
+
70
+ Don't forget to restore your Gemfile.lock after testing.
55
71
 
56
- # Rake::Task['travis'].prerequisites.replace(%w(spec:coveralls))
72
+ MESSAGE
73
+ sh "docker run -it --rm -v #{Dir.pwd}:/root/diff-lcs bellbind/docker-ruby18-rails2 bash -l"
57
74
  end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ Autotest.add_discovery { 'rspec2' }
@@ -1,4 +1,5 @@
1
- #!ruby -w
1
+ #! /usr/bin/env ruby -w
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'diff/lcs'
4
5
  require 'diff/lcs/htmldiff'
@@ -10,8 +11,8 @@ rescue LoadError
10
11
  end
11
12
 
12
13
  if ARGV.size < 2 or ARGV.size > 3
13
- $stderr.puts "usage: #{File.basename($0)} old new [output.html]"
14
- $stderr.puts " #{File.basename($0)} old new > output.html"
14
+ warn "usage: #{File.basename($0)} old new [output.html]"
15
+ warn " #{File.basename($0)} old new > output.html"
15
16
  exit 127
16
17
  end
17
18
 
@@ -23,10 +24,12 @@ options = { :title => "diff #{ARGV[0]} #{ARGV[1]}" }
23
24
  htmldiff = Diff::LCS::HTMLDiff.new(left, right, options)
24
25
 
25
26
  if ARGV[2]
26
- File.open(ARGV[2], "w") do |f|
27
+ File.open(ARGV[2], 'w') do |f|
27
28
  htmldiff.options[:output] = f
28
29
  htmldiff.run
29
30
  end
30
31
  else
31
32
  htmldiff.run
32
33
  end
34
+
35
+ # vim: ft=ruby
@@ -1,6 +1,9 @@
1
- #!ruby -w
1
+ #! /usr/bin/env ruby -w
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'diff/lcs'
4
5
  require 'diff/lcs/ldiff'
5
6
 
6
7
  exit Diff::LCS::Ldiff.run(ARGV)
8
+
9
+ # vim: ft=ruby
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'diff/lcs'
@@ -1,24 +1,24 @@
1
- # -*- ruby encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
+
3
+ module Diff; end unless defined? Diff # rubocop:disable Style/Documentation
2
4
 
3
- module Diff; end unless defined? Diff
4
5
  # == How Diff Works (by Mark-Jason Dominus)
5
6
  #
6
- # I once read an article written by the authors of +diff+; they said that
7
- # they hard worked very hard on the algorithm until they found the right
8
- # one.
7
+ # I once read an article written by the authors of +diff+; they said that they
8
+ # hard worked very hard on the algorithm until they found the right one.
9
9
  #
10
- # I think what they ended up using (and I hope someone will correct me,
11
- # because I am not very confident about this) was the `longest common
12
- # subsequence' method. In the LCS problem, you have two sequences of items:
10
+ # I think what they ended up using (and I hope someone will correct me, because
11
+ # I am not very confident about this) was the `longest common subsequence'
12
+ # method. In the LCS problem, you have two sequences of items:
13
13
  #
14
14
  # a b c d f g h j q z
15
15
  # a b c d e f g i j k r x y z
16
16
  #
17
17
  # and you want to find the longest sequence of items that is present in both
18
18
  # original sequences in the same order. That is, you want to find a new
19
- # sequence *S* which can be obtained from the first sequence by deleting
20
- # some items, and from the second sequence by deleting other items. You also
21
- # want *S* to be as long as possible. In this case *S* is:
19
+ # sequence *S* which can be obtained from the first sequence by deleting some
20
+ # items, and from the second sequence by deleting other items. You also want
21
+ # *S* to be as long as possible. In this case *S* is:
22
22
  #
23
23
  # a b c d f g j z
24
24
  #
@@ -30,9 +30,9 @@ module Diff; end unless defined? Diff
30
30
  # This module solves the LCS problem. It also includes a canned function to
31
31
  # generate +diff+-like output.
32
32
  #
33
- # It might seem from the example above that the LCS of two sequences is
34
- # always pretty obvious, but that's not always the case, especially when the
35
- # two sequences have many repeated elements. For example, consider
33
+ # It might seem from the example above that the LCS of two sequences is always
34
+ # pretty obvious, but that's not always the case, especially when the two
35
+ # sequences have many repeated elements. For example, consider
36
36
  #
37
37
  # a x b y c z p d q
38
38
  # a b c a x b y c z
@@ -43,29 +43,35 @@ module Diff; end unless defined? Diff
43
43
  # a x b y c z p d q
44
44
  # a b c a b y c z
45
45
  #
46
- # This finds the common subsequence +a b c z+. But actually, the LCS is +a x
47
- # b y c z+:
46
+ # This finds the common subsequence +a b c z+. But actually, the LCS is +a x b
47
+ # y c z+:
48
48
  #
49
49
  # a x b y c z p d q
50
50
  # a b c a x b y c z
51
51
  module Diff::LCS
52
- VERSION = '1.3'
52
+ VERSION = '1.4.4'
53
53
  end
54
54
 
55
55
  require 'diff/lcs/callbacks'
56
56
  require 'diff/lcs/internals'
57
57
 
58
- module Diff::LCS
58
+ module Diff::LCS # rubocop:disable Style/Documentation
59
59
  # Returns an Array containing the longest common subsequence(s) between
60
- # +self+ and +other+. See Diff::LCS#LCS.
60
+ # +self+ and +other+. See Diff::LCS#lcs.
61
61
  #
62
62
  # lcs = seq1.lcs(seq2)
63
+ #
64
+ # A note when using objects: Diff::LCS only works properly when each object
65
+ # can be used as a key in a Hash, which typically means that the objects must
66
+ # implement Object#eql? in a way that two identical values compare
67
+ # identically for key purposes. That is:
68
+ #
69
+ # O.new('a').eql?(O.new('a')) == true
63
70
  def lcs(other, &block) #:yields self[i] if there are matched subsequences:
64
71
  Diff::LCS.lcs(self, other, &block)
65
72
  end
66
73
 
67
- # Returns the difference set between +self+ and +other+. See
68
- # Diff::LCS#diff.
74
+ # Returns the difference set between +self+ and +other+. See Diff::LCS#diff.
69
75
  def diff(other, callbacks = nil, &block)
70
76
  Diff::LCS.diff(self, other, callbacks, &block)
71
77
  end
@@ -79,29 +85,27 @@ module Diff::LCS
79
85
  # Traverses the discovered longest common subsequences between +self+ and
80
86
  # +other+. See Diff::LCS#traverse_sequences.
81
87
  def traverse_sequences(other, callbacks = nil, &block)
82
- traverse_sequences(self, other, callbacks ||
83
- Diff::LCS.YieldingCallbacks, &block)
88
+ traverse_sequences(self, other, callbacks || Diff::LCS::SequenceCallbacks, &block)
84
89
  end
85
90
 
86
91
  # Traverses the discovered longest common subsequences between +self+ and
87
92
  # +other+ using the alternate, balanced algorithm. See
88
93
  # Diff::LCS#traverse_balanced.
89
94
  def traverse_balanced(other, callbacks = nil, &block)
90
- traverse_balanced(self, other, callbacks ||
91
- Diff::LCS.YieldingCallbacks, &block)
95
+ traverse_balanced(self, other, callbacks || Diff::LCS::BalancedCallbacks, &block)
92
96
  end
93
97
 
94
- # Attempts to patch +self+ with the provided +patchset+. A new sequence
95
- # based on +self+ and the +patchset+ will be created. See Diff::LCS#patch.
96
- # Attempts to autodiscover the direction of the patch.
98
+ # Attempts to patch +self+ with the provided +patchset+. A new sequence based
99
+ # on +self+ and the +patchset+ will be created. See Diff::LCS#patch. Attempts
100
+ # to autodiscover the direction of the patch.
97
101
  def patch(patchset)
98
102
  Diff::LCS.patch(self, patchset)
99
103
  end
100
- alias_method :unpatch, :patch
104
+ alias unpatch patch
101
105
 
102
- # Attempts to patch +self+ with the provided +patchset+. A new sequence
103
- # based on +self+ and the +patchset+ will be created. See Diff::LCS#patch.
104
- # Does no patch direction autodiscovery.
106
+ # Attempts to patch +self+ with the provided +patchset+. A new sequence based
107
+ # on +self+ and the +patchset+ will be created. See Diff::LCS#patch. Does no
108
+ # patch direction autodiscovery.
105
109
  def patch!(patchset)
106
110
  Diff::LCS.patch!(self, patchset)
107
111
  end
@@ -114,8 +118,8 @@ module Diff::LCS
114
118
  end
115
119
 
116
120
  # Attempts to patch +self+ with the provided +patchset+, using #patch!. If
117
- # the sequence this is used on supports #replace, the value of +self+ will
118
- # be replaced. See Diff::LCS#patch. Does no patch direction autodiscovery.
121
+ # the sequence this is used on supports #replace, the value of +self+ will be
122
+ # replaced. See Diff::LCS#patch. Does no patch direction autodiscovery.
119
123
  def patch_me(patchset)
120
124
  if respond_to? :replace
121
125
  replace(patch!(patchset))
@@ -124,10 +128,9 @@ module Diff::LCS
124
128
  end
125
129
  end
126
130
 
127
- # Attempts to unpatch +self+ with the provided +patchset+, using
128
- # #unpatch!. If the sequence this is used on supports #replace, the value
129
- # of +self+ will be replaced. See Diff::LCS#unpatch. Does no patch direction
130
- # autodiscovery.
131
+ # Attempts to unpatch +self+ with the provided +patchset+, using #unpatch!.
132
+ # If the sequence this is used on supports #replace, the value of +self+ will
133
+ # be replaced. See Diff::LCS#unpatch. Does no patch direction autodiscovery.
131
134
  def unpatch_me(patchset)
132
135
  if respond_to? :replace
133
136
  replace(unpatch!(patchset))
@@ -142,29 +145,28 @@ class << Diff::LCS
142
145
  matches = Diff::LCS::Internals.lcs(seq1, seq2)
143
146
  ret = []
144
147
  string = seq1.kind_of? String
145
- matches.each_with_index do |e, i|
146
- unless matches[i].nil?
147
- v = string ? seq1[i, 1] : seq1[i]
148
- v = block[v] if block
149
- ret << v
150
- end
148
+ matches.each_with_index do |_e, i|
149
+ next if matches[i].nil?
150
+
151
+ v = string ? seq1[i, 1] : seq1[i]
152
+ v = block[v] if block
153
+ ret << v
151
154
  end
152
155
  ret
153
156
  end
154
- alias_method :LCS, :lcs
157
+ alias LCS lcs
155
158
 
156
159
  # #diff computes the smallest set of additions and deletions necessary to
157
- # turn the first sequence into the second, and returns a description of
158
- # these changes.
160
+ # turn the first sequence into the second, and returns a description of these
161
+ # changes.
159
162
  #
160
163
  # See Diff::LCS::DiffCallbacks for the default behaviour. An alternate
161
164
  # behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a
162
165
  # Class argument is provided for +callbacks+, #diff will attempt to
163
- # initialise it. If the +callbacks+ object (possibly initialised) responds
164
- # to #finish, it will be called.
166
+ # initialise it. If the +callbacks+ object (possibly initialised) responds to
167
+ # #finish, it will be called.
165
168
  def diff(seq1, seq2, callbacks = nil, &block) # :yields diff changes:
166
- diff_traversal(:diff, seq1, seq2, callbacks || Diff::LCS::DiffCallbacks,
167
- &block)
169
+ diff_traversal(:diff, seq1, seq2, callbacks || Diff::LCS::DiffCallbacks, &block)
168
170
  end
169
171
 
170
172
  # #sdiff computes all necessary components to show two sequences and their
@@ -179,18 +181,31 @@ class << Diff::LCS
179
181
  # See Diff::LCS::SDiffCallbacks for the default behaviour. An alternate
180
182
  # behaviour may be implemented with Diff::LCS::ContextDiffCallbacks. If a
181
183
  # Class argument is provided for +callbacks+, #diff will attempt to
182
- # initialise it. If the +callbacks+ object (possibly initialised) responds
183
- # to #finish, it will be called.
184
+ # initialise it. If the +callbacks+ object (possibly initialised) responds to
185
+ # #finish, it will be called.
186
+ #
187
+ # Each element of a returned array is a Diff::LCS::ContextChange object,
188
+ # which can be implicitly converted to an array.
189
+ #
190
+ # Diff::LCS.sdiff(a, b).each do |action, (old_pos, old_element), (new_pos, new_element)|
191
+ # case action
192
+ # when '!'
193
+ # # replace
194
+ # when '-'
195
+ # # delete
196
+ # when '+'
197
+ # # insert
198
+ # end
199
+ # end
184
200
  def sdiff(seq1, seq2, callbacks = nil, &block) #:yields diff changes:
185
- diff_traversal(:sdiff, seq1, seq2, callbacks || Diff::LCS::SDiffCallbacks,
186
- &block)
201
+ diff_traversal(:sdiff, seq1, seq2, callbacks || Diff::LCS::SDiffCallbacks, &block)
187
202
  end
188
203
 
189
- # #traverse_sequences is the most general facility provided by this
190
- # module; #diff and #lcs are implemented as calls to it.
204
+ # #traverse_sequences is the most general facility provided by this module;
205
+ # #diff and #lcs are implemented as calls to it.
191
206
  #
192
- # The arguments to #traverse_sequences are the two sequences to traverse,
193
- # and a callback object, like this:
207
+ # The arguments to #traverse_sequences are the two sequences to traverse, and
208
+ # a callback object, like this:
194
209
  #
195
210
  # traverse_sequences(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
196
211
  #
@@ -218,56 +233,55 @@ class << Diff::LCS
218
233
  # ^
219
234
  # b---+
220
235
  #
221
- # If there are two arrows (+a+ and +b+) pointing to elements of sequences
222
- # +A+ and +B+, the arrows will initially point to the first elements of
223
- # their respective sequences. #traverse_sequences will advance the arrows
224
- # through the sequences one element at a time, calling a method on the
225
- # user-specified callback object before each advance. It will advance the
226
- # arrows in such a way that if there are elements <tt>A[i]</tt> and
227
- # <tt>B[j]</tt> which are both equal and part of the longest common
228
- # subsequence, there will be some moment during the execution of
229
- # #traverse_sequences when arrow +a+ is pointing to <tt>A[i]</tt> and
230
- # arrow +b+ is pointing to <tt>B[j]</tt>. When this happens,
231
- # #traverse_sequences will call <tt>callbacks#match</tt> and then it will
232
- # advance both arrows.
233
- #
234
- # Otherwise, one of the arrows is pointing to an element of its sequence
235
- # that is not part of the longest common subsequence. #traverse_sequences
236
- # will advance that arrow and will call <tt>callbacks#discard_a</tt> or
237
- # <tt>callbacks#discard_b</tt>, depending on which arrow it advanced. If
238
- # both arrows point to elements that are not part of the longest common
239
- # subsequence, then #traverse_sequences will advance one of them and call
240
- # the appropriate callback, but it is not specified which it will call.
241
- #
242
- # The methods for <tt>callbacks#match</tt>, <tt>callbacks#discard_a</tt>,
243
- # and <tt>callbacks#discard_b</tt> are invoked with an event comprising
244
- # the action ("=", "+", or "-", respectively), the indicies +i+ and +j+,
245
- # and the elements <tt>A[i]</tt> and <tt>B[j]</tt>. Return values are
246
- # discarded by #traverse_sequences.
236
+ # If there are two arrows (+a+ and +b+) pointing to elements of sequences +A+
237
+ # and +B+, the arrows will initially point to the first elements of their
238
+ # respective sequences. #traverse_sequences will advance the arrows through
239
+ # the sequences one element at a time, calling a method on the user-specified
240
+ # callback object before each advance. It will advance the arrows in such a
241
+ # way that if there are elements <tt>A[i]</tt> and <tt>B[j]</tt> which are
242
+ # both equal and part of the longest common subsequence, there will be some
243
+ # moment during the execution of #traverse_sequences when arrow +a+ is
244
+ # pointing to <tt>A[i]</tt> and arrow +b+ is pointing to <tt>B[j]</tt>. When
245
+ # this happens, #traverse_sequences will call <tt>callbacks#match</tt> and
246
+ # then it will advance both arrows.
247
+ #
248
+ # Otherwise, one of the arrows is pointing to an element of its sequence that
249
+ # is not part of the longest common subsequence. #traverse_sequences will
250
+ # advance that arrow and will call <tt>callbacks#discard_a</tt> or
251
+ # <tt>callbacks#discard_b</tt>, depending on which arrow it advanced. If both
252
+ # arrows point to elements that are not part of the longest common
253
+ # subsequence, then #traverse_sequences will advance one of them and call the
254
+ # appropriate callback, but it is not specified which it will call.
255
+ #
256
+ # The methods for <tt>callbacks#match</tt>, <tt>callbacks#discard_a</tt>, and
257
+ # <tt>callbacks#discard_b</tt> are invoked with an event comprising the
258
+ # action ("=", "+", or "-", respectively), the indicies +i+ and +j+, and the
259
+ # elements <tt>A[i]</tt> and <tt>B[j]</tt>. Return values are discarded by
260
+ # #traverse_sequences.
247
261
  #
248
262
  # === End of Sequences
249
263
  #
250
264
  # If arrow +a+ reaches the end of its sequence before arrow +b+ does,
251
- # #traverse_sequence will try to call <tt>callbacks#finished_a</tt> with
252
- # the last index and element of +A+ (<tt>A[-1]</tt>) and the current index
253
- # and element of +B+ (<tt>B[j]</tt>). If <tt>callbacks#finished_a</tt>
254
- # does not exist, then <tt>callbacks#discard_b</tt> will be called on each
255
- # element of +B+ until the end of the sequence is reached (the call will
256
- # be done with <tt>A[-1]</tt> and <tt>B[j]</tt> for each element).
265
+ # #traverse_sequence will try to call <tt>callbacks#finished_a</tt> with the
266
+ # last index and element of +A+ (<tt>A[-1]</tt>) and the current index and
267
+ # element of +B+ (<tt>B[j]</tt>). If <tt>callbacks#finished_a</tt> does not
268
+ # exist, then <tt>callbacks#discard_b</tt> will be called on each element of
269
+ # +B+ until the end of the sequence is reached (the call will be done with
270
+ # <tt>A[-1]</tt> and <tt>B[j]</tt> for each element).
257
271
  #
258
272
  # If +b+ reaches the end of +B+ before +a+ reaches the end of +A+,
259
273
  # <tt>callbacks#finished_b</tt> will be called with the current index and
260
274
  # element of +A+ (<tt>A[i]</tt>) and the last index and element of +B+
261
- # (<tt>A[-1]</tt>). Again, if <tt>callbacks#finished_b</tt> does not exist
262
- # on the callback object, then <tt>callbacks#discard_a</tt> will be called
263
- # on each element of +A+ until the end of the sequence is reached
264
- # (<tt>A[i]</tt> and <tt>B[-1]</tt>).
275
+ # (<tt>A[-1]</tt>). Again, if <tt>callbacks#finished_b</tt> does not exist on
276
+ # the callback object, then <tt>callbacks#discard_a</tt> will be called on
277
+ # each element of +A+ until the end of the sequence is reached (<tt>A[i]</tt>
278
+ # and <tt>B[-1]</tt>).
265
279
  #
266
280
  # There is a chance that one additional <tt>callbacks#discard_a</tt> or
267
- # <tt>callbacks#discard_b</tt> will be called after the end of the
268
- # sequence is reached, if +a+ has not yet reached the end of +A+ or +b+
269
- # has not yet reached the end of +B+.
270
- def traverse_sequences(seq1, seq2, callbacks = Diff::LCS::SequenceCallbacks, &block) #:yields change events:
281
+ # <tt>callbacks#discard_b</tt> will be called after the end of the sequence
282
+ # is reached, if +a+ has not yet reached the end of +A+ or +b+ has not yet
283
+ # reached the end of +B+.
284
+ def traverse_sequences(seq1, seq2, callbacks = Diff::LCS::SequenceCallbacks) #:yields change events:
271
285
  callbacks ||= Diff::LCS::SequenceCallbacks
272
286
  matches = Diff::LCS::Internals.lcs(seq1, seq2)
273
287
 
@@ -293,6 +307,7 @@ class << Diff::LCS
293
307
  else
294
308
  loop do
295
309
  break unless bj < b_line
310
+
296
311
  bx = string ? seq2[bj, 1] : seq2[bj]
297
312
  event = Diff::LCS::ContextChange.new('+', i, ax, bj, bx)
298
313
  event = yield event if block_given?
@@ -309,12 +324,12 @@ class << Diff::LCS
309
324
  end
310
325
  ai += 1
311
326
 
312
- # The last entry (if any) processed was a match. +ai+ and +bj+ point
313
- # just past the last matching lines in their sequences.
327
+ # The last entry (if any) processed was a match. +ai+ and +bj+ point just
328
+ # past the last matching lines in their sequences.
314
329
  while (ai < a_size) or (bj < b_size)
315
330
  # last A?
316
331
  if ai == a_size and bj < b_size
317
- if callbacks.respond_to?(:finished_a) and not run_finished_a
332
+ if callbacks.respond_to?(:finished_a) and !run_finished_a
318
333
  ax = string ? seq1[-1, 1] : seq1[-1]
319
334
  bx = string ? seq2[bj, 1] : seq2[bj]
320
335
  event = Diff::LCS::ContextChange.new('>', (a_size - 1), ax, bj, bx)
@@ -336,7 +351,7 @@ class << Diff::LCS
336
351
 
337
352
  # last B?
338
353
  if bj == b_size and ai < a_size
339
- if callbacks.respond_to?(:finished_b) and not run_finished_b
354
+ if callbacks.respond_to?(:finished_b) and !run_finished_b
340
355
  ax = string ? seq1[ai, 1] : seq1[ai]
341
356
  bx = string ? seq2[-1, 1] : seq2[-1]
342
357
  event = Diff::LCS::ContextChange.new('<', ai, ax, (b_size - 1), bx)
@@ -365,25 +380,25 @@ class << Diff::LCS
365
380
  ai += 1
366
381
  end
367
382
 
368
- if bj < b_size
369
- ax = string ? seq1[ai, 1] : seq1[ai]
370
- bx = string ? seq2[bj, 1] : seq2[bj]
371
- event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
372
- event = yield event if block_given?
373
- callbacks.discard_b(event)
374
- bj += 1
375
- end
383
+ next unless bj < b_size
384
+
385
+ ax = string ? seq1[ai, 1] : seq1[ai]
386
+ bx = string ? seq2[bj, 1] : seq2[bj]
387
+ event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
388
+ event = yield event if block_given?
389
+ callbacks.discard_b(event)
390
+ bj += 1
376
391
  end
377
392
  end
378
393
 
379
394
  # #traverse_balanced is an alternative to #traverse_sequences. It uses a
380
- # different algorithm to iterate through the entries in the computed
381
- # longest common subsequence. Instead of viewing the changes as insertions
382
- # or deletions from one of the sequences, #traverse_balanced will report
395
+ # different algorithm to iterate through the entries in the computed longest
396
+ # common subsequence. Instead of viewing the changes as insertions or
397
+ # deletions from one of the sequences, #traverse_balanced will report
383
398
  # <em>changes</em> between the sequences.
384
399
  #
385
- # The arguments to #traverse_balanced are the two sequences to traverse
386
- # and a callback object, like this:
400
+ # The arguments to #traverse_balanced are the two sequences to traverse and a
401
+ # callback object, like this:
387
402
  #
388
403
  # traverse_balanced(seq1, seq2, Diff::LCS::ContextDiffCallbacks.new)
389
404
  #
@@ -419,24 +434,23 @@ class << Diff::LCS
419
434
  #
420
435
  # === Matches
421
436
  #
422
- # If there are two arrows (+a+ and +b+) pointing to elements of sequences
423
- # +A+ and +B+, the arrows will initially point to the first elements of
424
- # their respective sequences. #traverse_sequences will advance the arrows
425
- # through the sequences one element at a time, calling a method on the
426
- # user-specified callback object before each advance. It will advance the
427
- # arrows in such a way that if there are elements <tt>A[i]</tt> and
428
- # <tt>B[j]</tt> which are both equal and part of the longest common
429
- # subsequence, there will be some moment during the execution of
430
- # #traverse_sequences when arrow +a+ is pointing to <tt>A[i]</tt> and
431
- # arrow +b+ is pointing to <tt>B[j]</tt>. When this happens,
432
- # #traverse_sequences will call <tt>callbacks#match</tt> and then it will
433
- # advance both arrows.
437
+ # If there are two arrows (+a+ and +b+) pointing to elements of sequences +A+
438
+ # and +B+, the arrows will initially point to the first elements of their
439
+ # respective sequences. #traverse_sequences will advance the arrows through
440
+ # the sequences one element at a time, calling a method on the user-specified
441
+ # callback object before each advance. It will advance the arrows in such a
442
+ # way that if there are elements <tt>A[i]</tt> and <tt>B[j]</tt> which are
443
+ # both equal and part of the longest common subsequence, there will be some
444
+ # moment during the execution of #traverse_sequences when arrow +a+ is
445
+ # pointing to <tt>A[i]</tt> and arrow +b+ is pointing to <tt>B[j]</tt>. When
446
+ # this happens, #traverse_sequences will call <tt>callbacks#match</tt> and
447
+ # then it will advance both arrows.
434
448
  #
435
449
  # === Discards
436
450
  #
437
- # Otherwise, one of the arrows is pointing to an element of its sequence
438
- # that is not part of the longest common subsequence. #traverse_sequences
439
- # will advance that arrow and will call <tt>callbacks#discard_a</tt> or
451
+ # Otherwise, one of the arrows is pointing to an element of its sequence that
452
+ # is not part of the longest common subsequence. #traverse_sequences will
453
+ # advance that arrow and will call <tt>callbacks#discard_a</tt> or
440
454
  # <tt>callbacks#discard_b</tt>, depending on which arrow it advanced.
441
455
  #
442
456
  # === Changes
@@ -450,14 +464,14 @@ class << Diff::LCS
450
464
  #
451
465
  # The methods for <tt>callbacks#match</tt>, <tt>callbacks#discard_a</tt>,
452
466
  # <tt>callbacks#discard_b</tt>, and <tt>callbacks#change</tt> are invoked
453
- # with an event comprising the action ("=", "+", "-", or "!",
454
- # respectively), the indicies +i+ and +j+, and the elements
455
- # <tt>A[i]</tt> and <tt>B[j]</tt>. Return values are discarded by
456
- # #traverse_balanced.
467
+ # with an event comprising the action ("=", "+", "-", or "!", respectively),
468
+ # the indicies +i+ and +j+, and the elements <tt>A[i]</tt> and <tt>B[j]</tt>.
469
+ # Return values are discarded by #traverse_balanced.
457
470
  #
458
471
  # === Context
459
- # Note that +i+ and +j+ may not be the same index position, even if +a+
460
- # and +b+ are considered to be pointing to matching or changed elements.
472
+ #
473
+ # Note that +i+ and +j+ may not be the same index position, even if +a+ and
474
+ # +b+ are considered to be pointing to matching or changed elements.
461
475
  def traverse_balanced(seq1, seq2, callbacks = Diff::LCS::BalancedCallbacks)
462
476
  matches = Diff::LCS::Internals.lcs(seq1, seq2)
463
477
  a_size = seq1.size
@@ -475,6 +489,7 @@ class << Diff::LCS
475
489
  end
476
490
 
477
491
  break if ma >= matches.size # end of matches?
492
+
478
493
  mb = matches[ma]
479
494
 
480
495
  # Change(seq2)
@@ -489,7 +504,6 @@ class << Diff::LCS
489
504
  event = yield event if block_given?
490
505
  callbacks.change(event)
491
506
  ai += 1
492
- bj += 1
493
507
  else
494
508
  event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
495
509
  event = yield event if block_given?
@@ -499,8 +513,9 @@ class << Diff::LCS
499
513
  event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
500
514
  event = yield event if block_given?
501
515
  callbacks.discard_b(event)
502
- bj += 1
503
516
  end
517
+
518
+ bj += 1
504
519
  when [true, false]
505
520
  event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
506
521
  event = yield event if block_given?
@@ -535,7 +550,6 @@ class << Diff::LCS
535
550
  event = yield event if block_given?
536
551
  callbacks.change(event)
537
552
  ai += 1
538
- bj += 1
539
553
  else
540
554
  event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
541
555
  event = yield event if block_given?
@@ -545,8 +559,9 @@ class << Diff::LCS
545
559
  event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
546
560
  event = yield event if block_given?
547
561
  callbacks.discard_b(event)
548
- bj += 1
549
562
  end
563
+
564
+ bj += 1
550
565
  when [true, false]
551
566
  event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
552
567
  event = yield event if block_given?
@@ -562,9 +577,9 @@ class << Diff::LCS
562
577
  end
563
578
 
564
579
  PATCH_MAP = { #:nodoc:
565
- :patch => { '+' => '+', '-' => '-', '!' => '!', '=' => '=' },
566
- :unpatch => { '+' => '-', '-' => '+', '!' => '!', '=' => '=' }
567
- }
580
+ :patch => { '+' => '+', '-' => '-', '!' => '!', '=' => '=' }.freeze,
581
+ :unpatch => { '+' => '-', '-' => '+', '!' => '!', '=' => '=' }.freeze
582
+ }.freeze
568
583
 
569
584
  # Applies a +patchset+ to the sequence +src+ according to the +direction+
570
585
  # (<tt>:patch</tt> or <tt>:unpatch</tt>), producing a new sequence.
@@ -577,23 +592,23 @@ class << Diff::LCS
577
592
  #
578
593
  # patch(s1, diff(s1, s2)) -> s2
579
594
  #
580
- # A +patchset+ can be considered to apply backward (<tt>:unpatch</tt>) if
581
- # the following expression is true:
595
+ # A +patchset+ can be considered to apply backward (<tt>:unpatch</tt>) if the
596
+ # following expression is true:
582
597
  #
583
598
  # patch(s2, diff(s1, s2)) -> s1
584
599
  #
585
- # If the +patchset+ contains no changes, the +src+ value will be returned
586
- # as either <tt>src.dup</tt> or +src+. A +patchset+ can be deemed as
587
- # having no changes if the following predicate returns true:
600
+ # If the +patchset+ contains no changes, the +src+ value will be returned as
601
+ # either <tt>src.dup</tt> or +src+. A +patchset+ can be deemed as having no
602
+ # changes if the following predicate returns true:
588
603
  #
589
604
  # patchset.empty? or
590
- # patchset.flatten.all? { |change| change.unchanged? }
605
+ # patchset.flatten(1).all? { |change| change.unchanged? }
591
606
  #
592
607
  # === Patchsets
593
608
  #
594
- # A +patchset+ is always an enumerable sequence of changes, hunks of
595
- # changes, or a mix of the two. A hunk of changes is an enumerable
596
- # sequence of changes:
609
+ # A +patchset+ is always an enumerable sequence of changes, hunks of changes,
610
+ # or a mix of the two. A hunk of changes is an enumerable sequence of
611
+ # changes:
597
612
  #
598
613
  # [ # patchset
599
614
  # # change
@@ -602,18 +617,15 @@ class << Diff::LCS
602
617
  # ]
603
618
  # ]
604
619
  #
605
- # The +patch+ method accepts <tt>patchset</tt>s that are enumerable
606
- # sequences containing either Diff::LCS::Change objects (or a subclass) or
607
- # the array representations of those objects. Prior to application, array
620
+ # The +patch+ method accepts <tt>patchset</tt>s that are enumerable sequences
621
+ # containing either Diff::LCS::Change objects (or a subclass) or the array
622
+ # representations of those objects. Prior to application, array
608
623
  # representations of Diff::LCS::Change objects will be reified.
609
624
  def patch(src, patchset, direction = nil)
610
625
  # Normalize the patchset.
611
626
  has_changes, patchset = Diff::LCS::Internals.analyze_patchset(patchset)
612
627
 
613
- if not has_changes
614
- return src.dup if src.respond_to? :dup
615
- return src
616
- end
628
+ return src.respond_to?(:dup) ? src.dup : src unless has_changes
617
629
 
618
630
  string = src.kind_of?(String)
619
631
  # Start with a new empty type of the source's class
@@ -625,7 +637,7 @@ class << Diff::LCS
625
637
 
626
638
  patch_map = PATCH_MAP[direction]
627
639
 
628
- patchset.flatten.each do |change|
640
+ patchset.each do |change|
629
641
  # Both Change and ContextChange support #action
630
642
  action = patch_map[change.action]
631
643
 
@@ -657,8 +669,8 @@ class << Diff::LCS
657
669
  bj += 1
658
670
  end
659
671
 
660
- res << el
661
- bj += 1
672
+ res << el
673
+ bj += 1
662
674
  when '='
663
675
  # This only appears in sdiff output with the SDiff callback.
664
676
  # Therefore, we only need to worry about dealing with a single
@@ -674,10 +686,10 @@ class << Diff::LCS
674
686
  bj += 1
675
687
  end
676
688
 
677
- bj += 1
678
- ai += 1
689
+ bj += 1
690
+ ai += 1
679
691
 
680
- res << el
692
+ res << el
681
693
  end
682
694
  when Diff::LCS::Change
683
695
  case action
@@ -711,15 +723,17 @@ class << Diff::LCS
711
723
  res
712
724
  end
713
725
 
714
- # Given a set of patchset, convert the current version to the prior
715
- # version. Does no auto-discovery.
726
+ # Given a set of patchset, convert the current version to the prior version.
727
+ # Does no auto-discovery.
716
728
  def unpatch!(src, patchset)
717
729
  patch(src, patchset, :unpatch)
718
730
  end
719
731
 
720
- # Given a set of patchset, convert the current version to the next
721
- # version. Does no auto-discovery.
732
+ # Given a set of patchset, convert the current version to the next version.
733
+ # Does no auto-discovery.
722
734
  def patch!(src, patchset)
723
735
  patch(src, patchset, :patch)
724
736
  end
725
737
  end
738
+
739
+ require 'diff/lcs/backports'