What is the best Diff library in Ruby? [duplicate]

試著忘記壹切 提交于 2019-12-30 00:33:52

问题


I've looked at diff-lcs ( http://raa.ruby-lang.org/project/diff-lcs ) but it's poorly documented, and appears to be unmaintained.

Are there any good, actively maintained ruby gems for diffing text or html files?


回答1:


I looked around and couldn't find an existing gem or library that offered a convenient way to generate diff style output from ruby.

I just released diffy which does what I want. It's a lightweight wrapper around diff which lets you generate text or html diffs from two strings, without a lot of fuss. I hope others find it useful. It's in use on wiff.me for anyone wants to preview the html output.




回答2:


I did some very recent searching and discovered that diff-lcs is an actively supported library again. It is now hosted at halostatue/diff-lcs on GitHub. The recent activity seems to be because one of the authors of Grit, the object-oriented git library for Ruby, added it as a dependency. Grit runs gollom, the GitHub wiki system. If GitHub is a supporter of the library then it's probably safe to say that diff-lcs will remain active for a long time.




回答3:


I don't know about "good"ness, but some places you might go for more information include:

SO search for "ruby diff"

  • diff a ruby string or array
  • Diff two XML doc in Ruby?
  • how do i compare 2 html pages, and output only the different bits in ruby or PHP?

Google search for "ruby diff"

  • http://www.ruby-forum.com/topic/168365
  • http://www.freshports.org/textproc/ruby-diff/


来源:https://stackoverflow.com/questions/3128374/what-is-the-best-diff-library-in-ruby

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!