slimkeyfy 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +34 -0
  3. data/.rspec +3 -0
  4. data/Gemfile +6 -0
  5. data/Gemfile.lock +22 -0
  6. data/LICENSE +21 -0
  7. data/README.md +172 -0
  8. data/bin/slimkeyfy +5 -0
  9. data/lib/.DS_Store +0 -0
  10. data/lib/slimkeyfy/console/command_line.rb +90 -0
  11. data/lib/slimkeyfy/console/io_action.rb +30 -0
  12. data/lib/slimkeyfy/console/printer.rb +50 -0
  13. data/lib/slimkeyfy/console/translate.rb +101 -0
  14. data/lib/slimkeyfy/console.rb +8 -0
  15. data/lib/slimkeyfy/slimutils/file_utils.rb +61 -0
  16. data/lib/slimkeyfy/slimutils/hash_merging.rb +84 -0
  17. data/lib/slimkeyfy/slimutils/key_generator.rb +70 -0
  18. data/lib/slimkeyfy/slimutils/yaml_processor.rb +56 -0
  19. data/lib/slimkeyfy/slimutils.rb +8 -0
  20. data/lib/slimkeyfy/transformer/base_transformer.rb +42 -0
  21. data/lib/slimkeyfy/transformer/controller_transformer.rb +20 -0
  22. data/lib/slimkeyfy/transformer/slim_transformer.rb +92 -0
  23. data/lib/slimkeyfy/transformer/whitespacer.rb +48 -0
  24. data/lib/slimkeyfy/transformer/word.rb +49 -0
  25. data/lib/slimkeyfy/transformer.rb +9 -0
  26. data/lib/slimkeyfy/version.rb +3 -0
  27. data/lib/slimkeyfy.rb +12 -0
  28. data/slimkeyfy.gemspec +21 -0
  29. data/vendor/bundle/bin/htmldiff +25 -0
  30. data/vendor/bundle/bin/ldiff +25 -0
  31. data/vendor/bundle/bin/rspec +23 -0
  32. data/vendor/bundle/build_info/diff-lcs-1.2.5.info +1 -0
  33. data/vendor/bundle/build_info/rspec-3.0.0.info +1 -0
  34. data/vendor/bundle/build_info/rspec-core-3.0.2.info +1 -0
  35. data/vendor/bundle/build_info/rspec-expectations-3.0.2.info +1 -0
  36. data/vendor/bundle/build_info/rspec-mocks-3.0.2.info +1 -0
  37. data/vendor/bundle/build_info/rspec-support-3.0.2.info +1 -0
  38. data/vendor/bundle/gems/diff-lcs-1.2.5/.autotest +3 -0
  39. data/vendor/bundle/gems/diff-lcs-1.2.5/.gemtest +0 -0
  40. data/vendor/bundle/gems/diff-lcs-1.2.5/.hoerc +2 -0
  41. data/vendor/bundle/gems/diff-lcs-1.2.5/.rspec +2 -0
  42. data/vendor/bundle/gems/diff-lcs-1.2.5/.travis.yml +22 -0
  43. data/vendor/bundle/gems/diff-lcs-1.2.5/Contributing.rdoc +64 -0
  44. data/vendor/bundle/gems/diff-lcs-1.2.5/Gemfile +20 -0
  45. data/vendor/bundle/gems/diff-lcs-1.2.5/History.rdoc +152 -0
  46. data/vendor/bundle/gems/diff-lcs-1.2.5/License.rdoc +39 -0
  47. data/vendor/bundle/gems/diff-lcs-1.2.5/Manifest.txt +38 -0
  48. data/vendor/bundle/gems/diff-lcs-1.2.5/README.rdoc +85 -0
  49. data/vendor/bundle/gems/diff-lcs-1.2.5/Rakefile +41 -0
  50. data/vendor/bundle/gems/diff-lcs-1.2.5/autotest/discover.rb +1 -0
  51. data/vendor/bundle/gems/diff-lcs-1.2.5/bin/htmldiff +32 -0
  52. data/vendor/bundle/gems/diff-lcs-1.2.5/bin/ldiff +6 -0
  53. data/vendor/bundle/gems/diff-lcs-1.2.5/docs/COPYING.txt +339 -0
  54. data/vendor/bundle/gems/diff-lcs-1.2.5/docs/artistic.txt +127 -0
  55. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/array.rb +7 -0
  56. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/block.rb +37 -0
  57. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/callbacks.rb +322 -0
  58. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/change.rb +177 -0
  59. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/htmldiff.rb +149 -0
  60. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/hunk.rb +276 -0
  61. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/internals.rb +301 -0
  62. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/ldiff.rb +195 -0
  63. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs/string.rb +5 -0
  64. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff/lcs.rb +805 -0
  65. data/vendor/bundle/gems/diff-lcs-1.2.5/lib/diff-lcs.rb +3 -0
  66. data/vendor/bundle/gems/rspec-3.0.0/License.txt +24 -0
  67. data/vendor/bundle/gems/rspec-3.0.0/README.md +47 -0
  68. data/vendor/bundle/gems/rspec-3.0.0/lib/rspec.rb +3 -0
  69. data/vendor/bundle/gems/rspec-core-3.0.2/.document +5 -0
  70. data/vendor/bundle/gems/rspec-core-3.0.2/.yardopts +7 -0
  71. data/vendor/bundle/gems/rspec-core-3.0.2/Changelog.md +1466 -0
  72. data/vendor/bundle/gems/rspec-core-3.0.2/License.txt +25 -0
  73. data/vendor/bundle/gems/rspec-core-3.0.2/README.md +243 -0
  74. data/vendor/bundle/gems/rspec-core-3.0.2/exe/rspec +4 -0
  75. data/vendor/bundle/gems/rspec-expectations-3.0.2/.document +5 -0
  76. data/vendor/bundle/gems/rspec-expectations-3.0.2/.yardopts +6 -0
  77. data/vendor/bundle/gems/rspec-expectations-3.0.2/Changelog.md +749 -0
  78. data/vendor/bundle/gems/rspec-expectations-3.0.2/License.txt +24 -0
  79. data/vendor/bundle/gems/rspec-expectations-3.0.2/README.md +278 -0
  80. data/vendor/bundle/gems/rspec-mocks-3.0.2/.document +5 -0
  81. data/vendor/bundle/gems/rspec-mocks-3.0.2/.yardopts +6 -0
  82. data/vendor/bundle/gems/rspec-mocks-3.0.2/Changelog.md +733 -0
  83. data/vendor/bundle/gems/rspec-mocks-3.0.2/License.txt +24 -0
  84. data/vendor/bundle/gems/rspec-mocks-3.0.2/README.md +380 -0
  85. data/vendor/bundle/gems/rspec-support-3.0.2/Changelog.md +30 -0
  86. data/vendor/bundle/gems/rspec-support-3.0.2/LICENSE.txt +22 -0
  87. data/vendor/bundle/gems/rspec-support-3.0.2/README.md +17 -0
  88. data/vendor/bundle/specifications/diff-lcs-1.2.5.gemspec +68 -0
  89. data/vendor/bundle/specifications/rspec-3.0.0.gemspec +43 -0
  90. data/vendor/bundle/specifications/rspec-core-3.0.2.gemspec +66 -0
  91. data/vendor/bundle/specifications/rspec-expectations-3.0.2.gemspec +51 -0
  92. data/vendor/bundle/specifications/rspec-mocks-3.0.2.gemspec +48 -0
  93. data/vendor/bundle/specifications/rspec-support-3.0.2.gemspec +42 -0
  94. metadata +153 -0
@@ -0,0 +1,64 @@
1
+ == Contributing
2
+
3
+ I value any contribution to Diff::LCS you can provide: a bug report, a feature
4
+ request, or code contributions.
5
+
6
+ Code contributions to Diff::LCS are especially <del>welcome</del>encouraged.
7
+ Because Diff::LCS is a complex codebase, there are a few guidelines:
8
+
9
+ * Changes <strong>will not</strong> be accepted without tests.
10
+ * The test suite is written with RSpec.‡
11
+ * Match my coding style.
12
+ * Use a thoughtfully-named topic branch that contains your change. Rebase your
13
+ commits into logical chunks as necessary.
14
+ * Use {quality commit messages}[http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html].
15
+ * Do not change the version number; when your patch is accepted and a release
16
+ is made, the version will be updated at that point.
17
+ * Submit a GitHub pull request with your changes.
18
+ * New features require new documentation.
19
+
20
+ === Test Dependencies
21
+
22
+ To run the test suite, you will need to install the development dependencies
23
+ for Diff::LCS. If you have Bundler, you can accomplish this easily:
24
+
25
+ $ bundle install
26
+
27
+ Diff::LCS uses Ryan Davis’s excellent {Hoe}[https://github.com/seattlerb/hoe]
28
+ to manage the release process, and it adds a number of rake tasks. You will
29
+ mostly be interested in:
30
+
31
+ $ rake
32
+
33
+ which runs the tests the same way that:
34
+
35
+ $ rake spec
36
+ $ rake test
37
+ $ rake travis
38
+
39
+ will do.
40
+
41
+ === Workflow
42
+
43
+ Here's the most direct way to get your work merged into the project:
44
+
45
+ * Fork the project.
46
+ * Clone down your fork (+git clone git://github.com/<username>/diff-lcs.git+).
47
+ * Create a topic branch to contain your change (+git checkout -b my\_awesome\_feature+).
48
+ * Hack away, add tests. Not necessarily in that order.
49
+ * Make sure everything still passes by running `rake`.
50
+ * If necessary, rebase your commits into logical chunks, without errors.
51
+ * Push the branch up (+git push origin my\_awesome\_feature+).
52
+ * Create a pull request against halostatue/diff-lcs and describe what your
53
+ change does and the why you think it should be merged.
54
+
55
+ === Contributors
56
+
57
+ * Austin Ziegler created Diff::LCS.
58
+
59
+ Thanks to everyone else who has contributed to Diff::LCS:
60
+
61
+ * Kenichi Kamiya
62
+ * Michael Granger
63
+ * Vít Ondruch
64
+ * Jon Rowe
@@ -0,0 +1,20 @@
1
+ # -*- ruby -*-
2
+
3
+ # DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`.
4
+
5
+ source "https://rubygems.org/"
6
+
7
+
8
+ gem "rubyforge", ">=2.0.4", :group => [:development, :test]
9
+ gem "rdoc", "~>4.0", :group => [:development, :test]
10
+ gem "hoe-bundler", "~>1.2", :group => [:development, :test]
11
+ gem "hoe-doofus", "~>1.0", :group => [:development, :test]
12
+ gem "hoe-gemspec2", "~>1.1", :group => [:development, :test]
13
+ gem "hoe-git", "~>1.5", :group => [:development, :test]
14
+ gem "hoe-rubygems", "~>1.0", :group => [:development, :test]
15
+ gem "hoe-travis", "~>1.2", :group => [:development, :test]
16
+ gem "rake", "~>10.0", :group => [:development, :test]
17
+ gem "rspec", "~>2.0", :group => [:development, :test]
18
+ gem "hoe", "~>3.7", :group => [:development, :test]
19
+
20
+ # vim: syntax=ruby
@@ -0,0 +1,152 @@
1
+ == 1.2.5 / 2013-11-08
2
+
3
+ * Bugs fixed:
4
+ * Comparing arrays flattened them too far, especially with Diff::LCS.sdiff.
5
+ https://github.com/halostatue/diff-lcs/pull/23
6
+
7
+ == 1.2.4 / 2013-04-20
8
+
9
+ * Bugs fixed:
10
+ * A bug was introduced after 1.1.3 when pruning common sequences at the start
11
+ of comparison. Paul Kunysch (@pck) fixed this in pull request 18. Thanks!
12
+ https://github.com/halostatue/diff-lcs/pull/18
13
+ * The Rubinius (1.9 mode) bug in rubinius/rubinius#2268 has been fixed by the
14
+ Rubinius team two days after it was filed. Thanks for fixing this so quickly!
15
+ https://github.com/rubinius/rubinius/issues/2268
16
+ * Switching to Raggi's hoe-gemspec2 for gemspec generation.
17
+
18
+ == 1.2.3 / 2013-04-11
19
+
20
+ * Bugs Fixed:
21
+ * The new encoding detection for diff output generation (added in 1.2.2)
22
+ introduced a bug if the left side of the comparison was the empty set.
23
+ Originally found in rspec/rspec-expectations#238 and
24
+ rspec/rspec-expectations#239. Jon Rowe developed a reasonable heuristic
25
+ (left side, right side, empty string literal) to avoid this bug.
26
+ https://github.com/rspec/rspec-expectations/pull/238
27
+ https://github.com/rspec/rspec-expectations/pull/239
28
+ * There is a known issue with Rubinius in 1.9 mode reported in
29
+ rubinius/rubinius#2268 and demonstrated in the Travis CI builds. For all
30
+ other tested platforms, diff-lcs is considered stable. As soon as a suitably
31
+ small test-case can be created for the Rubinius team to examine, this will be
32
+ added to the Rubinius issue around this.
33
+ https://github.com/rubinius/rubinius/issues/2268
34
+ https://travis-ci.org/halostatue/diff-lcs/jobs/6241195
35
+
36
+ == 1.2.2 / 2013-03-30
37
+
38
+ * Bugs Fixed:
39
+ * Diff::LCS::Hunk could not properly generate a difference for comparison
40
+ sets that are not US-ASCII-compatible because of the use of literal regular
41
+ expressions and strings. Jon Rowe (JonRowe) found this in
42
+ rspec/rspec-expectations#219 and provided a first pass implementation in
43
+ diff-lcs#15. I've reworked it because of test failures in Rubinius when
44
+ running in Ruby 1.9 mode. This coerces the added values to the encoding of
45
+ the old dataset (as determined by the first piece of the old dataset).
46
+ https://github.com/rspec/rspec-expectations/issues/219
47
+ https://github.com/halostatue/diff-lcs/pull/15
48
+ * Adding Travis CI testing for Ruby 2.0.
49
+
50
+ == 1.2.1 / 2013-02-09
51
+
52
+ * Bugs Fixed:
53
+ * As seen in https://github.com/rspec/rspec-expectations/pull/200, the
54
+ release of Diff::LCS 1.2 introduced an unnecessary public API change to
55
+ Diff::LCS::Hunk (see the change at
56
+ https://github.com/rspec/rspec-expectations/commit/3d6fc82c for details).
57
+ The new method name (and behaviour) is more correct, but I should not have
58
+ renamed the function or should have at least provided an alias. This
59
+ release restores Diff::LCS::Hunk#unshift as an alias to
60
+ #merge. Note that the old #unshift behaviour was incorrect and will not be
61
+ restored.
62
+
63
+ == 1.2.0 / 2013-01-21
64
+ * Minor Enhancements:
65
+ * Added special case handling for Diff::LCS.patch so that it handles patches
66
+ that are empty or contain no changes.
67
+ * Added two new methods (#patch\_me and #unpatch\_me) to the includable
68
+ module.
69
+ * Bugs Fixed:
70
+ * Fixed issue #1 patch direction detection.
71
+ https://github.com/halostatue/diff-lcs/issues/1
72
+ * Resolved issue #2 by handling string[string.size, 1] properly (it returns
73
+ "" not nil). https://github.com/halostatue/diff-lcs/issues/2
74
+ * Michael Granger (ged) fixed an implementation error in Diff::LCS::Change
75
+ and added specs in pull request #8. Thanks!
76
+ https://github.com/halostatue/diff-lcs/issues/8
77
+ * Made the code auto-testable.
78
+ * Vít Ondruch (voxik) provided the latest version of the GPL2 license file in
79
+ pull request #10. Thanks! https://github.com/halostatue/diff-lcs/issues/10
80
+ * Fixed a documentation issue with the includable versions of #patch! and
81
+ #unpatch! where they implied that they would replace the original value.
82
+ Given that Diff::LCS.patch always returns a copy, the documentation was
83
+ incorrect and has been corrected. To provide the behaviour that was
84
+ originally documented, two new methods were added to provide this
85
+ behaviour. Found by scooter-dangle in issue #12. Thanks!
86
+ https://github.com/halostatue/diff-lcs/issues/12
87
+ * Code Style Changes:
88
+ * Removed trailing spaces.
89
+ * Calling class methods using '.' instead of '::'.
90
+ * Vít Ondruch (voxik) removed unnecessary shebangs in pull request #9.
91
+ Thanks! https://github.com/halostatue/diff-lcs/issues/9
92
+ * Kenichi Kamiya (kachick) removed some warnings of an unused variable in
93
+ lucky pull request #13. https://github.com/halostatue/diff-lcs/issues/13
94
+ Thanks!
95
+ * Embarked on a major refactoring to make the files a little more manageable
96
+ and understand the code on a deeper level.
97
+ * Adding to http://travis-ci.org.
98
+
99
+ == 1.1.3 / 2011-08-27
100
+ * Converted to 'hoe' for release.
101
+ * Converted tests to RSpec 2.
102
+ * Extracted the body of htmldiff into a class available from
103
+ diff/lcs/htmldiff.
104
+ * Migrated development and issue tracking to GitHub.
105
+ * Bugs fixed:
106
+ - Eliminated the explicit use of RubyGems in both bin/htmldiff and bin/ldiff.
107
+ Resolves issue 4 (https://github.com/halostatue/diff-lcs/issues/4).
108
+ - Eliminated Ruby warnings. Resolves issue 3
109
+ (https://github.com/halostatue/diff-lcs/issues/3).
110
+
111
+ == 1.1.2 / 2004-10-20
112
+ * Fixed a problem reported by Mauricio Fernandez in htmldiff.
113
+
114
+ == 1.1.1 / 2004-09-25
115
+ * Fixed bug #891:
116
+ http://rubyforge.org/tracker/?func=detail&atid=407&aid=891&group_id=84
117
+ * Fixed a problem with callback initialisation code (it assumed that all
118
+ callbacks passed as classes can be initialised; now, it rescues
119
+ NoMethodError in the event of private :new being called).
120
+ * Modified the non-initialisable callbacks to have a private #new method.
121
+ * Moved ldiff core code to Diff::LCS::Ldiff (diff/lcs/ldiff.rb).
122
+
123
+ == 1.1.0 / -
124
+ * Eliminated the need for Diff::LCS::Event and removed it.
125
+ * Added a contextual diff callback, Diff::LCS::ContextDiffCallback.
126
+ * Implemented patching/unpatching for standard Diff callback output formats
127
+ with both #diff and #sdiff.
128
+ * Extensive documentation changes.
129
+
130
+ == 1.0.4 / -
131
+ * Fixed a problem with bin/ldiff output, especially for unified format.
132
+ Newlines that should have been present weren't.
133
+ * Changed the .tar.gz installer to generate Windows batch files if ones do not
134
+ exist already. Removed the existing batch files as they didn't work.
135
+
136
+ == 1.0.3 / -
137
+ * Fixed a problem with #traverse\_sequences where the first difference from the
138
+ left sequence might not be appropriately captured.
139
+
140
+ == 1.0.2 / -
141
+ * Fixed an issue with ldiff not working because actions were changed from
142
+ symbols to strings.
143
+
144
+ == 1.0.1 / -
145
+ * Minor modifications to the gemspec, the README.
146
+ * Renamed the diff program to ldiff (as well as the companion batch file) so as
147
+ to not collide with the standard diff program.
148
+ * Fixed issues with RubyGems. Requires RubyGems > 0.6.1 or >= 0.6.1 with the
149
+ latest CVS version.
150
+
151
+ == 1.0 / -
152
+ * Initial release based mostly on Perl's Algorithm::Diff.
@@ -0,0 +1,39 @@
1
+ == License
2
+
3
+ This software is available under three licenses: the GNU GPL version 2 (or at
4
+ your option, a later version), the Perl Artistic license, or the MIT license.
5
+ Note that my preference for licensing is the MIT license, but Algorithm::Diff
6
+ was dually originally licensed with the Perl Artistic and the GNU GPL ("the
7
+ same terms as Perl itself") and given that the Ruby implementation originally
8
+ hewed pretty closely to the Perl version, I must maintain the additional
9
+ licensing terms.
10
+
11
+ * Copyright 2004–2013 Austin Ziegler.
12
+ * Adapted from Algorithm::Diff (Perl) by Ned Konz and a Smalltalk version by
13
+ Mario I. Wolczko.
14
+
15
+ === MIT License
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
18
+ this software and associated documentation files (the "Software"), to deal in
19
+ the Software without restriction, including without limitation the rights to
20
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
21
+ of the Software, and to permit persons to whom the Software is furnished to do
22
+ so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
34
+
35
+ === Perl Artistic License (version 2)
36
+ See the file docs/artistic.txt in the main distribution.
37
+
38
+ === GNU GPL version 2
39
+ See the file docs/COPYING.txt in the main distribution.
@@ -0,0 +1,38 @@
1
+ .autotest
2
+ .gemtest
3
+ .hoerc
4
+ .rspec
5
+ .travis.yml
6
+ Contributing.rdoc
7
+ Gemfile
8
+ History.rdoc
9
+ License.rdoc
10
+ Manifest.txt
11
+ README.rdoc
12
+ Rakefile
13
+ autotest/discover.rb
14
+ bin/htmldiff
15
+ bin/ldiff
16
+ docs/COPYING.txt
17
+ docs/artistic.txt
18
+ lib/diff-lcs.rb
19
+ lib/diff/lcs.rb
20
+ lib/diff/lcs/array.rb
21
+ lib/diff/lcs/block.rb
22
+ lib/diff/lcs/callbacks.rb
23
+ lib/diff/lcs/change.rb
24
+ lib/diff/lcs/htmldiff.rb
25
+ lib/diff/lcs/hunk.rb
26
+ lib/diff/lcs/internals.rb
27
+ lib/diff/lcs/ldiff.rb
28
+ lib/diff/lcs/string.rb
29
+ spec/change_spec.rb
30
+ spec/diff_spec.rb
31
+ spec/hunk_spec.rb
32
+ spec/issues_spec.rb
33
+ spec/lcs_spec.rb
34
+ spec/patch_spec.rb
35
+ spec/sdiff_spec.rb
36
+ spec/spec_helper.rb
37
+ spec/traverse_balanced_spec.rb
38
+ spec/traverse_sequences_spec.rb
@@ -0,0 +1,85 @@
1
+ = Diff::LCS
2
+
3
+ home :: http://diff-lcs.rubyforge.org/
4
+ code :: https://github.com/halostatue/diff-lcs
5
+ bugs :: https://github.com/halostatue/diff-lcs/issues
6
+ rdoc :: http://rubydoc.info/github/halostatue/diff-lcs
7
+
8
+ == Description
9
+
10
+ Diff::LCS computes the difference between two Enumerable sequences using the
11
+ McIlroy-Hunt longest common subsequence (LCS) algorithm. It includes utilities
12
+ to create a simple HTML diff output format and a standard diff-like tool.
13
+
14
+ This is release 1.2.4, fixing a bug introduced after diff-lcs 1.1.3 that did
15
+ not properly prune common sequences at the beginning of a comparison set.
16
+ Thanks to Paul Kunysch for fixing this issue.
17
+
18
+ Coincident with the release of diff-lcs 1.2.3, we reported an issue with
19
+ Rubinius in 1.9 mode
20
+ ({rubinius/rubinius#2268}[https://github.com/rubinius/rubinius/issues/2268]).
21
+ We are happy to report that this issue has been resolved.
22
+
23
+ == Synopsis
24
+
25
+ Using this module is quite simple. By default, Diff::LCS does not extend
26
+ objects with the Diff::LCS interface, but will be called as if it were a
27
+ function:
28
+
29
+ require 'diff/lcs'
30
+
31
+ seq1 = %w(a b c e h j l m n p)
32
+ seq2 = %w(b c d e f j k l m r s t)
33
+
34
+ lcs = Diff::LCS.LCS(seq1, seq2)
35
+ diffs = Diff::LCS.diff(seq1, seq2)
36
+ sdiff = Diff::LCS.sdiff(seq1, seq2)
37
+ seq = Diff::LCS.traverse_sequences(seq1, seq2, callback_obj)
38
+ bal = Diff::LCS.traverse_balanced(seq1, seq2, callback_obj)
39
+ seq2 == Diff::LCS.patch!(seq1, diffs)
40
+ seq1 == Diff::LCS.unpatch!(seq2, diffs)
41
+ seq2 == Diff::LCS.patch!(seq1, sdiff)
42
+ seq1 == Diff::LCS.unpatch!(seq2, sdiff)
43
+
44
+ Objects can be extended with Diff::LCS:
45
+
46
+ seq1.extend(Diff::LCS)
47
+ lcs = seq1.lcs(seq2)
48
+ diffs = seq1.diff(seq2)
49
+ sdiff = seq1.sdiff(seq2)
50
+ seq = seq1.traverse_sequences(seq2, callback_obj)
51
+ bal = seq1.traverse_balanced(seq2, callback_obj)
52
+ seq2 == seq1.patch!(diffs)
53
+ seq1 == seq2.unpatch!(diffs)
54
+ seq2 == seq1.patch!(sdiff)
55
+ seq1 == seq2.unpatch!(sdiff)
56
+
57
+ By requiring 'diff/lcs/array' or 'diff/lcs/string', Array or String will be
58
+ extended for use this way.
59
+
60
+ Note that Diff::LCS requires a sequenced enumerable container, which means that
61
+ the order of enumeration is both predictable and consistent for the same set of
62
+ data. While it is theoretically possible to generate a diff for an unordered
63
+ hash, it will only be meaningful if the enumeration of the hashes is
64
+ consistent. In general, this will mean that containers that behave like String
65
+ or Array will perform best.
66
+
67
+ == History
68
+
69
+ Diff::LCS is a port of Perl's Algorithm::Diff that uses the McIlroy-Hunt
70
+ longest common subsequence (LCS) algorithm to compute intelligent differences
71
+ between two sequenced enumerable containers. The implementation is based on
72
+ Mario I. Wolczko's {Smalltalk version 1.2}[ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st]
73
+ (1993) and Ned Konz's Perl version
74
+ {Algorithm::Diff 1.15}[http://search.cpan.org/~nedkonz/Algorithm-Diff-1.15/].
75
+
76
+ This library is called Diff::LCS because of an early version of Algorithm::Diff
77
+ which was restrictively licensed.
78
+
79
+ == Continuous Integration Status
80
+
81
+ {<img src="https://travis-ci.org/halostatue/diff-lcs.png" />}[https://travis-ci.org/halostatue/diff-lcs]
82
+
83
+ :include: Contributing.rdoc
84
+
85
+ :include: License.rdoc
@@ -0,0 +1,41 @@
1
+ # -*- ruby encoding: utf-8 -*-
2
+
3
+ require 'rubygems'
4
+ require 'rspec'
5
+ require 'hoe'
6
+
7
+ Hoe.plugin :bundler
8
+ Hoe.plugin :doofus
9
+ Hoe.plugin :email
10
+ Hoe.plugin :gemspec2
11
+ Hoe.plugin :git
12
+ Hoe.plugin :rubyforge
13
+ Hoe.plugin :travis
14
+
15
+ Hoe.spec 'diff-lcs' do
16
+ developer('Austin Ziegler', 'austin@rubyforge.org')
17
+
18
+ self.remote_rdoc_dir = '.'
19
+ self.rsync_args << ' --exclude=statsvn/'
20
+
21
+ self.history_file = 'History.rdoc'
22
+ self.readme_file = 'README.rdoc'
23
+ self.extra_rdoc_files = FileList["*.rdoc"].to_a
24
+
25
+ %w(MIT Perl\ Artistic\ v2 GNU\ GPL\ v2).each { |l| self.license l }
26
+
27
+ self.extra_dev_deps << ['hoe-bundler', '~> 1.2']
28
+ self.extra_dev_deps << ['hoe-doofus', '~> 1.0']
29
+ self.extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
30
+ self.extra_dev_deps << ['hoe-git', '~> 1.5']
31
+ self.extra_dev_deps << ['hoe-rubygems', '~> 1.0']
32
+ self.extra_dev_deps << ['hoe-travis', '~> 1.2']
33
+ self.extra_dev_deps << ['rake', '~> 10.0']
34
+ self.extra_dev_deps << ['rspec', '~> 2.0']
35
+ end
36
+
37
+ unless Rake::Task.task_defined? :test
38
+ task :test => :spec
39
+ end
40
+
41
+ # vim: syntax=ruby
@@ -0,0 +1 @@
1
+ Autotest.add_discovery { "rspec2" }
@@ -0,0 +1,32 @@
1
+ #!ruby -w
2
+
3
+ require 'diff/lcs'
4
+ require 'diff/lcs/htmldiff'
5
+
6
+ begin
7
+ require 'text/format'
8
+ rescue LoadError
9
+ Diff::LCS::HTMLDiff.can_expand_tabs = false
10
+ end
11
+
12
+ 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"
15
+ exit 127
16
+ end
17
+
18
+ left = IO.read(ARGV[0]).split($/)
19
+ right = IO.read(ARGV[1]).split($/)
20
+
21
+ options = { :title => "diff #{ARGV[0]} #{ARGV[1]}" }
22
+
23
+ htmldiff = Diff::LCS::HTMLDiff.new(left, right, options)
24
+
25
+ if ARGV[2]
26
+ File.open(ARGV[2], "w") do |f|
27
+ htmldiff.options[:output] = f
28
+ htmldiff.run
29
+ end
30
+ else
31
+ htmldiff.run
32
+ end
@@ -0,0 +1,6 @@
1
+ #!ruby -w
2
+
3
+ require 'diff/lcs'
4
+ require 'diff/lcs/ldiff'
5
+
6
+ exit Diff::LCS::Ldiff.run(ARGV)